• 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.
  • Posts

    • HomeBank 5.9.2 by Razvan Serea HomeBank is a free software (as in "free speech" and also as in "free beer") that will assist you to manage your personal accounting. It is designed to easy to use and be able to analyse your personal finance and budget in detail using powerful filtering tools and beautiful charts. If you are looking for a completely free and easy application to manage your personal accounting, budget, finance then HomeBank should be the software of choice. HomeBank also benefits of more than 19 years of user experience and feedback, and is translated by its users in around 56 languages. Highlights: Cross platform, supports GNU/Linux, Microsoft Windows, Mac OS X Import easily from Intuit Quicken, Microsoft Money or other software Import bank account statements (OFX, QIF, CSV, QFX) Duplicate transaction detection Automatic cheque numbering Various account types : Bank, Cash, Asset, Credit card, Liability Scheduled transaction Category split Internal transfer Month/Annual budget Dynamic powerful reports with charts Automatic category/payee assignment Vehicule cost HomeBank 5.9.2 fixes: bugfix: #2112135 scheduled with limitation don't stop and goes erroneous data bugfix: #2111663 variable scope issue in ui-assign.c bugfix: #2111359 remind status not synced in transfers Download: HomeBank 5.9.2 | 20.2 MB (Open Source) Download: 3rd party packages (macOSX. Ubuntu...etc) View: HomeBank Website | Support | Features | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • How long until the Windows 11 hating bots come and say that Windows 11 committed atrocities against their family and their dog?
    • If you never consented to cookies (required), and you're blocking ad domains and you never see ads on Neowin (despite whitelisting) wouldn't you agree the adblock popup notice is doing what it is supposed to do?
    • It's just exactly what it looks like. The facial polygon count is low and rigid, and the background appears heavily blurred. You can clearly see jagged edges around the car window as it exits the tunnel. The character animations feel like they're from 2010. The Xbox Series S has performance similar to an RX 570 or GTX 1660, which is disappointing and contributes to holding back game development. The Switch GPU is roughly on par with a 2050 or 3050, which is even worse. Developers have often discussed the challenges and limitations of developing for outdated/low end hardware, noting how it can hold back progress. This isn't a new issue. I am sure we will hear about the "Challenges" they had to overcome here and sacrifices that had to be made for compatibility with the outdated/low end hardware.
  • Recent Achievements

    • Week One Done
      jbatch earned a badge
      Week One Done
    • First Post
      Yianis earned a badge
      First Post
    • Rookie
      GTRoberts went up a rank
      Rookie
    • First Post
      James courage Tabla earned a badge
      First Post
    • Reacting Well
      James courage Tabla earned a badge
      Reacting Well
  • Popular Contributors

    1. 1
      +primortal
      400
    2. 2
      +FloatingFatMan
      178
    3. 3
      snowy owl
      171
    4. 4
      ATLien_0
      169
    5. 5
      Xenon
      134
  • Tell a friend

    Love Neowin? Tell a friend!