Docx4j - convert docx with chart to pdf (java, or c#) - java

I have example docx with chart:
example
when I run example project:
org.docx4j.samples.ConvertOutPDF
I have empty pdf.
How to convert docx with chart to pdf?
I need a free tool/library.

I did the same using Jacob - check this thread. Please be aware: This requires Windows OS as well as installed MS Word.
Cheers, Dominik
Edit: Docx4J has issues when converting embedded charts - you may experience this, when using the webapp for pdf-conversion.

Related

How to print PDF files using Java

In my project I have JSP pages that should print PDF documents
You can use iText, fop or other.
Take a look at:
Compare these products for PDF generation with Java given requirements inside: iText, Apache PDFBox or FOP?
Are there any Java PDF creation alternatives to iText?
See the following which will convert HTML to PDF.
https://code.google.com/p/flying-saucer/
Easier than working with iText directly.

Creating Docx, PDF, XSL-FO

[Background Info]
We had a solution in place to use Word automation serverside to convert HTM documents into Docx, PDF or Print documents. This solution broke in the latest version of Windows Server 2012. We learned that MS does not intend on Word working in this manner and after trouble shooting with MS support Engineers we have come to the conclusion that it will never work.
[Currently]
I am currently researching potential technologies and tools that my company can use to regain this functionality. We need to be able to create Docx, PDF and print files to a local printer.
I have looked into a number of tool already and I am currently leaning towards Apache FOP this seems to handle PDF and Printing for us.
However, I'm looking for some advice and suggested tools that we could use to implement a pure Java approach. Currently our application creates HTM files with all the required information. So ideally we would like to take these HTM files and "Convert" them into Docx/XLS-FO format.
[Question]
So my question that I'm hoping you will be able to help me with.
What is the best tools that I can use to get from
HTM to Docx
HTM to PDF
Or what would be the best process for achieving this? has anyone had success finding a solution for this in the past?
Thank You
It depends on the level of control and the complexity of the source HTML. There are HTML to FO stylesheets but you might find them wanting for your specific need.
So you could use the Jericho parser to read the HTML and generate FO. Or you generate the target format directly using Apache PDFBox and Apache POI
It all boils down to the level of control you want/need
docx4j-ImportXHTML will get you from XHTML to docx. From there, you can use docx4j (or some other solution eg LibreOffice/OpenOffice) to do docx to PDF.
docx4j supports docx to XSL FO, and by default uses FOP.

Java generate PDF from RTF

I want to generate PDF file from RTF file.
I have tried following.
Itext
It's already outdated and new version doesn't support rtf.
JDocConverter
It uses OpenOffice on the background. it is working fine, there is only one problem. Open office doesn't support drawing object in RTF.
Any other possible and reliable solutions?
Note: It would be fine don't use any commercial software.
Windows has native convert RTF to PDF using command line, however it will to a degree be limited, so it will use direct convert text and images, but it will depend on rtf syntax as to which drawn objects are supported. WORD ART drawing objects need MS Word to print
The output looks reasonable but here is the source in MSWord where the art was clearly not handled by the non-word printout.
Under Windows you could print to CutePDF Writer. This freeware uses Ghostscript as a back end.
You may try Aspose.Words for Java to convert RTF file to PDF format. You can load a file in RTF format into Aspose.Words for Java and then save it to PDF format. Please note that while loading specify RTF as LoadFormat value and pass PDF as SaveFormat value while saving the document. This doesn't require OpenOffice or any other software to be installed for the conversion to work.
Disclosure: I work as developer evangelist at Aspose.
Best way to do it is use MS Office. And Ms Office is able to save file in PDF format (you need install some addons I think).

Convert file .pptx to image using Java

Is there a way to convert pptx to an image? My aim is to finally generate an PDF file.
I try with Aspose but there are some issue. With Apache POI, it don't support PPTX. Any other idea?
There is a PPTX SVGExporter in DocX4j that may help you, in conjonction with Batik (from SVVG to PDF)
Note : I've not tested it
You may be able to write a small native library that Java calls to do the operation. I'm pretty sure you can use a .NET language or C++ to connect to powerpoint and have it "print" to either PDF or some other usable format. Here is a small sample application which does some automation.

export a report in ms word(97-2003) without using RTFExporter in jasper reports

I have a report which needs to be exported in pure word format(97-2003) using jasper report. But Jasper uses RTFExporter for exporting report in doc format, wen i read the report using POI, it throws error saying its not pure word. Can anyone help how to generate a report in word using Jasper reports. Please help!
I'm pretty sure you can't do anything closer than RTF from Jasper. If you can't replace the Jasper report, then you need to find something that will read the RTF and render it as a DOC.
You could use Docmosis to read the RTF and spit out a DOC. Docmosis is based on OpenOffice and Java and OpenOffice has pretty impressive filters for saving in different formats. Also, most platforms are supported since you haven't mentioned any limitations on what type of system you are running on.
Aspose.Total will allow you to generate .doc files from Jasper.
Aspose.Words for JasperReports is the
only known solution on the market that
makes possible exporting reports from
JasperReports and JasperServer to
Microsoft Word document (DOC), Office
Open XML (OOXML, DOCX), Rich Text
Format (RTF), OpenDocument Text (ODT),
Web page (HTML) and plain text (TXT)
formats.
It looks quite expensive, though.

Categories

Resources