Forum Replies Created
-
AuthorPosts
-
in reply to: Troubleshooting June 16, 2014 at 14:03#26934
I am using .tiff images for my PDF and they are not appearing when the letter is being generated.
There are no errors in the logs. When I use .png images, they work.
Any comments would be helpful.
in reply to: Javascript is not getting executed with PD4ML June 19, 2014 at 07:44#29546PD4ML does not support Javascript and we have no plans to support it. The topic with a tricky workaround is discussed by the link:
html-css-to-pdf-rendering-issues-f3/is-javascript-supported-t216.htmlAlternatively you may give a try to PD4ML Web wrapper to a PhantomJS HTML->PDF converter module. https://pd4ml.com/pd4ml_web.htm Its functionality is planned to be included to PD4ML v4 as an option.
in reply to: General questions / FAQ June 23, 2014 at 07:04#26935Hello Sir,
I my html , I am creating bubble symbols using bellow style.
.bubble-1 {min-width:18px; border-radius:100%;}for<i>tagBut in pdf ‘border-radius:100%‘ is not applicable and
<i>tag is also not there in PD4ML stylesCan you help me how to apply bubble(round symbols in pdf).
Thanks,
Sathish.Hin reply to: need servlet code for converting html string to pdf June 23, 2014 at 08:21#29038Hi,
I have been using the below sample code in my application. I have been using the demo jar.
PD4ML html = new PD4ML(); html.setPageSize(new java.awt.Dimension(450, 450)); html.setPageInsets(new java.awt.Insets(20, 50, 10, 10)); html.setHtmlWidth(750); html.enableImgSplit(false); response.setHeader("Content-Disposition", "attachment; filename=test.pdf"); URL base = new URL("file:D:/home.jsp"); html.render(url, baos);Is this feature available in PD4ML library or in PD4Ml library PRO? I have to give this info to my procurement team.
in reply to: General questions / FAQ June 23, 2014 at 08:25#26936Hi,
I have been using the below sample code in my application. I have been using the demo jar.
PD4ML html = new PD4ML(); html.setPageSize(new java.awt.Dimension(450, 450)); html.setPageInsets(new java.awt.Insets(20, 50, 10, 10)); html.setHtmlWidth(750); html.enableImgSplit(false); response.setHeader("Content-Disposition", "attachment; filename=test.pdf"); URL base = new URL("file:D:/home.jsp"); html.render(url, baos);Is this feature available in PD4ML library or in PD4Ml library PRO? I have to give this info to my procurement team.
in reply to: need servlet code for converting html string to pdf June 23, 2014 at 08:28#29039The code works with both Std and Pro versions.
The Pro version would also allow you to embed TTF fonts and to display with them non-Latin and special characters.
in reply to: Is demo jar PD4ML library or in PD4Ml library PRO? June 23, 2014 at 08:28#29548The code works with both Std and Pro versions.
The Pro version would also allow you to embed TTF fonts and to display with them non-Latin and special characters.
in reply to: TTF embedding June 23, 2014 at 08:40#27317By default PD4ML converts to PDF characters, belong to Latin-1 charset only using built-in Adobe fonts (Helvetica, Times New Roman and Courier New). In order to output national or special characters you would need to configure and utilize TTF embedding feature. See:
https://pd4ml.com/reference.htm#7.1
pd4ml-html-css-pdf-tips-tricks-f7/ttf-embedding-t42.html
https://pd4ml.com/cookbook/pd4ml_pdf_true_type_fonts.htmin reply to: Is <em> tag supported? June 23, 2014 at 09:14#29424tag is supported – it is just a synonym to in a PDF conversion context.
in reply to: General questions / FAQ June 24, 2014 at 13:01#26937Hi, I am pd4ml rookie here. So, please forgive me if I am asking a primeval question.
I am trying to integrate pd4ml with phantomjs to generate a pdf from html that contains javascript. So far, I was unable to generate for a simple html using the web module. I searched for examples but could not find anything to my satisfaction. I am posting my actual code here.
This is my java code(taken from the toc example provided in the downloads). The only change I made(as mentioned in https://pd4ml.com/pd4ml_web.htm) was to use the web.pd4ml package. I am using the same sample.html file that comes with the example.package main; import java.awt.Dimension; import java.awt.Insets; import java.io.File; import java.io.FileInputStream; import java.io.InputStream; import java.io.InputStreamReader; import org.zefer.pd4ml.PD4Constants; import org.zefer.pd4ml.PD4PageMark; import org.zefer.pd4ml.web.PD4ML; public class WebPageConverterWithPhantomJS { public static void main(String[] args) throws Exception { WebPageConverterWithPhantomJS converter = new WebPageConverterWithPhantomJS(); String htmlFileName = "C:\DEV\workspace\PD4MLExample\examples\toc\sample.html"; File pdfFile = new File("C:\DEV\workspace\PD4MLExample\examples\toc\sampleUsingPhantomJS.pdf"); converter.generatePDF(htmlFileName, pdfFile, PD4Constants.A4, args.length > 2 ? args[2] : null, args.length > 3 ? args[3] : null ); System.out.println("done."); } private void generatePDF(String inputHTMLFileName, File outputPDFFile, Dimension format, String fontsDir, String headerBody) throws Exception { java.io.FileOutputStream fos = new java.io.FileOutputStream(outputPDFFile); PD4ML pd4ml = new PD4ML("C:\DEV\workspace\PD4MLExample\public\tools\phantomjs.exe"); pd4ml.setPageInsets(new Insets(20, 10, 10, 10)); pd4ml.setHtmlWidth(950); pd4ml.setPageSize(pd4ml.changePageOrientation(format)); // landscape page orientation if ( fontsDir != null && fontsDir.length() > 0 ) { pd4ml.useTTF( fontsDir, true ); } if ( headerBody != null && headerBody.length() > 0 ) { PD4PageMark header = new PD4PageMark(); header.setAreaHeight( -1 ); // autocompute header.setHtmlTemplate( headerBody ); // autocompute pd4ml.setPageHeader( header ); } pd4ml.enableDebugInfo(); InputStream is = new FileInputStream(inputHTMLFileName); InputStreamReader isr = new InputStreamReader(is, "UTF-8"); pd4ml.render(isr, fos); //pd4ml.render("file:" + inputHTMLFileName, fos); } }This is the change I made in the html . Included bootstrap css, font-awesome css, jquery and bootstrap js files.
<META http-equiv=Content-Type content="text/html; charset=UTF-8"> .. <LINK href="i/W3C-REC.css" type=text/css rel=stylesheet> <LINK href="i/default.css" type=text/css rel=STYLESHEET> <link rel="stylesheet" type="text/css" href="public/stylesheets/bootstrap-2.3.css"/> <link rel="stylesheet" type="text/css" href="public/stylesheets/font-awesome.css" /> . . <script type="text/javascript" src="public/javascripts/jquery-1.7.2.min.js"></script> <script type="text/javascript" src="public/javascripts/bootstrap-2.1.min.js"></script> . . </HEAD> <BODY> <script type="text/javascript"> $(document).ready(function(){ $(".thisred").addClass("red"); //testing only. }); </script> ... </BODY>When I execute this code, it throws the error
090b2 Pro (eval) ReferenceError: Can't find variable: $ c:%5CUsers%5CUKALIVI%5CAppData%5CLocal%5CTemp%5Cpd4ml1002373815533658363.htm:29 Exception in thread "main" java.lang.NoSuchMethodError: org.zefer.pd4ml.pdf.parser.h.o00000(Ljava/io/InputStream;)[B at org.zefer.pd4ml.web.PD4ML.Ò00000(Unknown Source) at org.zefer.pd4ml.web.PD4ML.render(Unknown Source) at main.WebPageConverterWithPhantomJS.generatePDF(WebPageConverterWithPhantomJS.java:50) at main.WebPageConverterWithPhantomJS.main(WebPageConverterWithPhantomJS.java:23)
If I change the instantiation of pd4ml to :
PD4ML pd4ml = new PD4ML("C:\DEV\workspace\PD4MLExample\public\tools\phantomjs.exe");I don’t get the error and the console shows done. But the pdf generated is not useful, the pd4ml tags were not recognized I think.
090b2 Pro (eval) ReferenceError: Can't find variable: $ c:%5CUsers%5CUKALIVI%5CAppData%5CLocal%5CTemp%5Cpd4ml2710392443226086703.htm:29 done.
Could you please let me know what I am missing here. Also, could you please provide some examples for integration with phantomjs.
in reply to: .TIFF images not appearing in PDF June 26, 2014 at 13:16#29547By default PD4ML supports only Fax-specific TIFF image sub-formats. Obviously in your case the TIFF format is not among the supported.
A workaround would be to define a so-called custom resource loader and let it re-format a TIFFs to anything compatible.
See:
https://pd4ml.com/cookbook/custom_rc_loaders.htm
and an attachment.in reply to: "Print Ready" PDFs? June 26, 2014 at 13:22#29544Right now there is no way to generate PDFs with CMYK colorspace.
You could request the feature implementation on an (affordable) paid basis.
in reply to: how to add css files in jsp which is transformed to pdf ?? June 26, 2014 at 17:52#29504Just released v390 addresses the issue. Do not forget to copy an updated ss_css2.jar from the distribution package to your application resources.
in reply to: css @media parsing June 26, 2014 at 19:09in reply to: Custom Fonts July 18, 2014 at 08:50#27412on Win8.1 in cmd:
I:xampphtdocspd4mlprobe>java -Xmx512m -Djava.awt.headless=true -cp I:xampphtdocspd4mlpd4ml_demo.jar Pd4Cmd "file:123.html" -ttf I:xampphtdocspd4mlfonts 800 A4 -debug -out pd4ml.pdf version: PD4ML 385fx6 Pro (eval) not yet in cache: file:I:xampphtdocspd4mlfonts/pd4fonts.properties 'times' is not in pd4fonts.properties file reject TTF lookup for: 'times' not yet in cache: file:I:xampphtdocspd4mlfonts/times.ttf read 'times new roman' from file:I:xampphtdocspd4mlfonts/times.ttf 'times bold' is not in pd4fonts.properties file reject TTF lookup for: 'times bold' not yet in cache: file:I:xampphtdocspd4mlfonts/timesbd.ttf read 'times new roman bold' from file:I:xampphtdocspd4mlfonts/timesbd.ttf ...
I:xampphtdocspd4mlfonts/pd4fonts.properties
or
I:xampphtdocspd4mlfonts/times.ttf
is the right path in windows system? -
AuthorPosts
