Welcome Guest Search | Active Topics | Sign In | Register

Advice on creating PDF with many pages Options
Alastair Young
Posted: Tuesday, February 4, 2014 9:44:24 AM
Rank: Newbie
Groups: Member

Joined: 2/18/2013
Posts: 2
Can you please advise on the best approach to producing a single pdf comprising of many (up to 10000) pages?

Each page is produced from a single HTML template with content replaced from db. Each page is completely self contained with inline css and images base64 encoded (as in <img id="coLogo" src="data:image/jpeg;base64,/9j/4AAQSkZ....."/> )

Running into problems with timeout such as ..
System.Exception: The operation has timed out.
at EO.Pdf.Internal.lt.a(a A_0)
at EO.Pdf.HtmlToPdfSession.a(a A_0)
at EO.Pdf.HtmlToPdfSession.a(j1 A_0, String A_1, String A_2, Int32 A_3, Int32 A_4, Boolean A_5)
at EO.Pdf.HtmlToPdfSession.a(j1 A_0, String A_1, String A_2, Boolean A_3)
at EO.Pdf.HtmlToPdfSession.LoadHtml(String html)
at EO.Pdf.HtmlToPdf.ConvertHtml(String html, PdfDocument doc, HtmlToPdfOptions options)
at EO.Pdf.HtmlToPdf.ConvertHtml(String html, PdfDocument doc)

using:
HtmlToPdf.Options.PageSize = PdfPageSizes.FromName("A4")
HtmlToPdf.Options.OutputArea = New RectangleF(0.18F, 0.875F, 7.9F, 10.7F)
HtmlToPdf.Options.AutoAdjustForDPI = False
HtmlToPdf.Options.AutoFitX = HtmlToPdfAutoFitMode.None
HtmlToPdf.Options.AutoFitY = HtmlToPdfAutoFitMode.None
HtmlToPdf.Options.MinLoadWaitTime = 10
HtmlToPdf.Options.MaxLoadWaitTime = 100
HtmlToPdf.Options.NoScript = True


Is it more robust to make 1 pdf per page then merge into one document?

Thanks

eo_support
Posted: Tuesday, February 4, 2014 9:59:13 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,196
Hi,

You should not do that. PDF is designed for a "document". 10000 page far exceed the size of a "normal" document and you are only pushing the limits on everything and even if you managed to put 10000 pages into a single PDF file, nobody will be interested in siting there for minutes to wait for it to be open nor want to navigate through such a huge file. A better way would be using an HTML index file, then a number of smaller PDF file in zip format and that would be much easier to navigate for the user.

Thanks!
Alastair Young
Posted: Wednesday, February 5, 2014 4:31:57 AM
Rank: Newbie
Groups: Member

Joined: 2/18/2013
Posts: 2
Point taken about "nobody will be interested in siting there" however we're not producing the PDF for this purpose. The pdf is sent to a print shop who then print and post. A single pdf per print job is our present mode of operating. The move to using EO from existing solution was to speed up the process of making template changes.

When producing a single pdf is it more efficient to use:
<html>
<head>
<style>...</style>
<body>
page1
<div class="page-break"/>
page2
<div class="page-break"/>
.....
page999
<div class="page-break"/>
</body>
</html>

Instead of:
<html><head><style></style></head><body>page1</body></html>
<html><head><style></style></head><body>page999</body></html>

Thanks






eo_support
Posted: Wednesday, February 5, 2014 8:46:32 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,196
Hi,

It depends. As you have already noticed, when you have too many pages, you will get time out error. The bigger the file, the more of everything (time, memory, etc) it takes to convert and the more likely it will crash because it's simply beyond it's capacity. So sometimes it's faster to convert each page separately and then merge them together. However even if you do that, the merge process may still fail due to the unusual large number of file. If that's the case, the only option you have will be changing the way you operate with the printing house. Simply put, when you have too many pages, it is not possible to carry them all together.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.