Rank: Newbie Groups: Member
Joined: 11/26/2019 Posts: 2
|
Hi Everybody, I am facing a really weird problem, I have a web page that sometimes has content which is larger than the output size (793x1122) I have set for the PDF.
The ConvertURL or RenderAsPDF is generating only ONE page, the top 1122px part of the web page and rest is stripped. I want all of the HTML to go into the PDF, the rest of it being exported to the next page(s). So that the pdf can have more than ONE pages.
Any help in this regard will be highly appreciated.
I am using the following function to set the PDF Options:
Private Shared Sub SetHtmlToPDFOptions(ByVal isPortrait As Boolean) Dim topMargin_mm As Single Dim lrMargin_mm As Single Dim bottomMargin_mm As Single Dim mmToInchesMultiplier As Single = 1 / 25.4 Dim pageHeight As Single = 1122 Dim pageWidth As Single = 793 HtmlToPdf.MaxConcurrentTaskCount = 50 HtmlToPdf.Options.AutoAdjustForDPI = True HtmlToPdf.Options.PageSize = EO.Pdf.PdfPageSizes.A4 HtmlToPdf.Options.NoLink = True HtmlToPdf.Options.UsePrintMedia = False
'HtmlToPdf.Options.PageSize = PdfPageSizes.A4 'New SizeF(PdfPageSizes.A4.Height, PdfPageSizes.A4.Width) 'HtmlToPdf.Options.PageSize = New SizeF(pageHeight * mmToInchesMultiplier, pageWidth * mmToInchesMultiplier) If isPortrait Then lrMargin_mm = 0 ' 0.5in topMargin_mm = 0 bottomMargin_mm = 0 '0.95in HtmlToPdf.Options.OutputArea = New RectangleF(lrMargin_mm * mmToInchesMultiplier, topMargin_mm * mmToInchesMultiplier, (pageWidth - 2 * lrMargin_mm) * mmToInchesMultiplier, (pageHeight - topMargin_mm - bottomMargin_mm) * mmToInchesMultiplier) HtmlToPdf.Options.AutoFitX = HtmlToPdfAutoFitMode.ShrinkToFit HtmlToPdf.Options.AutoFitY = HtmlToPdfAutoFitMode.None Else pageHeight = 210.82 pageWidth = 296.92 topMargin_mm = 7.62 ' .3in bottomMargin_mm = 14 ' .3in lrMargin_mm = 7.62 ' 0.3in HtmlToPdf.Options.OutputArea = New RectangleF(lrMargin_mm * mmToInchesMultiplier, topMargin_mm * mmToInchesMultiplier, (pageWidth - 2 * lrMargin_mm) * mmToInchesMultiplier, (pageHeight - topMargin_mm - bottomMargin_mm) * mmToInchesMultiplier) HtmlToPdf.Options.PageSize = New SizeF(PdfPageSizes.A4.Height, PdfPageSizes.A4.Width) HtmlToPdf.Options.AutoFitY = HtmlToPdfAutoFitMode.ShrinkToFit HtmlToPdf.Options.AutoFitX = HtmlToPdfAutoFitMode.None End If
EO.Pdf.Runtime.AddLicense(getEOPDFLicense)
End Sub
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,218
|
Hi, Such issues usually has to do with your HTML. You can try to comment your HTML out block by block and see what triggers the problem. Usually once you find out what triggers the problem, we will be able to tell you why. The most common cause for such issue is page break settings. For example, you have a page-break-inside:avoid on your entire page, then the converter is prevented from breaking the contents into multiple pages. See here for more details about page break settings: https://www.essentialobjects.com/doc/pdf/htmltopdf/paging.aspxThanks!
|
Rank: Newbie Groups: Member
Joined: 11/26/2019 Posts: 2
|
Hi Support, Thank you very much for the reply.
The page-break-inside is set to "auto" for every div in this page.
It is a single div which contains all the html, the pdf generated is only one page pdf. The rest of the page contents are just simply stripped off.
Is there any setting which I can set to force multiple page pdf generation when the contents are larger than a single page?
The issue is present in both RenderAsPDF and ConvertURL.
If am able to figure out the faulty HTML, most probably i'll also be able to solve it too.... :)
If you can please give me some hints, e.g. what settings / property strips of page contents, I might be able to solve it.
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,218
|
Hi,
This has nothing to do with any settings ---- it has to do with your page HTML. You just have to try to comment/modify your HTML until you get the desired result, and in that process you will find out what triggered it. We would be doing the same if we were to troubleshoot such issues. There is no point of trying different settings. It would be shooting in the dark without any chance of hitting anything.
Thanks
|