Forum Replies Created
-
AuthorPosts
-
in reply to: HTML is being printed backwards June 14, 2012 at 20:18#29020
From the HTML sample you sent I got correct result. See attached.
(I only changed content=”charset=UTF-8″ to content=”text/html; charset=UTF-8″)
If it does not work for you, try to add dir=”rtl” or dir=”ltr” attribute to tag. It is something wrong on you side with initial conditions for Arabic ligaturizing – probably there are CSS styles impact it.
in reply to: Deployment / Configuration issues June 15, 2012 at 05:53#26741Hi,
I have a problem exporting the jpg base64 image to PDF. I turn on the debug mode in the pd4ml tag and I am getting the following error message:
version: PD4ML 380 Pro
Bad Base64 input character at 76: 37(decimal)
resource data:image/jpg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAPlease help.
in reply to: Anybody had problems with PD4ML on Lion for Mac? June 15, 2012 at 06:30#28965Ok, thankyou.
Clearly we’re a bit worried about this so please keep us posted. Thanks.in reply to: General questions / FAQ June 15, 2012 at 07:09#26742hello,
can you please provide me the servlet code in which i can convert html string url to pdf.it will save my lot of time.
Prashant
in reply to: Rendering JPG base64 JSP image problem June 15, 2012 at 13:23#29031Most probably the problem is caused by an erroneous appending of a session ID to the base64 image source.
The issue has been already solved in the actual development build. the update will be available with the forthcoming beta release next week.
in reply to: need servlet code for converting html string to pdf June 15, 2012 at 15:05#29032[language=java:2bbaexst]import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.net.URL;import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;import org.zefer.pd4ml.PD4Constants;
import org.zefer.pd4ml.PD4ML;public class PD4MLServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
URL url = new URL(“http://pd4ml.com”);
PD4ML html = new PD4ML();
html.setPageSize( PD4Constants.A4 );
html.setPageInsets( new java.awt.Insets(20, 50, 10, 10) );
html.setHtmlWidth( 850 );ByteArrayOutputStream baos = new ByteArrayOutputStream();
html.render( url, baos );byte[] result = baos.toByteArray();
response.setContentType(“application/pdf”);
response.setHeader(“Content-disposition”,”inline; filename=test.pdf”);
response.setHeader(“Pragma”, “cache”);
response.setHeader(“Expires”, “0”);
response.setHeader(“Cache-control”, “private”);response.setContentLength(result.length);
ServletOutputStream sos = response.getOutputStream();
sos.write( result );
}
}[/language:2bbaexst]in reply to: Anybody had problems with PD4ML on Lion for Mac? June 15, 2012 at 15:17#28966In the meantime we tried a variety of environments. Here is my current state:
[language=xml:1c85moiu]igors-imac:bin igor$ sudo ./daemon.sh version
Password:
Still running according to PID file /Library/Tomcat//logs/catalina-daemon.pid, PID is 5901
jsvc (Apache Commons Daemon) 1.0.10
Copyright (c) 1999-2011 Apache Software Foundation.
java version “1.6.0_33”
Java(TM) SE Runtime Environment (build 1.6.0_33-b03-424-11M3720)
Java HotSpot(TM) 64-Bit Server VM (build 20.8-b03-424, mixed mode)
commons daemon version “1.0.10”
commons daemon process (id: 5914, parent: 5913)
Server version: Apache Tomcat/7.0.27
Server built: Mar 31 2012 03:43:36
Server number: 7.0.27.0
OS Name: Mac OS X
OS Version: 10.7.4
Architecture: x86_64
JVM Version: 1.6.0_33-b03-424-11M3720
JVM Vendor: Apple Inc.[/language:1c85moiu]The servlet code I used for tests:
[language=java:1c85moiu]import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.net.URL;import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;import org.zefer.pd4ml.PD4Constants;
import org.zefer.pd4ml.PD4ML;public class PD4MLServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
URL url = new URL(“http://pd4ml.com/xindex.htm”);
PD4ML html = new PD4ML();
html.setPageSize( PD4Constants.A4 );
html.setPageInsets( new java.awt.Insets(20, 50, 10, 10) );
html.setHtmlWidth( 850 );ByteArrayOutputStream baos = new ByteArrayOutputStream();
html.render( url, baos );byte[] result = baos.toByteArray();
response.setContentType(“application/pdf”);
response.setHeader(“Content-disposition”,”inline; filename=test.pdf”);
response.setHeader(“Pragma”, “cache”);
response.setHeader(“Expires”, “0”);
response.setHeader(“Cache-control”, “private”);response.setContentLength(result.length);
ServletOutputStream sos = response.getOutputStream();
sos.write( result );
}
}[/language:1c85moiu]Everything works just fine. So it should be an issue of an interfere of PD4ML with some other libs on your side. Please try the servlet – it the conversion fails, try to exclude libs one-by-one from your project until it started to work. It would be great if you share the results with us.
in reply to: need servlet code for converting html string to pdf June 18, 2012 at 09:08#29033Hello,
I tried to run above code in my applicayion which is a JSF enabled application.while trying to convert given URL i get the following exception.java.lang.NullPointerException
org.zefer.pd4ml.PD4ML.o00000(Unknown Source)
org.zefer.pd4ml.PD4ML.render(Unknown Source)
com.xyz.report.jsf.HtmlToPDF.doGet(HtmlToPDF.java:38)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
com.xyz.servlet.BaseEntityFilter.doFilter(BaseEntityFilter.java:44)my code is
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
URL url = new URL(“http://localhost:8080/xyzweb/faces/templates/includes/report/A104_fv_1.xhtml”);
PD4ML pd4ml = new PD4ML();
pd4ml.setPageSize( PD4Constants.A4 );
pd4ml.setPageInsets( new java.awt.Insets(20, 50, 10, 10) );
pd4ml.setHtmlWidth(1000);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
pd4ml.render(url, baos);
//pd4ml.render(arg0, arg1)
byte[] result = baos.toByteArray();response.setContentType(“application/pdf”);
response.setHeader(“Content-disposition”,”inline; filename=test.pdf”);
response.setHeader(“Pragma”, “cache”);
response.setHeader(“Expires”, “0”);
response.setHeader(“Cache-control”, “private”);response.setContentLength(result.length);
ServletOutputStream sos = response.getOutputStream();
sos.write( result );
}in reply to: need servlet code for converting html string to pdf June 18, 2012 at 15:04#29034Which PD4ML version do you currently use? You could check it in Manifest file of pd4ml.jar
in reply to: need servlet code for converting html string to pdf June 19, 2012 at 03:46#29035Hello,
i am using pd4ml 3.8.0fx4 versionin reply to: need servlet code for converting html string to pdf June 19, 2012 at 04:03#29036i think the problem is url is not able to read because of session. the xhtml in url shown is generated through the code and then user can view the report through that url.
do you have any suggestions how to handle this case with the session?Prashant.
in reply to: need servlet code for converting html string to pdf June 19, 2012 at 17:47#29037You need to pass the session id with request.
The simplest way would be to embed the session ID to the URL:
[language=java:3d15w8pg]URL url = new URL(“http://localhost:8080/xyzweb/faces/templates/includes/report/A104_fv_1.xhtml” +
“;jsessionid=” + request.getSession().getId());[/language:3d15w8pg]A bit trickier approach is to pass session IDs via cookies.
in reply to: General questions / FAQ June 20, 2012 at 15:22#26744I recently set
enableImgSplit(false) in my code, as I had some new documents where the image was breaking in the middle of the page break.
Once I added this, on SOME documents, the header is getting broken. On some it still works fine. It seems so far to break on the documents that have images spanning pages.
The *image* in the header (logo in top left) still appears, but the rest of the header disappears.
If I comment out enableImgSplit(false), headers appear again.Has anyone see anything like this? I am using 380fx4.
Here is sample of my header
TitleProduct Brandin reply to: enableImgSplit(false) breaks header? June 20, 2012 at 16:59#29040Which version of PD4ML do you currently use? The problem should not affect the actual ones.
in reply to: enableImgSplit(false) breaks header? June 20, 2012 at 17:05 -
AuthorPosts