Damn you PDFs -- There must be a better way!

Here’s the deal; I frequently have to make PDF documents from HTML documents for my job. But it looks gnarly if you just take the straight HTML and make a PDF file out of it, instead, it’s much nicer to space out the sections so they each start on a new page – the only problem is that this takes forever with my job’s current position!

The method I was taught to use for my job was to open the HTML file in IE, and use the “Print Preview” to see how the pages are aligned. When I see a section that’s not properly lined up, I need to close the Print Preview, go into the actual HTML source code and add a whole of <BR> tags and hope it’s enough to push the content to the next page. Once I save the HTML, I go back to IE, refresh the page, then go back to Print Preview to see if the changes worked. If not, I get to redo it again; at least once per page (and often many more). This is especially tedious and inefficient, and to make matters worse, IE can take a while to render 100+ pages, which adds a 10-20 second delay each time I do this --ugh. Once this is finally done, we use a “Print to PDF” program to make the PDF.

Surely there must be an easier way! I found one method that sort of worked, but isn’t perfect. I can use Microsoft Word to open the HTML document (which displays it like a webpage), then simply press the Return Key to add spaces where needed. THIS IS SO MUCH EASIER. The only downside is that Word renders some HTML in a janky king of way – especially tables!

So is there a good program I can use that displays HTML similar to how IE does, while allowing me to add spaces to the document in a “Live Preview” of what it will look like when printed to PDF? Thanks!

Dreamweaver. There’s probably a freeware editor that does the same.

But can that display content as if it were being printed out, in a page view? I’m familar with several visual HTML programs (haven’t tried Dreamweaver though), but I’m not sure they can display the content similar to how Word can.

Am I incorrect?

I don’t have an answer to your specific question, but have you looked at the pageBreakBefore CSS attribute? This forces a page break to occur before the affected element while printing (which presumably includes printing to PDF), without affecting how it’s displayed in the browser.

For example, if all the sections that need to start on a new page begin with the <h2> tag, you could do something like this:

      H2 { page-break-before: always }
  <H2>A section</H2>
    <P>Bla bla bla bla bla bla bla bla. Bla bla bla bla.</P>
    <P>Bla bla, bla bla bla. Bla bla bla; bla bla! Bla bla bla? Bla!</P>
  <H2>Another section on a new page</H2>
    <P>Bla bla bla bla bla! Bla bla bla.</P>
    <P><B>Mbossa</B> is pretty cool.</P>

If you can’t assume that every

tag starts a new page, you can apply the style directly to the tags that do:

  <H2>A section</H2>
    <P>Bla bla bla bla bla bla bla bla. Bla bla bla bla.</P>
    <P>Bla bla, bla bla bla. Bla bla bla; bla bla! Bla bla bla? Bla!</P>
  <H2>A section on the same page</H2>
    <P>Bla bla bla bla bla! Bla bla bla.</P>
  <H2 style="page-break-before: always">A section on a new page</H2>
    <P>HONK HONK!!!</P>

Holy shit Mbossa, that works like fucking magic. Thank you so much for posting that; it works better than what I was even asking for originally! Oh man, this will save sooooo much time.

Since I don’t use any <H1> (or whatever # it may be) commands, I just opened, then closed the tag immediatly after, like so: <h1></h1>. Awesome. Thanks again!