Forum Replies Created
-
AuthorPosts
-
in reply to: Additional wrong page breaks April 23, 2012 at 19:00#28980
Most probably the issue is caused by enableSmartTableBreak() mode clashes with CSS page break control code in your document. Try to disable smart table breaks – does it change anything?
FYI: enableSmartTableBreak(true) applies
TR, TABLE { page-break-inside: avoid }
In the mode it implicitly inserts a page break before a table, if it helps to keep the table not broken. It looks like that happens in your case. By default the first page has a bit smaller content area height than the second one, as the first page respects top margin of
tag.in reply to: Anybody had problems with PD4ML on Lion for Mac? April 24, 2012 at 05:46#28947The JDK works fine, I use it for Tomcat, Spring and work with it as usual. It’s also been updated automatically a couple of times since I got Lion.
in reply to: Spanish charset printing problem April 24, 2012 at 06:40#28977Hi,
Thanks for your help.
I tried this , but it is not working for some reason
here is my code
java.io.FileOutputStream fos = new java.io.FileOutputStream(outputPDFFile);
PD4ML pd4ml = new PD4ML();
pd4ml.setPageInsets(new Insets(0, 0, 0, 0));
pd4ml.setHtmlWidth(950);
pd4ml.setPageSize(pd4ml.changePageOrientation(format)); // landscape page orientation
pd4ml.setPageSize(format); // portrait page orientation
pd4ml.useTTF(“java:fonts”, true);
pd4ml.setDefaultTTFs(“Times New Roman”, “Arial”, “Courier New”);
if ( headerBody != null && headerBody.length() > 0 ) {
PD4PageMark header = new PD4PageMark();
header.setAreaHeight( -1 ); // autocompute
header.setHtmlTemplate( headerBody ); // autocompute
pd4ml.setPageHeader( header );
}
pd4ml.enableDebugInfo();
pd4ml.render(“file:” + inputHTMLFileName, fos);
if(fos!=null){
outputPDFFile = null;
fos.close();
}Please suggest me any other solution.
Thanksin reply to: Spanish charset printing problem April 24, 2012 at 15:53#28978pd4ml.enableDebugInfo(); forces PD4ML to print some diagnostics. Could you please check what is printed to the STDOUT (or to server’s log if it is a web application)?
in reply to: Additional wrong page breaks April 25, 2012 at 06:43#28981Looks like enableSmartTableBreak(false) solved the problem! Many thanks!!!
in reply to: pdf is blank April 25, 2012 at 10:43#28943hi,
thanks for the reply I am using the following php code below
$var = “java_path -Xmx512m -Djava.awt.headless=true -cp jar_path Pd4Cmd html_path 800 A4”;
passthru($var);
the pdf is created but when we try to open it, there is no content just a blank/white space.
this happen when we try to generate a pdf from the html in our domain where the pd4ml files is also hosted, but if I try to change the html using from other domain it works.
in reply to: Troubleshooting April 26, 2012 at 03:59#26715Hi all
I have developed a code to convert html files to pdf using pd4ml api. Its working fine in windows environment. But when I deployed the war in linux it got stucked in render method and after that there is no response. Please anybody help me in this. Sharing my code snippet.
PD4ML pd4ml = new PD4ML();
try {
pd4ml.setPageSize( landscapeValue ? pd4ml.changePageOrientation( format ): format );
} catch (Exception e)
{
e.printStackTrace();
}
if ( unitsValue.equals(“mm”) ) {
pd4ml.setPageInsetsMM( new Insets(topValue, leftValue,bottomValue, rightValue) );
} else {
pd4ml.setPageInsets( new Insets(topValue, leftValue,bottomValue, rightValue) );
}
pd4ml.setHtmlWidth( userSpaceWidth );
pd4ml.render(new URL(urlstring), fos);
}catch (Exception e) {
e.printStackTrace();
}Thanks in advance.
in reply to: Spanish charset printing problem April 26, 2012 at 09:32#28979This is the output on STDOUT:-
version: PD4ML 351b8
new parse attempt with: UTF8
image not yet in cache: file:F:/Tomcat_DIR/jakarta-tomcat-5.0.19/webapps/ewpmc/temp/invoicehtml/images/ca_state_logo.png
not yet in cache: file:F:/Tomcat_DIR/jakarta-tomcat-5.0.19/webapps/ewpmc/temp/invoicehtml/images/ca_state_logo.png
image size: 70777
can not embed file:F:/Tomcat_DIR/jakarta-tomcat-5.0.19/webapps/ewpmc/temp/invoicehtml/images/ca_state_logo.png. Not embeddable color type. Reformatting image…
image not yet in cache: file:F:/Tomcat_DIR/jakarta-tomcat-5.0.19/webapps/ewpmc/temp/invoicehtml/images/sign.png
not yet in cache: file:F:/Tomcat_DIR/jakarta-tomcat-5.0.19/webapps/ewpmc/temp/invoicehtml/images/sign.png
image size: 264
can not embed file:F:/Tomcat_DIR/jakarta-tomcat-5.0.19/webapps/ewpmc/temp/invoicehtml/images/sign.png. Not embeddable color type. Reformatting image…
image not yet in cache: file:F:/Tomcat_DIR/jakarta-tomcat-5.0.19/webapps/ewpmc/temp/invoicehtml/images/Julie_signature.gif
not yet in cache: file:F:/Tomcat_DIR/jakarta-tomcat-5.0.19/webapps/ewpmc/temp/invoicehtml/images/Julie_signature.gif
image size: 2770
image not yet in cache: file:F:/Tomcat_DIR/jakarta-tomcat-5.0.19/webapps/ewpmc/temp/invoicehtml/images/Entertainment.png
not yet in cache: file:F:/Tomcat_DIR/jakarta-tomcat-5.0.19/webapps/ewpmc/temp/invoicehtml/images/Entertainment.png
image size: 1104
PNG marker: sRGB
PNG marker: gAMA
PNG marker: cHRM
can not embed file:F:/Tomcat_DIR/jakarta-tomcat-5.0.19/webapps/ewpmc/temp/invoicehtml/images/Entertainment.png. PNG should not have more than 256 colors. Reformatting image…
image not yet in cache: java:/resources/icons/spacer.gif
not yet in cache: java:/resources/icons/spacer.gif
image size: 48
done in 2126ms.
PDF generation done.
pdfFile1: F:Tomcat_DIRjakarta-tomcat-5.0.19webappsewpmctempinvoicepdfGC-áá-329703-04112012.pdf
version: PD4ML 351b8
new parse attempt with: UTF8
done in 340ms.in reply to: Anybody had problems with PD4ML on Lion for Mac? April 27, 2012 at 15:21#28944Please help, someone.
Presumably something is simply missing, but there are no log messages at all to give an idea. Probably the Lion idea is a red herring.
I did a complete reinstall of Snow Leopard a couple of weeks before updating to Lion and it may have happened then.Here’s a very simple test below. The code is correct, of that I’m certain.
The debug just prints out “version: PD4ML 380 Pro” and then it all hangs….All the correct .jars are on the classpath- I currently have:
pd4ml-3.8.0.jar
pd4mlDefaultFonts-1.0.jar
ss_css2.jar
pd4ml_tl.jarAny help would be very gratefully received.
<%@page import="org.zefer.pd4ml.PD4Constants"<br /> %><%@ taglib uri="http://pd4ml.com/tlds/pd4ml/2.6" prefix="pd4ml"<br /> %><%@page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%><pd4ml:transform<br /> pageFormat="A4"<br /> pageOrientation="portrait"<br /> screenWidth="700"<br /> pageInsets="10,50,20,50,points"<br /> debug="true"><br /> <html><br /> <head><br /> <br /> </head><br /> <body><br /> <br /> hello<br /> </body><br /> </html><br /> </pd4ml:transform>
in reply to: Anybody had problems with PD4ML on Lion for Mac? April 27, 2012 at 15:38#28948The JSP sample is very basic and as I see is absolutely correct. The library set is also complete. So obviously something is wrong with the environment.
If you are absolutely sure there is no error messages and stack traces in both server STDOUT and STDERR logs, please try to run an offline test:
java -Xmx512m -jar pd4ml.jar
It should run PD4ML in GUI mode. Try to open an HTML and to convert it to PDF. Does it work?
in reply to: Anybody had problems with PD4ML on Lion for Mac? April 30, 2012 at 08:54#28949Thanks for your help.
I’ve been trying to run the command-line pd4ml class but whatever I do I get:
java.io.IOException: Cannot run program “/Applications/Preview.app”: error=13, Permission deniedI’ve created a folder with completely open permissions to everyone, and I run the pd4ml class from there.
I also changed the permissions for the Mac preview app so that it has permissions to be run by any user.The pd4ml class will open and show my simple html file when I press GO.
But will not create a .pdf when I press PDF – for the reason shown above.in reply to: Anybody had problems with PD4ML on Lion for Mac? April 30, 2012 at 09:05#28950P.S. There have never been any messages at all in my Tomcat stdout and stderr logs. Complete silence. And any calls to pd4ml just hang forever, without timeout.
My Lion update was quick and practically painless, which was perhaps too good to be true. I’ve had no problems at all with any other programmes.
Presumably something is missing, however. PD4ML doesn’t depend on any system graphics does it?
in reply to: Troubleshooting April 30, 2012 at 09:36#26716Dear supporter,
I’ve a question about including fonts directory when i run java class which is not in class path.
When i run java class using console mode it works fine with including fonts folder.
java -Xmx512m -cp pd4ml.jar;. Converter “$(tempDir)/$(ModuleName).html” “$(tempDir)/$(ModuleName).pdf” “file:fonts”
By the way i need to run this class the other directory.
At this time i struggling to include fonts folder which i located under the pd4ml.jar class path as follows but failed._pdf.useTTF(“file:../../../../../jar/PD4ML/fonts”, true);
_pdf.useTTF(“file:fonts”,true);
_pdf.useTTF(“java:fonts”,true);Finally i tried to run copy font folders to this run directory and found out it works with _pdf.useTTF(“file:fonts”,true);
My question is
Is there any way to set fonts folder without copying those stuff?Kind regards,
Gabriel.in reply to: Troubleshooting April 30, 2012 at 12:17#26717I would need again your help. Please find attached an example of a PDF file that breaks to a second page although it looks like everything could be placed on one page.
In the example.zip file you can find the header, footer and body HTML code.
Would be great if you could give me a hint what is causing the page break.
Thank you very much in advance,
Michaelin reply to: Anybody had problems with PD4ML on Lion for Mac? April 30, 2012 at 12:22#28951> The pd4ml class will open and show my simple html file when I press GO.
It is a good sign. It means PD4ML works and renders HTML (in the case not to PDF, but to Image output device). I guess it also produces PDF to a TMP directory, but it cannot start a viewer application for some reason.
The problem with Tomcat still has no good explanation. I would recommend to try to configure a progress monitor:
http://pd4ml.com/cookbook/html_pdf_conversion_progress_monitoring.htmIt should help us to determine at which conversion phase it fails.
-
AuthorPosts