Forum Replies Created
-
AuthorPosts
-
in reply to: Any way to load image in parallel? June 26, 2013 at 13:18#29356
No. PD4ML runs single thread to be compliant with J2EE requirements.
If you convert HTMLs come from a single source, probably an image pre-fetch to PD4ML internal cache could help.
in reply to: Any way to load image in parallel? June 27, 2013 at 04:23in reply to: Troubleshooting June 28, 2013 at 15:18#26857hi,
It seems that pd4ml will interpret value of border-bottom-width less than 0.38pt as “0”, please check, thanks.version:pd4ml.pro.trial.385b8
in reply to: small fractional widths are interpreted as "0" June 29, 2013 at 12:52#29367FYI, when i use the following code:
pd4ml.setPageSize(PD4Constants.A4);<br /> pd4ml.setHtmlWidth(798);<br /> pd4ml.setPageInsets(new Insets(0, 0, 0,0));<br /> pd4ml.useTTF("c:/Test/testlib", true);
I cannot see border-bottom-width less than 0.38pt in the generated pdf file.
using the following code:
pd4ml.setPageSize(PD4Constants.A4);<br /> pd4ml.protectPhysicalUnitDimensions();<br /> pd4ml.setPageInsets(new Insets(0, 0, 0,0));<br /> pd4ml.useTTF("c:/Test/testlib", true);
I cannot see border-bottom-width less than 0.5pt in the generated pdf file.version:pd4ml.pro.trial.385b8
in reply to: small fractional widths are interpreted as "0" July 1, 2013 at 02:26#29368or could you give some suggestion if i want to output a border that width is 0.25pt?
in reply to: Is JavaScript supported? July 1, 2013 at 23:44#27950Is this still true? No javascript support?
in reply to: Is JavaScript supported? July 2, 2013 at 10:29#27951We do not plan to natively support JavaScript in PD4ML. Originally PD4ML is not intended for web sites capture; it is to allow you to define PDF layouts with simple well-known languages – HTML/CSS.
In PD4ML use cases JavaScript could be only used to generate some portions of HTML content, as the most of JavaScript “power” (interactivity, animation etc) is not applicable or direct convertible to its target PDF format.
As a drawback JavaScript support would turn PD4ML into a bulky construct (adding JavaScript runtime, DOM structures) and requires quite a serious refactoring of the existing code.
There is a tricky workaround JavaScript-enabled pages. It work only in web scenarios to implement “convert to PDF” button for current page. After JavaScript is evaluated in a web browser and the layout is rendered, the actual dynamic HTML can be captured from the browser and passed to PD4ML.
I’ve attached a draft, which illustrates it. The form “action” attribute should point to a Java servlet, which takes “source” parameter value (HTML code) and converts it to PDF.
in reply to: small fractional widths are interpreted as "0" July 2, 2013 at 13:57#29369We’ve just fixed the problem in the development build. The fix will be available with the forthcoming (beta) release in 1-2 weeks.
in reply to: Any way to load image in parallel? July 2, 2013 at 14:02#29358The simplest way would be to generate an HTML index of the images:
[language=xml:idlam7vh]
…[/language:idlam7vh]and let PD4ML to convert it to PDF once.
in reply to: images cache and evaluation copy sentence July 8, 2013 at 13:56#27490I tried the above steps but got no output.Can you please guide me any alternative way for the same.Thanks in advance.
in reply to: HTML/CSS rendering issues July 10, 2013 at 09:27#26858Hi all,
I am trying to generate RTF files from templates, and most of the html elements are successfully translated.
However, I have a problem with fonts.
In particular, I was not able to convert Arial fonts in HTML to Arial fonts in RTF.
I have a production server on Unix, and I have a testing server on Mac and I was not successful on any.My local testing code that also fails is as follows:
<br /> public static void test()<br /> {<br /> PD4ML pd4ml = new PD4ML();<br /> pd4ml.outputFormat(PD4ML.RTF);<br /> String preparsedTemplate = "<html> <head> <title>HTML Online Editor Sample</title> </head> <body> <h1> <span style="color:#00ff00;font-family:'Arial'"><span style="background-color: rgb(255, 0, 0);">Hello world !</span></span></h1><br /> <font face="Arial" color="green">This is some text!</font><br /> </body></html>";<br /> <br /> try {<br /> pd4ml.useTTF( "java:fonts", true );<br /> } catch (FileNotFoundException e2) {<br /> e2.printStackTrace();<br /> }<br /> pd4ml.setDefaultTTFs("Times New Roman", "Arial", "Courier New");<br /> pd4ml.enableDebugInfo();<br /> <br /> FileOutputStream f;<br /> try {<br /> f = new FileOutputStream("/Users/zprotic/Desktop/Documents/test.rtf");<br /> pd4ml.render(new StringReader(preparsedTemplate), f);<br /> } catch (Exception e) {<br /> e.printStackTrace();<br /> }<br /> }<br />
I have a fonts.jar file in my classpath, with the mentioned fonts.
The debug info is as follows:
<br /> not yet in cache: java:fonts/pd4fonts.properties<br /> not yet in cache: java:fonts/arialbd.ttf<br /> read 'arial bold' from java:fonts/arialbd.ttf<br /> not yet in cache: java:fonts/arial.ttf<br /> read 'arial' from java:fonts/arial.ttf<br />
The generated header font (on Mac) is Geneva, and the generated body font is unknown (empty on Word 2011 for Mac).
Attached is the generated RTF file.Can anyone help with this issue ?
EDIT: After pointed out by colleagues, I have found out that in OpenOffice, the resulting font is ArialMT or Arial-BoldMT for the header.
in reply to: Arial font in RTF July 10, 2013 at 14:10#29370By RTF generation, in fact, PD4ML does not embed TTF fonts to the resulting document (I am even not sure if RTF file format supports that), but writes a font family reference to let RTF viewer resolve it.
As I see in the RTF src, it refers to Win32-specific fonts, which is obviously not correct:
[language=java:288zz1ss]{f1 Arial-BoldMT;}{f2 ArialMT;}[/language:288zz1ss]Try to disable TTF Embedding by RTF generation (exclude pd4ml.useTTF() call). Does it change anything?
in reply to: Arial font in RTF July 10, 2013 at 14:36#29371I commented out the useTTF call, and I switched to my purchased version of pd4ml ( I tried the example with latest demo version since I had older pro version, and wanted to check if the latest demo version has fixed the problem).
The solution does not work in Word on MAC- instead of Arial now there is Geneva font everywhere (but in OpenOffice I can see the Arial instead of the ArialMT fonts).in reply to: General questions / FAQ July 11, 2013 at 17:52#26743For our RTF file generation, We added a footer, which includes a image(logo), the footer is displayed, however the image is missing … Please advice.
Note: Same code generates the image in PDF file, but the image is missing in RTF
Following is the snippet of the code
private PD4PageMark buildFooter(String docHyperlink) {
try {
…PD4PageMark footer = new PD4PageMark();
footer.setHtmlTemplate(
“” +
“”
+ ”” +
“”
+ “Some txt ““);
return footer;
} catch (Exception e) {
log.error(e.getMessage(),e);
log.error(“Error in building the footer.”);
throw new IllegalStateException(e);
}
}…
pd4ml.setPageFooter(buildFooter(itemUrl));
…
in reply to: initialPageNumber July 15, 2013 at 19:37#28400There is a way to define initial page number within HTML?
Something similar to:
page $[page] of $[total]I know that there is a way to pass it from JAVA API:
PD4PageMark footer = new PD4PageMark();
footer.setInitialPageNumber(0);
footer.setHtmlTemplate(“page $[page] of $[total]“);
Which doesn’t completely satisfy our needs.
-
AuthorPosts