Page 1 of 1

PDF output with images

PostPosted: Wed Apr 16, 2014 1:15 am
by xtroce
i copied the pdf output from an example from the internet. All examples that i could find use the same method:
Code: Select all
         org.docx4j.convert.out.pdf.PdfConversion c = new org.docx4j.convert.out.pdf.viaXSLFO.Conversion(wordMLPackage);
         OutputStream os = new FileOutputStream(new File(outputfilepath + ".pdf"));
         c.output ( os , new PdfSettings() );


whenever i use this method i get a pdf without any layouting and tons of

Code: Select all
NOT IMPLEMENTED: support for w:pict - without v:imagedata


errors in the text. I saw that there where possiblities to convert via itext but the api does not seem to carry these possibilities anymore, if i'm not mistaken. The version of docx4j that i used was 3.0.1. since i saw that 3.1.0 should have a lot of pdf output improvements i imported the jar and tried with that but i still get the same errors. Also the functions i use are marked deprecated. Is there a newer example or could somebody give me a basic idea of what to look for to get the conversion working.
Thanks

edit: i also should mention that i try to replace some strings in a pdf, which works good with the VariableReplace example that is provided and i simply put the above code in the save part in addition to the given docx putput. The docx addition works fine.

Re: PDF output with images

PostPosted: Wed Apr 16, 2014 10:50 am
by jason
xtroce wrote:NOT IMPLEMENTED: support for w:pict - without v:imagedata


docx4j's PDF output supports normal images, but it does not support "Shapes" or "Drawing Canvas". Supporting this would require VML to SVG conversion, which is do-able, but not something we've done.

For more background, see https://wiki.openoffice.org/wiki/VML

You might try using LibreOffice or OpenOffice for your docx to PDF conversion. If it is satisfactory, you could drive it from Java via JODConverter.