HTML to PDF / DOCX / RTF Java converter library › Forums › PD4ML v3 Archived Forums (Read Only) › HTML/CSS rendering issues › PDF output does not render images correctly
- This topic has 7 replies, 2 voices, and was last updated Apr 26, 2011
11:49:47 by PD4ML.
-
AuthorPosts
-
March 24, 2011 at 23:31#26539
Hi,
In our application we use PD4ML to generate PDF previews. In one such case, we also have images inside the document. The image is rendered correctly on HTML preview but does not renders correctly on PDF preview.Please see attach generated html code and PDF preview. Look at the image under GAP column
Thanks
March 31, 2011 at 20:22#28489Hi Any updates on this issue?
April 1, 2011 at 12:20#28490As I see in the HTML source there is a lot of JavaScript code to manipulate images. Please take into account: PD4ML does not support JavaScript.
Try to switch debug on (pd4ml.enableDebugInfo()) and inspect STDOUT/server’s log.
Does it try to load the images at all?
Are the requested URLs correct?April 6, 2011 at 07:02#28491HI Team,
I have enabled pd4ml.enableDebugInfo(). And verified the STDOUT/server’s log.
In server log, I have seen the urls for other images and gap rater.
I have Observed other images are rendering properly. But not Gag rater image.
I have tried to access gap rater image URL through browser(In HTML). Its displaying properly. (Attaching the screen shot for this)
Please find the attached server log.
Could you please suggest me on this?Thanks.
SadaApril 11, 2011 at 04:25April 11, 2011 at 13:45#28493Obviously the only problem is the original image dimensions. The image itself is too small and Acroread’s image scaling routines cannot produce anything acceptable from it.
Unfortunately from PDF we cannot choose applied image scaling algorithm. The only available PDF option is to force to interpolate the image, which usually gives even worse result (when applied to tiny images).
As a workaround I would recommend to generate images with greater dimensions (keeping height/width attributes unchanged) as it described there:
pdf-generation-troubleshooting-f4/prevent-images-being-scaled-t38.htmlApril 25, 2011 at 06:22#28494Hi Team,
I have tried to increase the pixel size of image. By using below code.
BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
img.getRaster().setPixels(0, 0, width, height, pixels);But i am not able to crease the pixel size.
Could you please suggest me on this?
Thanks,
Sada. BApril 26, 2011 at 11:49#28495You cannot increase size of pixels. You may increase image size in pixels.
For example:
[language=java:1tmqc50j]width *= 5;
height *= 5;
BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
img.getRaster().setPixels(0, 0, width, height, pixels);[/language:1tmqc50j]But, of course, pixels array must have a corresponding image data, match the new dimensions.
Also, if transparency is not absolutely necessary, I would recommend to use BufferedImage.TYPE_INT_RGB, or even BufferedImage.TYPE_BYTE_INDEXED to reduce resulting PDF document size.
-
AuthorPosts
The forum ‘HTML/CSS rendering issues’ is closed to new topics and replies.