• 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

    • Instead of writing this article, you should’ve just replied to the original reddit post…
    • Cloud storage of course is not for all types of files users have but more users should be taking advantage of the cloud because otherwise their files are not backed up at all. Most regular users are not going to do that so automatic backup of their data is a good idea and should be recommended. The cloud is just another service/tool with advantages and disadvantages.
    • People do this with their iPhones and Androids. Smart people use cloud services as backups. No company deletes your account just like that. No company blocks your data for no reason. Having an external SSD and a paid cloud service is a must for anyone who works and for anyone who has sensitive data that needs to be backed up several times. Every CEO of a company has a corporate cloud service on their devices, but home users shouldn't use it, why?
    • Camtasia screen recorder now has a free version that works in your browser by Aditya Tiwari TechSmith, the minds behind Camtasia, has announced an online version of its popular screen recording and video editing tool. The web-based version, called Camtasia Online, is now available through popular web browsers like Google Chrome and Safari. Camtasia Online is essentially a stripped-down version of its desktop counterpart. It is designed to let you screen record, customize, share, and collaborate on high-quality videos without needing to download any software or purchase a subscription. Screen recording tools are often used to create step-by-step walkthroughs and tutorials, personalized feedback or coaching, and showcase a product or service. Camtasia has been around since 2002 and is primarily accessible through paid offerings. The screen recorder has over 34 million users globally. TechSmith offers a free trial of the desktop version, but the exported files automatically include a watermark. That's not the case with its modern counterpart, according to the company, which doesn't require any subscription. Note that while the online screen recorder is free to use, you still need a TechSmith account to use it. "While this first release focuses on streamlined creation, it will continue to grow in capability, and users can move projects into the Camtasia desktop editor for more advanced editing when needed,” TechSmith's CTO, Tony Lambert, said in an emailed statement. The web-based version allows you to create 1080p short clips (Scenes) of up to 5 minutes in length, with options to record a specific app, window, or the entire screen. It can record the screen, camera, and microphone on separate layers for more flexibility during editing. You can record multiple scenes and export them as a single video file. Camtasia Online offers a variety of visual effects and backgrounds, and the ability to pick a custom size and position on the screen. For instance, you can place the screen recording in the top-left or bottom-right corner of the screen, depending on your preference. Camtasia Online comes with more than 85 pre-defined "looks" to match your preference, its maker said. You can remove the background, add borders, drop shadows, make corners round, add reflections, and more, before and after recording a scene. You can also trim a video after recording with support for reversible changes. The online screen recorder also lets you collaborate with other users by sending invitation links. You can either give them access to the entire project or just a single scene. You can also preview the scenes before exporting them or re-record if something doesn't feel right. TechSmith also offers integration with Camtasia 2025's desktop version, allowing you to utilize additional features such as transitions, annotations, and dynamic captions. You can click on the Export button to download the project and use it in the desktop editor. Overall, Camtasia Online could be a suitable option for quick screen recording sessions and a viable choice for beginners. However, one downside is that it can be a bit tricky to download the video file directly through your browser. First, click on the "Export to Screencast" option in Export settings, which opens TechSmith's online hosting service. Then, make sure you're signed in to your TechSmith account, and click on More > Download to download the video file to your device.
    • Intel is pretty consistent about dropping a new CPU every year, typically in Q3. The fact that we are starting to get more information now implies they are on track.
  • Recent Achievements

    • Experienced
      dismuter went up a rank
      Experienced
    • One Month Later
      mevinyavin earned a badge
      One Month Later
    • Week One Done
      rozermack875 earned a badge
      Week One Done
    • Week One Done
      oneworldtechnologies earned a badge
      Week One Done
    • Veteran
      matthiew went up a rank
      Veteran
  • Popular Contributors

    1. 1
      +primortal
      697
    2. 2
      ATLien_0
      269
    3. 3
      Michael Scrip
      212
    4. 4
      +FloatingFatMan
      186
    5. 5
      Steven P.
      142
  • Tell a friend

    Love Neowin? Tell a friend!