• 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

    • GeForce NOW adds support for 25 games in June, including Rematch and Dune: Awakening by Pulasthi Ariyasinghe A new month is here, and Nvidia is starting it off with a big GeForce NOW announcement as usual. The latest reveal has support for 25 games that are incoming in June alone, with some highlights including Rematch, The Alters, FBC: Firebreak, Dune: Awakening, and even the Borderlands trilogy from Gearbox and 2K. Just this week alone, Nvidia is adding support for the following ten games for GeForce NOW subscribers: Symphonia (New release on Xbox, available on PC Game Pass, June 3) Pro Cycling Manager 25 (New release on Steam, June 5) Tour de France 2025 (New release on Steam, June 5) Dune: Awakening – Advanced Access (New release on Steam, June 5) 7 Days to Die (Xbox) Clair Obscur: Expedition 33 (Epic Games Store) Cubic Odyssey (Steam) Drive Beyond Horizons (Steam) Police Simulator: Patrol Officers (Xbox, available on PC Game Pass) Sea of Thieves (Battle.net) Nvidia also has plans to add a bunch more games in the rest of June, which is when most of the biggest new releases are coming: Dune: Awakening (New release on Steam, June 10) MindsEye (New release on Steam, June 10) The Alters (New release on Steam and Xbox, available on PC Game Pass, June 13) Architect Life: A House Design Simulator (New release on Steam, June 19) Crime Simulator (New release on Steam, June 17) FBC: Firebreak (New release on Steam and Xbox, available on PC Game Pass, June 17) Lost in Random: The Eternal Die (New release on Steam and Xbox, available on PC Game Pass, June 17) Broken Arrow (New release on Steam, June 19) REMATCH (New release on Steam and Xbox, available on PC Game Pass, June 19) DREADZONE (New release on Steam, June 26) System Shock 2: 25th Anniversary Remaster (New release on Steam, June 26) Borderlands Game of the Year Enhanced (Steam) Borderlands 2 (Steam and Epic Games Store) Borderlands 3 (Steam and Epic Games Store) Easy Red 2 (Steam) The company has a tendency to add many more games to its cloud gaming service outside of these early announcements, so check back as weeks go by to see what's new. Steam Deck owners recently received a better way of using GeForce NOW too, all thanks to a dedicated app. As summer continues, don't forget that the GeForce NOW 40% off sale is still active too, with Nvidia cutting the price of the Performance membership plan until July. As always, keep in mind that unlike subscription services like Game Pass, a copy of a game must be owned by the GeForce NOW member (or at least have a license via PC Game Pass) to start playing via Nvidia's cloud servers.
    • Thought I'd quote myself as reference to what was happening yesterday. I wasn't getting the pop up then in Firefox, but I did just now using it.
    • With DARPA the military can do their own research and then the tech can enter the public domain and benefit the people. If we use public money to buy privatized tech then we don't get that benefit and even worse we will probably pay higher prices in the end. Unfortunately we are ditching NASA for private tech. If you look at all of the technologies developed by NASA that benefit us, you can see why going private can be a huge loss and jack up prices for consumers when private patents are involved. This could have a detrimental effect on innovation by monopolizing certain advancements and reduce access to advancements for the average person, even though our tax dollars would be funding these advancements.
    • Is Microsoft saying that here? Because I don't see it anywhere. It's just a dumb article talking about some new screen, that's all.
  • 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
      405
    2. 2
      +FloatingFatMan
      181
    3. 3
      snowy owl
      175
    4. 4
      ATLien_0
      170
    5. 5
      Xenon
      135
  • Tell a friend

    Love Neowin? Tell a friend!