HTML to PDF / DOCX / RTF Java converter library › Forums › PD4ML v3 Archived Forums (Read Only) › Deployment / Configuration issues › Anybody had problems with PD4ML on Lion for Mac? › Re: Re: Anybody had problems with PD4ML on Lion for Mac?
In 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.