Forum Replies Created
-
AuthorPosts
-
in reply to: Convert html source to pdf March 26, 2014 at 19:36#29519
Make sure you use PD4ML Pro. PD4ML Std does not support TTF embedding/national scripts.
in reply to: HTML/CSS rendering issues March 27, 2014 at 05:44#26914I have an html file that our app converts to pdf using pd4ml .NET library. The html code contains several html entities like Spanish accent chars like ñ and chars like ¿ Those chars don’t come correct in PDF. Please advise.
in reply to: General questions / FAQ March 27, 2014 at 08:48#26915My version: version: PD4ML 385fx4 Pro (eval)
my code (based on examples):
<br /> test(){<br /> String htmlDocument = "";<br /> PD4ML pd4ml = new PD4ML();<br /> pd4ml.enableDebugInfo();<br /> pd4ml.setPageSize(pd4ml.changePageOrientation(PD4Constants.A4));<br /> pd4ml.setPageInsets(new Insets(20, 20, 20, 20));<br /> pd4ml.setHtmlWidth(1200);<br /> pd4ml.disableHyperlinks();<br /> pd4ml.useTTF("java:fonts", true);<br /> pd4ml.setDefaultTTFs("Times New Roman", "Arial", "Courier New");<br /> ByteArrayOutputStream baos = new ByteArrayOutputStream();<br /> pd4ml.render(new StringReader(htmlDocument), baos);<br /> baos.close();<br /> }
After this code done I have 1 new file in my …/temp directory. Function pd4ml.render(…) create it, but not delete. Also I can’t delete it while JVM running.
But if I don’t use pd4ml.useTTF(…) temporary file didn’t appear.
How can I clear this file from code?
in reply to: tag ‘span’ and "class" attribute March 28, 2014 at 09:13#29471@PD4ML wrote:
Can you publish a minimalistic example, which illustrates the issue?
Yes, i did it.
This is source page:
<br /> <!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head><title>Title</title><meta content="Apache Tapestry Framework (version 5.3.7)" name="generator"/><meta content="text/html; charset=utf-8" http-equiv="content-type"/><link type="text/css" rel="stylesheet" href="/assets/1.0-SNAPSHOT/core/default.css"/><link type="text/css" rel="stylesheet" href="/assets/1.0-SNAPSHOT/jquery/themes/ui-lightness/jquery-ui-1.8.19.custom.css"/><style><br /> label,<br /> input,<br /> button,<br /> select,<br /> textarea {<br /> font-size: 14px;<br /> font-weight: normal;<br /> line-height: 20px;<br /> }<br /> label {<br /> display: block;<br /> margin-bottom: 5px;<br /> }<br /> .label,<br /> .badge {<br /> display: inline-block;<br /> padding: 2px 4px;<br /> font-size: 11.844px;<br /> font-weight: bold;<br /> line-height: 14px;<br /> color: #ffffff;<br /> text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);<br /> white-space: normal;<br /> vertical-align: baseline;<br /> background-color: #999999;<br /> }<br /> .label:empty,<br /> .badge:empty {<br /> display: none;<br /> }<br /> .label {<br /> -webkit-border-radius: 3px;<br /> -moz-border-radius: 3px;<br /> border-radius: 3px;<br /> }<br /> .label-success,<br /> .badge-success {<br /> background-color: #468847;<br /> }<br /> .label-success[href],<br /> .badge-success[href] {<br /> background-color: #356635;<br /> }<br /> .btn .label,<br /> .btn .badge {<br /> position: relative;<br /> top: -1px;<br /> }<br /> .btn-mini .label,<br /> .btn-mini .badge {<br /> top: 0;<br /> }<br /> </style></head><body><span class="label label-success">Some text</span></body></html>
“Some text” isn’t printed into final pdf/rtfBUT if I replace
a bit:
<body>Some text<span class="label label-success">Some text</span></body>
I can see BOTH “Some text” strings into pdf/rtf
in reply to: tag ‘span’ and "class" attribute March 28, 2014 at 13:27#29472Same problem with tables:
<body><br /> <table><br /> <tr><br /> <td><span class="label label-success">Some text1</span><br /> </td><br /> <td><br /> ups<br /> <span class="label label-success">Some text2</span><br /> </td><br /> </tr><br /> </table><br /> </body>
I can see only “Some text2” in PDF/RTF.
in reply to: Troubleshooting March 31, 2014 at 12:45#26916I tryed to download CSS parser from page http://pd4ml.com/reference.htm
(link (http://pd4ml.com/cssparser-0.9.4.patched.2007.zip))but have follow:
Error
No such file: /cssparser-0.9.4.patched.2007.zipin reply to: No such file: /cssparser-0.9.4.patched.2007.zip March 31, 2014 at 13:47#29523The broken link is fixed now
in reply to: General questions / FAQ April 7, 2014 at 19:48#26917Hi, I have a requirement to add footers to specific pages which are determined based on the total number of pages in the PDF. Is this something that we can achieve?
in reply to: General questions / FAQ April 15, 2014 at 17:23#26918We have a tomcat/liferay based solution that utilizes the pd4ml library. We stumbled across an issue recently where upon initial load of a web page, the content will resize to fit relative to the other components on a webpage. This occurs in less than one second, and is often not noticeable to most users.
The problem we are facing is that pd4ml appears to render the original html content, and we had hoped there would be a way to delay the rendering and html capturing process (perhaps a second or so) so that the content is correctly positioned on the web page before the rendering is executed.
Please let me know if this is something we can accomplish as we are approaching a deadline to implement this feature in our product.
thank you
in reply to: Resizing content on web page results in extra white space April 15, 2014 at 17:36#29525I am not sure, if I understand you correctly.
PD4ML implements its own HTML/CSS rendering engine. The engine starts page layouting only after all resources (images, stylesheets etc) are completely loaded. So it is not possible, that page layout changes itself in 1-2 seconds.
So I am afraid, if a PDF conversion result does not match its original HTML page layout, there are probably other reasons (failed CSS parsing, unsupported HTML tags etc). An HTML/CSS samples would help to analyze the problem reason.
The above is relevant for the original PD4ML library. There is also PD4ML Web (based on WebKit native HTML renderer) – the version may suffer from network/rendering asynchrony or delays.
in reply to: Resizing content on web page results in extra white space April 15, 2014 at 18:26#29526Thanks for the quick reply. Based on your response, we are going to test a scenario where we are intentionally delaying the page layouting by asking for an image after the page is fully loaded. This image will be a dummy image, and we’ll give it a 5-10 second timeout, upon which the page should definitely be ready to be rendered. We could put together a servlet to test this with.
We will let you know the result. Thanks again for your promptness.
in reply to: Resizing content on web page results in extra white space April 17, 2014 at 19:01#29527Thanks again for your help, we were able to resolve our issue via CSS. The servlet test was not needed.
in reply to: Troubleshooting April 18, 2014 at 10:28#26919Hi,
I am using pd4ml 350 pro version, I am performing some trials to verify if pd4ml can embed a GDT font and display correct symbols inside pdf.
I followed steps mentioned in section “7.1 TTF embedding” to configure fonts directory.I am trying to convert following html to PDf with Ascii and Unicode character for one of the GDT symbol,
ASCII : é Unicode : é part of sample java code I wrote to test is as follows,
String strFilePath = “D:/tempGDt.pdf”;
File output = new File(strFilePath);
java.io.FileOutputStream fos = new java.io.FileOutputStream(output);
StringBuffer sbTemp = new StringBuffer(““); PD4ML html = new PD4ML();
html.enableDebugInfo();
html.setHtmlWidth( 870 );
html.setPageSize(PD4Constants.A4);
html.setPageSize( new java.awt.Dimension(842, 595) );
html.setPageInsets( new java.awt.Insets(30, 30, 30, 30) );
html.enableImgSplit(true);
html.interpolateImages(false);
html.useAdobeFontMetrics(true);
html.useTTF( “D:/fonts”, true );StringReader sr = new StringReader(sbTemp.toString());
html.render(sr, fos);
fos.close();When above code is executed, a PDF file is generated with blank pages. Following is the debug log,
version: PD4ML 350 Pro
not yet in cache: file:D:/fonts/pd4fonts.properties
new parse attempt with: UTF8
not yet in cache: file:D:/fonts/arial.ttf
read ‘arial’ from file:D:/fonts/arial.ttf
not yet in cache: file:D:/fonts/gdtex.ttf
read ‘gdtex’ from file:D:/fonts/gdtex.ttf
done in 278ms.Please let me know if I am missing anything.
in reply to: HTML/CSS rendering issues April 21, 2014 at 05:13#26920Hi,
I am using pd4ml 350 pro version, I am performing some trials to verify if pd4ml can embed a GDT font and display correct symbols inside pdf.
I followed steps mentioned in section “7.1 TTF embedding” to configure fonts directory.I am trying to convert following html to PDf with Ascii and Unicode character values for one of the GDT symbol,
ASCII : é Unicode : é part of sample java code I wrote to test is as follows,
String strFilePath = “D:/tempGDt.pdf”;
File output = new File(strFilePath);
java.io.FileOutputStream fos = new java.io.FileOutputStream(output);
StringBuffer sbTemp = new StringBuffer(““); PD4ML html = new PD4ML();
html.enableDebugInfo();
html.setHtmlWidth( 870 );
html.setPageSize(PD4Constants.A4);
html.setPageSize( new java.awt.Dimension(842, 595) );
html.setPageInsets( new java.awt.Insets(30, 30, 30, 30) );
html.enableImgSplit(true);
html.interpolateImages(false);
html.useAdobeFontMetrics(true);
html.useTTF( “D:/fonts”, true );StringReader sr = new StringReader(sbTemp.toString());
html.render(sr, fos);
fos.close();When above code is executed, a PDF file is generated with blank pages. Following is the debug log,
version: PD4ML 350 Pro
not yet in cache: file:D:/fonts/pd4fonts.properties
new parse attempt with: UTF8
not yet in cache: file:D:/fonts/arial.ttf
read ‘arial’ from file:D:/fonts/arial.ttf
not yet in cache: file:D:/fonts/gdtex.ttf
read ‘gdtex’ from file:D:/fonts/gdtex.ttf
done in 278ms.Can anyone please answer whats going wrong, or if I am missing anything.
I have tried same stuff with latest released pro trial, it also outputs a blank pdf without any hint in debug log as whats going wrong.in reply to: Dynamic scope for footers April 23, 2014 at 13:25#29524PD4ML allows to define page-specific headers/footers (scope attribute of ):
– based on a page number,
– depending if a page even or odd,
– and allows to suppress header/footer for the last page.It is not possible to define a scope like “$[total]-3” etc.
On the other hand it is possible to define content-flow specific headers/footers.
For example:
[language=xml:27v58xlo]…
HTML content
…New page footer, impacts pages follow the next page break. $[page] of $[total]
New page with the new page footer, defined above
…
HTML content
…[/language:27v58xlo] -
AuthorPosts