?
Solved

Convert HTML to PDF

Posted on 2006-11-30
14
Medium Priority
?
530 Views
Last Modified: 2013-12-02
i am converting several HTML pages to PDF, but when i do the PDF conversion has page breaks in places that i don't want them.  is there anyway to add a tag to the HTML doc that a PDF converter will recognize as a page break and insert breaks at the specific point?

i am using Adobe Acrobat Professional 7.0 for the conversion.
0
Comment
Question by:scottspivey
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 4
14 Comments
 
LVL 26

Expert Comment

by:EddieShipman
ID: 18046980
You may be able to use the CSS identifiers page-break-before or page-break-after to do this. I have not tired it, though.
0
 
LVL 1

Author Comment

by:scottspivey
ID: 18046995
EddieShipman ,

i will give it a shot and see what happens.

scott
0
 
LVL 10

Expert Comment

by:dennis_maeder
ID: 18047902
A 3rd-party freeware converter html2ps (coupled with ps2pd) uses a comment tag to hint a page break. Perhaps this is also used in the adobe converter?

<!--NewPage-->

From http://user.it.uu.se/~jan/html2psug.html
doc-sep
A string of HTML code that will be inserted between the documents when more than one are converted. The default is "<!--NewPage-->", which will cause a page break.

D
0
Are You Using the Best Web Development Editor?

The worlds of web hosting and web development are constantly evolving. Every year we see design trends change, coding standards adapt and new frameworks/CMS created. With such a quick pace of change it’s easy to get lost trying to keep up.

See if your editor made the list.

 
LVL 1

Author Comment

by:scottspivey
ID: 18047980
EddieShipman,

>>CSS identifiers page-break-before or page-break-after

they did not work.

scott
0
 
LVL 1

Author Comment

by:scottspivey
ID: 18047986
dennis_maeder,

i am looking at that now and will see what happens.

scott
0
 
LVL 10

Expert Comment

by:dennis_maeder
ID: 18047994
I should add from html2ps:

A few extensions to HTML 4.01 are recognized by html2ps:

A page break can be forced by including any of these in a document:
   <HR class=PAGE-BREAK>
   
   <?page-break>
   
   <!--NewPage-->

and also correct ps2pd above to ps2pdf.

The <HR> method must assume CSS which is a mechanism to actuate page-break-after.
e.g.
<HR style="page-break-after:always ">
or
<HR style="page-break-after:auto">

D


D
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 18048750
I doubt that Adobe would follow the same conventions.
0
 
LVL 10

Expert Comment

by:dennis_maeder
ID: 18050906
Eddie,

I have no idea whether adobe is even html aware.
I suspect IE takes html, renders it to postscript and the Adobe plugin takes over from there.

However this should work if the renderer honors CSS.

<HR style="page-break-after:always">

D
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 18053808
But he wants to convert it to PDF, not PS.
0
 
LVL 1

Author Comment

by:scottspivey
ID: 18053836
dennis_maeder,

Eddie is correct, i do want to convert to PDF not PS, but i wonder if i will have to go through a two step process to do this.  i have found that if i pull the txt file into msword, replace the <PAGE> tags with <PAGE> ^m, adobe regognizes those as page breaks and puts the break where i want it.  but i would rather not have to go through MSWord to get my results.

scott
0
 
LVL 26

Accepted Solution

by:
EddieShipman earned 1000 total points
ID: 18054612
You can do that by automating MSWord. If you need help doing that, post another question. I'm sure someone
will help you out.
0
 
LVL 10

Assisted Solution

by:dennis_maeder
dennis_maeder earned 1000 total points
ID: 18055971
Scott,

Free HTML to PDF conversion on the fly happens at  e.g.
http://www.rustyparts.com/pdf.php
which uses html2ps underthe hood and will honor the tags I presented above.

Its also worth taking a look at
http://www.easysw.com/htmldoc/pdf-o-matic.php
which supports <!-- NEW PAGE -->
and many other similar tags

D
0

Featured Post

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
This video Micro Tutorial is the second in a two-part series that shows how to create and use custom scanning profiles in Nuance's PaperPort 14.5 (http://www.experts-exchange.com/articles/17490/). But the ability to create custom scanning profiles a…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

741 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question