• 0

[HTML or PHP] Inserting Page Break?


Question

14 answers to this question

Recommended Posts

  • 0

Can you explain to me how this is even possible? You'd have to have different pages, it's not like word where you can just end a page and start the next. Printing out several breaks to push the content to the end of the "page" wouldn't work either, people use different resolutions, etc, and it would never work out. Perhaps I'm missing what you're looking for, but I don't think it's possible (unless of course, you literally use different pages).

  • 0

you could use some javascript trickery to detect the users resolution and create a table with rows of that particular height. then you just loop through printing out your data to different rows if a new page is required. this would work for on screen "pages" but if you want to print this to a printer then i have no idea.

  • 0
  remake said:
Can you explain to me how this is even possible? You'd have to have different pages, it's not like word where you can just end a page and start the next. Printing out several breaks to push the content to the end of the "page" wouldn't work either, people use different resolutions, etc, and it would never work out. Perhaps I'm missing what you're looking for, but I don't think it's possible (unless of course, you literally use different pages).

Er, yeah, I mean literally different pages. Sorry for not making that clear.

Its a report that will be printed out. I want each block to be at the top of each page. I believe all printers would print it almost the same.. I dont care how it looks on the monitor, I just want it to print on seperate pages.

  • 0

I think you're looking for something like this page:

http://www.w3.org/TR/REC-CSS2/page.html

ex.

<html>
<head>
<style>
@page { size 8.5in 11in; margin: 2cm }
div.page { page-break-after: always }
</style>
</head>
<body>
<div class="page">Page 1 Here</div>
<div class="page">Page 2 Here</div>
</body>
</html>

try that in a browser, shows up right after each other, press print preview and they are on 2 separate pages.

  • 0

Pretty interesting problem.

The standard Form Feed character for a printer is ASCII 12 (dec). Not sure if you can get a PHP page to start dumping raw codes like that to the printer (and, for modern printers that print graphical images, it won't work unless you are just dumping raw ASCII text to begin with (or use mostly text, and have only a few controlled images - force the form feed in the middle of the text any time, just not in the images).

[EDIT: The post above mine looks like your best solution!] :yes:

  • 0
  dev said:
i'm pretty sure thats impossible unless you make the php script make a word document and then download and print using word

Hmm, thats not a bad idea actually. Is that possible? If so, how? If I can do that, then I can get rid of the ugly URL, page numbers, time, and header that show up on the HTML-printed pages.

@wesdeboer: Thanks a lot, welcome to neowin! I'll definitely try that one out.

If someone could give more insight on the Word thing as well, it would be much appreciated.

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Popular Now

  • Posts

    • The New Outlook is horrible at best. The one thing they push so hard at is that stupid ad that has to stay on top to promote their stupid Office 365. They can go to hell with that BS.
    • Nvidia shares Windows hotfix driver 576.66 for FC 25 crashes, browser video bugs, and more by Sayan Sen Nvidia has been on a roll lately with its release of hotfix drivers, which are essentially emergency display driver updates meant to fix issues.. The company's GeForce RTX 5000 series graphics cards have been plagued with several issues, and these hotfixes as well as the regular GameReady driver updates, are being pushed out to clear up the software side problems. The first hotfix was released in early March with version 572.65 that resolved black screen bootups. This was followed by another, version 572.75, that addressed clocking issues. After that, version 576.15 helped fix Windows Sleep and Modern Standby-related temperature monitoring bugs. With the latest hotfix driver update, 576.66, Nvidia says that it has resolved a video playback bug in web browsers that can lead to red-green flashing and similar corruption of that nature. Aside from that, the driver also fixes multiple game crashes including EA Sports FC 25, and more. Nvidia notes that the new hotfix driver is based on its latest GameReady driver 576.52. As a refresher, that driver added support for Nvidia's new RTX 5060. The full changelog for the new hotfix driver 576.66 is given below: Dune: Awakening may crash during gameplay [5273568] EA Sports FC 25 may crash during gameplay [5251937] [RTX 50 series] Dragons Dogma 2 displays shadow flicker [5252205] [RTX 50 series] Video playback in a web browser may show brief red/green flash corruption [5241341] Clair Obscur: Expedition 33 may crash [5283401] If you are encountering problems like the ones described above on Windows 11 or 10, you should definitely try updating the driver to the hotfix version here. In order to download the update, head over to Nvidia's official website on this page where you can also view the driver's release notes.
  • Recent Achievements

    • Week One Done
      jrromero17 earned a badge
      Week One Done
    • One Month Later
      jrromero17 earned a badge
      One Month Later
    • Conversation Starter
      johnwin1 earned a badge
      Conversation Starter
    • One Month Later
      Marwin earned a badge
      One Month Later
    • One Year In
      fred8615 earned a badge
      One Year In
  • Popular Contributors

    1. 1
      +primortal
      242
    2. 2
      snowy owl
      156
    3. 3
      ATLien_0
      144
    4. 4
      +FloatingFatMan
      138
    5. 5
      Xenon
      131
  • Tell a friend

    Love Neowin? Tell a friend!