Forum Replies Created
-
AuthorPosts
-
in reply to: Google App Engine August 21, 2012 at 10:55#28426
Does pd4ml API support Google App-Engine (GAE) for java?..Anybody Please respond for it soon..
in reply to: Troubleshooting August 21, 2012 at 11:03#26765Hi,
I am trying to convert html file to pdf using this pd4ml API. Does it Compatibility
for GAE (Google App-Engine) with java? .in reply to: ex Unit support in CSS August 22, 2012 at 15:56#29095PD4ML does not support ‘ex’ measurement units for the time being.
in reply to: Google App Engine August 22, 2012 at 15:58#28427PD4ML relies on AWT, which is not offered by GAE. So the answer is ‘no’
in reply to: Does pd4ml support for Google AppEngine(GAE) with java.? August 22, 2012 at 15:59#29096No. PD4ML relies on AWT classes, which are not offered by GAE.
in reply to: Troubleshooting August 23, 2012 at 14:05#26766Hello,
I use the profession release. In my JSP I’va added a draft watermark using this code:
<% String watermark = request.getParameter("watermark");<br /> if("1".equals(watermark)){ %><br /> <pd4ml:header watermarkUrl="../../img/brouillon.png" watermarkOpacity="30" watermarkBounds="60,150,500,500" /><br /> <% } %>
My problem is that when I call the url with and without the watermark parameter I have always the same result… some time I got two pages with the watermark, later I get two without. I thought that It was perhaps a caching problem, so I added to my URL a parameter with a timestamp, but nothing changes.
When I run two URLs in debug mode, first is going into the conditionnal generating the watermark and second is well bypassing this line of code.
I wonder if there is a concurrency problem in the engine that transforms the jsp into the pdf result.
Can anybody help ? Other Ideas ?
Thanks.
in reply to: Troubleshooting August 23, 2012 at 17:55#26767HI,
I am getting the following issue while generating PDF
Following is the error
com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1613)
Caused by:
java.lang.NoClassDefFoundError: sun.awt.X11.XToolkit (initialization failure)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:140)
at java.lang.Class.forNameImpl(Native Method)
at java.lang.Class.forName(Class.java:139)
at java.awt.Toolkit$2.run(Toolkit.java:837)
at java.security.AccessController.doPrivileged(AccessController.java:202)
at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:829)
at org.zefer.font.c.(Unknown Source)
at org.zefer.cache.ResourceCache.getFontMetrics(Unknown Source)
at org.zefer.html.doc.o.õ00000(Unknown Source)
at org.zefer.html.doc.o.for(Unknown Source)
at org.zefer.html.doc.u.(Unknown Source)
at org.zefer.html.doc.PD4MLHtmlParser.buildDocument(Unknown Source)
at org.zefer.pd4ml.PD4ML.o00000(Unknown Source)
at org.zefer.pd4ml.PD4ML.render(Unknown Source)Do you have any idea why the above issue could be seen?
in reply to: HTML/CSS rendering issues August 23, 2012 at 19:05#26768Hello PD4ML,
We’re using version 380fx3 and table property rules=”cols” is not working as expected. Here’s the sample code for your reference:
(a) Sample Text (b) Sample Text (c) Sample Text Thanks,
Kunalin reply to: General questions / FAQ August 24, 2012 at 08:34#26769goodmorning,
I’m testing your evaluation version of pd4ml for .net.
Using a your example I can convert a html file in a pdf file, but I need to convert a string that contains html in a pdf file.
Someone can help me please?
thanks!in reply to: Google App Engine August 24, 2012 at 09:19#28428thanq.
in reply to: .net html string August 24, 2012 at 11:41#29100You’d need to build a MemoryStream object from the string, like the following:
[language=java:22f8vtt0]private static byte[] GeneratePdf(string html) {
PD4ML pd4ml = new PD4ML();
using (var output = new MemoryStream())
{
var encodedBytes = Encoding.UTF8.GetBytes(html);
using (var input = new MemoryStream(encodedBytes))
{
pd4ml.render(input, output);
return output.ToArray();
}
}
}[/language:22f8vtt0]If the HTML refers to any resources (images, CSS) by relative URLs, use render() API method with base URL parameter.
in reply to: Issue while generating PDF August 24, 2012 at 11:51in reply to: .net html string August 24, 2012 at 13:02#29101sorry, but I’m still inexperienced with your product.
if I use the code above I obtain pdf file as result or I must do other operations?in reply to: Troubleshooting August 24, 2012 at 15:46#26770When using multiple source documents, the PD4ProgressListener fails to work. The document is rendered correctly, but the monitoring doesn’t.
This is the progressUpdate method in my listener.
<br /> public void progressUpdate(int mID, int prog, String notes, long ms) {<br /> if (DEBUG) Log.theLog.log("~~~~ %s%% Complete", prog);<br /> switch(mID) {<br /> case CONVERSION_BEGIN:<br /> if (DEBUG) Log.theLog.log("~~~~ Conversion Begin");<br /> break;<br /> case HTML_PARSED:<br /> if (DEBUG) Log.theLog.log("~~~~ HTML Parsed");<br /> break;<br /> case DOC_TREE_BUILT:<br /> if (DEBUG) Log.theLog.log("~~~~ Doc Tree Built");<br /> break;<br /> case HTML_LAYOUT_IN_PROGRESS:<br /> if (DEBUG) Log.theLog.log("~~~~ HTML Layout In Progress");<br /> break;<br /> case HTML_LAYOUT_DONE:<br /> if (DEBUG) Log.theLog.log("~~~~ HTML Layout Done");<br /> break;<br /> case TOC_GENERATED:<br /> if (DEBUG) Log.theLog.log("~~~~ TOC Generated");<br /> break;<br /> case DOC_OUTPUT_IN_PROGRESS:<br /> if (DEBUG) Log.theLog.log("~~~~ Doc Output In Progress");<br /> break;<br /> case NEW_SRC_DOC_BEGIN:<br /> if (DEBUG) Log.theLog.log("~~~~ New Src Doc Begin");<br /> break;<br /> case CONVERSION_END:<br /> if (DEBUG) Log.theLog.log("~~~~ Conversion End");<br /> break;<br /> }<br /> }<br />
This is how I am calling it
<br /> String html = "<span>Hello world</span>";<br /> StringReader sr = new StringReader(html);<br /> OutputStream os = new ByteArrayOutputStream();<br /> <br /> PD4ML pd4ml = new PD4ML();<br /> pd4ml.enableDebugInfo();<br /> pd4ml.useTTF( "java:", true );<br /> pd4ml.setHtmlWidth(1050);<br /> pd4ml.enableSmartTableBreaks(true);<br /> <br /> // ResumePrinterQueue.newListener() returns a vanilla PD4ProgressListener<br /> PD4ProgressListener prog = ResumePrinterQueue.newListener();<br /> pd4ml.monitorProgress(prog);<br /> <br /> try {<br /> //pd4ml.render(sr, os); //< <hr class="bbcode_rule" /> OK<br /> <br /> //pd4ml.render(sr, os, new java.net.URL(RTiClient.URL())); //< <hr class="bbcode_rule" /> OK<br /> <br /> StringReader[] arr = {sr};<br /> pd4ml.render(arr, os, new java.net.URL(RTiClient.URL())); //< <hr class="bbcode_rule" /> Fails<br /> } catch (Exception e) { }<br /> <br /> // Just something to make sure the compiler doesn't throw anything away<br /> Log.theLog.log(new String(((ByteArrayOutputStream)os).toByteArray()).substring(0, 8));<br />
I’m using 3.80fx6 Volume, so I don’t think it is an issue of not having access to the methods. Is there some kind of config flag I am not setting, or is the monitoring broken for this instance?
in reply to: General questions / FAQ August 28, 2012 at 19:56#26771I have a situation where I’m generating graphics on the fly to be included with a PDF document (created with the tag library and JSP).
Normally, I would think about writing the images back into the web application where I could reference them with a relative URL.
This fails in one of two instances:
1. Running from a WAR file
2. getRealPath returns null because the entire path is not readable by the server userIn order to get around this, I write the images to java.io.tmpdir, then use a fully qualified URL to a servlet that can provide the image. This works quite well as long as there is no NAT in place.
If there is a NAT in place, then I run into the issue called hair pinning. This is where a packet leaves a private IP, goes out the NAT, then immediately turns around and comes back in via the public IP. Unless specifically configured, NAT devices block this traffic.
To get around the hair pinning issue, I have started using the following URL in the JSP generating the PDF with the image:
file:///path-to-java.io.tmpdir/image-name.jpg
So the img tag in the JSP looks like:
This surprisingly enough works.
My question is, is this access supported? If so, is this intentional? If not, how long can I rely on this before it breaks?
-
AuthorPosts