hi Team,
I am using “com.aspose.pdf.HtmlFragment” DOM approach.
Document doc = new Document();
Page page1 = doc.getPages().add();
HtmlFragment htmlfrag = new HtmlFragment(firstName + “
” +address); //address -> very long html content
htmlfrag.getMargin().setBottom(10);
htmlfrag.getMargin().setTop(20);
page1.getParagraphs().add(htmlfrag);
I am getting error when i am saving the document.
Exception in thread “main” class com.aspose.pdf.internal.p234.z9: The rectangle size can not be larger page size
Parameter name: rectangle
com.aspose.pdf.z9.(Unknown Source)
com.aspose.pdf.Page.m1(Unknown Source)
com.aspose.pdf.Page.m1(Unknown Source)
com.aspose.pdf.z125.m5(Unknown Source)
com.aspose.pdf.Page.m2(Unknown Source)
com.aspose.pdf.Page.m6(Unknown Source)
com.aspose.pdf.ADocument.m5(Unknown Source)
com.aspose.pdf.Document.m5(Unknown Source)
com.aspose.pdf.ADocument.saveInternal(Unknown Source)
com.aspose.pdf.Document.saveInternal(Unknown Source)
com.aspose.pdf.ADocument.save(Unknown Source)
com.aspose.pdf.Document.save(Unknown Source)
com.raj.aspose.pdfgeneration.dom.GeneratePDF4mHTMLDOM.main(GeneratePDF4mHTMLDOM.java:53)
Please help me out in addressing this issue. The data breaks at the end of Page 1 and does not flow to next new page.
Thanking You
Rajesh
Hi Rajesh,
Thanks for contacting support.
I have tested the scenario using Aspose.Pdf for Java 9.5.2 where I have used the following code snippet (with sample HTML string) and I am unable to notice any issue. Can you please share the complete code snippet which can help us in replicating the problem in our environment. We are sorry for this inconvenience.
[Java]
Document doc = new Document();
Page page1 = doc.getPages().add();
HtmlFragment htmlfrag = new HtmlFragment("firstName" + "<br/>" + "<b>A sample string to be used as address. <i>Exception in thread main class com.aspose.pdf.internal.p234.z9: The rectangle size can not be larger page size Parameter name: rectangle</i></b>");
// address -> very long html content
htmlfrag.getMargin().setBottom(10);
htmlfrag.getMargin().setTop(20);
page1.getParagraphs().add(htmlfrag);
doc.save("c:/pdftest/HTML_Added.pdf");
// save PDF file
content in address field is pasted below
Land-locked and tucked away in southeastern Europe, Moldova’s geographical location allows for a renowned winemaking industry.
\nLand-locked and tucked away in southeastern Europe, Moldova’s geographical location allows for a renowned winemaking industry.
\nLand-locked and tucked away in southeastern Europe, Moldova’s geographical location allows for a renowned winemaking industry.
\nLand-locked and tucked away in southeastern Europe, Moldova’s geographical location allows for a renowned winemaking industry.
\nLand-locked and tucked away in southeastern Europe, Moldova’s geographical location allows for a renowned winemaking industry.
\nLand-locked and tucked away in southeastern Europe, Moldova’s geographical location allows for a renowned winemaking industry.
\nLand-locked and tucked away in southeastern Europe, Moldova’s geographical location allows for a renowned winemaking industry.
- \n\t
- Land-locked and tucked away in southeastern Europe, Moldova’s geographical location allows for a renowned winemaking industry. \n
- \n\t
- Land-locked and tucked away in southeastern Europe, Moldova’s geographical location allows for a renowned winemaking industry. \n
Land-locked and tucked away in southeastern Europe, Moldova’s geographical location allows for a renowned winemaking industry.
\n\n\n\n\n\n
\nLand-locked and tucked away in southeastern Europe, Moldova’s geographical location allows for a renowned winemaking industry.
\nLand-locked and tucked away in southeastern Europe, Moldova’s geographical location allows for a renowned winemaking industry.
\nLand-locked and tucked away in southeastern Europe, Moldova’s geographical location allows for a renowned winemaking industry.
\nLand-locked and tucked away in southeastern Europe, Moldova’s geographical location allows for a renowned winemaking industry.
\nLand-locked and tucked away in southeastern Europe, Moldova’s geographical location allows for a renowned winemaking industry.
Land-locked and tucked away in southeastern Europe, Moldova’s geographical location allows for a renowned winemaking industry.
\n\n<a href=\"http://google.com\<http://google.com/>">Land-locked and tucked away in southeastern Europe, Moldova’s geographical location allows for a renowned winemaking industry.
\n
Cell 1 | Cell 2 |
Cell 3 | Cell 4 |
\n\n
\n
\nLand-locked and tucked away in southeastern Europe, Moldova’s geographical location allows for a renowned winemaking industry.
\nLand-locked and tucked away in southeastern Europe, Moldova’s geographical location allows for a renowned winemaking industry.
\nLand-locked and tucked away in southeastern Europe, Moldova’s geographical location allows for a renowned winemaking industry.\n\n
\nLand-locked and tucked away in southeastern Europe, Moldova’s geographical location allows for a renowned winemaking industry.
\n\n
\nLand-locked and tucked away in southeastern Europe, Moldova’s geographical location allows for a renowned winemaking industry.
\n\n<br />\n<span style=\"font-family:georgia,serif\">Land-locked and tucked away in southeastern Europe, Moldova’s geographical location allows for a renowned winemaking industry.
\nLand-locked and tucked away in southeastern Europe, Moldova’s geographical location allows for a renowned winemaking industry.
\n\n
\nLand-locked and tucked away in southeastern Europe, Moldova’s geographical location allows for a renowned winemaking industry.
\n<span style=\"background-color:#FFD700\">Land-locked and tucked away in southeastern Europe, Moldova’s geographical location allows for a renowned winemaking industry.
\n
Hi Rajesh,
Thanks for your sharing html string. While testing the scenario with your shared document, we have managed to reproduce the issue with latest version of Aspose.Pdf for Java 9.5.2. We have logged a ticket PDFNEWJAVA-34555 in our issue tracking system for further investigation and resolution. We will notify you as soon as it is resolved.
We are sorry for the inconvenience caused.
Best Regards,
Hi Tilal,
Hi Rajesh,
Hi Rajesh,
Our development team has completed the investigation of the HtmlFragment related issue and is now working on the fix.
However, if you have a requirement to create a PDF document from HTML only, you should use HtmlLoadOptions instead of the HtmlFragment object. Please check the sample code snippet for the purpose.
String html= "<style
type=text/css>table {font-size: 12; line-height:1.0;}</style><table
width=100% cellpadding=10 cellspacing=6 border=0><tr><td width=25%
valign=top><b>Setup Info:</b></td><td
width=75%>Created by Thadmin, Sue1 on 2/11/2009 3:23:08 PM
PT</td></tr><tr><td width=25% valign=top><b>Deadline:
</b></td><td
width=75%>None</td></tr><tr><td width=25%
valign=top><b>Vote Topic: </b></td><td
width=75%>Anonymous Test</td></tr><tr><td width=25%
valign=top><b>Vote Description: </b></td><td
width=75%><strong><span style=color: #339999;>This is an
anonymous
description.</span></strong></td></tr><tr><td
width=25% valign=top><b>Results: </b></td><td
width=75%>0 In Favor / 0 Against / 1
Abstain</td></tr><tr><td width=25%
valign=top><b>Participants: </b></td><td
width=75%>Bestertester, Fester Sr.;Carpenter, Dan Q.;f, f;Kline,
Robert;Lewis, Tyler;Marotta, Garret E.;Mr. Admin, Sales;Oliver, Bill
J.;Steinway, Mitch;Thadmin, Sue1;User, Garret A.;Waltz,
Tom</td></tr><tr><td width=25%
valign=top><b>Signed Vote: </b></td><td
width=75%>This vote did not use Directors Desk's Signed Vote technology
requiring secondary user authentication at the same time the vote was
cast.</td></tr><tr><td width=25%
valign=top><b>Anonymous Vote: </b></td><td
width=75%>This vote was not performed anonymously such that no vote participants
were able to see how other participants
voted.</td></tr><tr><td width=25%
valign=top><b>UWC Nullify Option: </b></td><td
width=75%>This vote did not contain a unanimous written consent option allowing
vote participants to choose a Nullify Vote option to stop the online vote and
call for a discussion of the issue.</td></tr></table>";
html = "firstName" + "<br/>"
+ html + "<br/>" + html + "<br/>" + html + "<br/>" + html + "<br/>"
+ html + "<br/>" + html;
HtmlLoadOptions loadOptions = new HtmlLoadOptions();
loadOptions.getPageInfo().getMargin().setBottom(10);
loadOptions.getPageInfo().getMargin().setTop(20);
Document doc = new Document(new ByteArrayInputStream(html.getBytes()), loadOptions);
doc.save( path + "PDFNEWJAVA_34555.pdf");
Moreover, we will keep you updated about the original issue resolution progress.
Best Regards,
hi Tilal,
I tried the load options method, actually i have executed same code provided above and i got following error.
Exception in thread “main” class com.aspose.pdf.internal.p235.z9: At most 4 text fragments can be added in evaluation mode.
com.aspose.pdf.TextBuilder.m1(Unknown Source)
com.aspose.pdf.TextBuilder.appendText(Unknown Source)
com.aspose.pdf.z11.m1(Unknown Source)
com.aspose.foundation.rendering.z17.accept(Unknown Source)
com.aspose.foundation.rendering.z14.accept(Unknown Source)
com.aspose.foundation.rendering.z11.accept(Unknown Source)
com.aspose.foundation.rendering.z14.accept(Unknown Source)
com.aspose.foundation.rendering.z11.accept(Unknown Source)
com.aspose.foundation.rendering.z14.accept(Unknown Source)
com.aspose.foundation.rendering.z11.accept(Unknown Source)
com.aspose.foundation.rendering.z14.accept(Unknown Source)
com.aspose.foundation.rendering.z31.accept(Unknown Source)
com.aspose.pdf.z11.m1(Unknown Source)
com.aspose.pdf.ApsUsingConverter.m1(Unknown Source)
com.aspose.pdf.z72.m1(Unknown Source)
com.aspose.pdf.ADocument.m1(Unknown Source)
com.aspose.pdf.ADocument.(Unknown Source)
com.aspose.pdf.Document.(Unknown Source)
com.raj.aspose.pdfgeneration.dom.LoadOptionsPDF4mHTML.main(LoadOptionsPDF4mHTML.java:21)
at com.aspose.pdf.TextBuilder.m1(Unknown Source)
at com.aspose.pdf.TextBuilder.appendText(Unknown Source)
at com.aspose.pdf.z11.m1(Unknown Source)
at com.aspose.foundation.rendering.z17.accept(Unknown Source)
The Jar version which i have used is (aspose-pdf-9.7.0-jdk16). And i have executed the HtmlFragment option too, but got same error.
Exception in thread “main” class com.aspose.pdf.internal.p235.z9: The rectangle size can not be larger page size
Parameter name: rectangle
com.aspose.pdf.z9.(Unknown Source)
com.aspose.pdf.Page.m1(Unknown Source)
com.aspose.pdf.Page.m1(Unknown Source)
com.aspose.pdf.z137.m5(Unknown Source)
com.aspose.pdf.Page.m2(Unknown Source)
com.aspose.pdf.Page.m6(Unknown Source)
com.aspose.pdf.ADocument.m5(Unknown Source)
com.aspose.pdf.Document.m5(Unknown Source)
com.aspose.pdf.ADocument.saveInternal(Unknown Source)
com.aspose.pdf.Document.saveInternal(Unknown Source)
com.aspose.pdf.ADocument.save(Unknown Source)
com.aspose.pdf.Document.save(Unknown Source)
com.raj.aspose.pdfgeneration.dom.GeneratePDF4mHTMLDOM.main(GeneratePDF4mHTMLDOM.java:53)
at com.aspose.pdf.z9.(Unknown Source)
at com.aspose.pdf.Page.m1(Unknown Source)
at com.aspose.pdf.Page.m1(Unknown Source)
at com.aspose.pdf.z137.m5(Unknown Source)
Please help me out, to make this program working.
Thanking You
Rajesh
rajeshadobelc:
I tried the load options method, actually i have executed same code provided above and i got following error.
Exception in thread "main" class com.aspose.pdf.internal.p235.z9: At most 4 text fragments can be added in evaluation mode.
com.aspose.pdf.TextBuilder.m1(Unknown Source)
com.aspose.pdf.TextBuilder.appendText(Unknown Source)
com.aspose.pdf.z11.m1(Unknown Source)
com.aspose.foundation.rendering.z17.accept(Unknown Source)
com.aspose.foundation.rendering.z14.accept(Unknown Source)
com.aspose.foundation.rendering.z11.accept(Unknown Source)
com.aspose.foundation.rendering.z14.accept(Unknown Source)
com.aspose.foundation.rendering.z11.accept(Unknown Source)
com.aspose.foundation.rendering.z14.accept(Unknown Source)
com.aspose.foundation.rendering.z11.accept(Unknown Source)
com.aspose.foundation.rendering.z14.accept(Unknown Source)
com.aspose.foundation.rendering.z31.accept(Unknown Source)
com.aspose.pdf.z11.m1(Unknown Source)
com.aspose.pdf.ApsUsingConverter.m1(Unknown Source)
com.aspose.pdf.z72.m1(Unknown Source)
com.aspose.pdf.ADocument.m1(Unknown Source)
com.aspose.pdf.ADocument.(Unknown Source)
com.aspose.pdf.Document.(Unknown Source)
com.raj.aspose.pdfgeneration.dom.LoadOptionsPDF4mHTML.main(LoadOptionsPDF4mHTML.java:21)
at com.aspose.pdf.TextBuilder.m1(Unknown Source)
at com.aspose.pdf.TextBuilder.appendText(Unknown Source)
at com.aspose.pdf.z11.m1(Unknown Source)
at com.aspose.foundation.rendering.z17.accept(Unknown Source)
rajeshadobelc:
The Jar version which i have used is (aspose-pdf-9.7.0-jdk16). And i have executed theHtmlFragment option too, but got same error.
Exception in thread "main" class com.aspose.pdf.internal.p235.z9: The rectangle size can not be larger page size
Parameter name: rectangle
com.aspose.pdf.z9.(Unknown Source)
com.aspose.pdf.Page.m1(Unknown Source)
com.aspose.pdf.Page.m1(Unknown Source)
com.aspose.pdf.z137.m5(Unknown Source)
com.aspose.pdf.Page.m2(Unknown Source)
com.aspose.pdf.Page.m6(Unknown Source)
com.aspose.pdf.ADocument.m5(Unknown Source)
com.aspose.pdf.Document.m5(Unknown Source)
com.aspose.pdf.ADocument.saveInternal(Unknown Source)
com.aspose.pdf.Document.saveInternal(Unknown Source)
com.aspose.pdf.ADocument.save(Unknown Source)
com.aspose.pdf.Document.save(Unknown Source)
com.raj.aspose.pdfgeneration.dom.GeneratePDF4mHTMLDOM.main(GeneratePDF4mHTMLDOM.java:53)
at com.aspose.pdf.z9.(Unknown Source)
at com.aspose.pdf.Page.m1(Unknown Source)
at com.aspose.pdf.Page.m1(Unknown Source)
at com.aspose.pdf.z137.m5(Unknown Source)
The issues you have found earlier (filed as PDFNEWJAVA-34555) have been fixed in Aspose.Pdf for Java 10.0.0.
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.
is it fixed too in .net flatform??
I have the same issue: <a href="v</a></p>
rollyhernando:
is it fixed too in .net flatform??
I have the same issue: <a href="v</a></p></div></BLOCKQUOTE>Hi Rolly,<div><br></div><div>The issue discussed in this thread has been resolved. However we can discuss the scenario in other forum thread, which you have mentioned above.</div>