Convert Lotus Notes RichText to PDF programmatically - java

I want to convert Notes Richtext into PDF in a server program (preferably Java). Is there any sample code how to do that. Converting to HTML/MIME isn't an option since the conversion process is too lossy.

I did some tests with DXL, some XSLT code and XSL:FO, via FOP. It produced some PDF output. Project abandoned due to lack of funding (read: no customer).
The basics, in a recent document: http://www.ibm.com/developerworks/xml/library/x-xslfo/

You'll need to find some third-party software to help, as this isn't possible out of the box. Here's one that looks promising: SWING Software's Lotus Notes Export to PDF

Related

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.

Convert html+css+js to PDF

I want to create something like this (code is here):
in pdf format. I'm using google charts and regarding to this forum converting chart to pdf is impossible. I've already tryied iText+XMLWorker, but there is some problem with css and any js supporting at all, I think.
So, the questions are: How can I convert html+css+js to .pdf file? Or, may be, the issue have other variants?
As promised in the comment, I've asked Raf. This was his answer:
One way to use XML Worker for HTML+CSS+JS is to use a browser engine to preprocess the HTML. Examples of such a browser engine are WebKit (Chrome, Safari) and Gecko (Firefox). These can interpret the CSS and JS and give you HTML that is ready to be parsed by XML Worker.
Examples of competing products are:
wkhtmltopdf, a command line tool that uses WebKit as its rendering engine.
Prince XML supports HTML+CSS+JS to PDF using their own engine.
Maybe there are others, but this is what Raf told me. I hope this helps.

Native Java document parser and converter library / linux based document converters

I'm looking for a Java library which can do the following:
parse emails in *.eml or *.msg format for attachments of type DOC,DOCX,JPEG,PNG,GIF,TXT,XLS,XLSX,PPT,PDF and convert the attachmens to the TIFF format.
It can be either open source or a comercial library. Alternatively I'm looking for command line tools for linux doing this. We already tried open office, but there are too many problems with some document formats.
UPDATE:
What I found out by research up to now:
For parsing emails and extracting attachments, JavaMail (http://www.oracle.com/technetwork/java/javamail/index.html) is a good choice.
For converting documents, JodConverter (http://code.google.com/p/jodconverter/) is a confortable library. However it's only a wrapper for open office, so if there are issues with open office (and I do have often trouble with openoffice) to convert a document, you will have them also with JodConcerter.
In conclusion I had no luck (up to now) to find any document conversion library implemented in native java, which handels all common document formats, neither open source or even commercial. It seems to be a real market gap.
RainbowPDF may fit: its a commercial server based conversion tool with Java API.
If you've got a Windows server, have a look at NEEVIA Document Converter Pro. It has some mail functionality.
Apace POI is an interface to read the content of Microsoft Office documents. You will have to code the image generating and layouting components on your own. Nervertheless it reads Outlook MSG format.
Apache POI - the Java API for Microsoft Documents. However I don't know how to easily convert parsed document to TIFF.
May be a mix of different approaches could be useful? Depending on your requirements, could be possible to use several libraries to convert all the formats you need to manage: Microsoft Office, Adobe PDF, some different image formats and simple text files.
I mean, you can create a process that, depending on the type of the file extracted (using Java Mail), you could recognize what kind of format the file has and continue processing with the right conversion mechanism using the suitable library. Then you will idenfity if a file it's an image to convert, try Java Advanced Imaging, if it's a Microsoft Office file, try Apache POI and so on. For managing PDF files, you can try Apache PDFBox it's another good and opensource solution.
By the way, if you are looking not only for a Java approach, may be this thread may help you.
I don't know if there are better commercial solutions than #ChrisGer commented.
Do not waste your time looking at Apache POI, as it can only parse the content of the Office files but is not suitable for rendering it.
Since there are OpenOffice servers available, I suggest you do this. I also know you can easily use DCOM to talk with Microsoft Office apps, maybe a Java->DCOM bridge is more up to the task. However, this is not even recommended by Microsoft (so I suppose the JodConverter thing is equally unstable).

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).

Creating PDF, HTML, and optionally RTF documents from the same source using Java?

I was looking at using iText to create both a pdf and html version of a document with RTF as a possible option. According to this question this is no longer possible with iText. Is there a library that will allow me to create a document in Java and output it as both PDF and HTML? The ability to output RTF would be nice but is not required.
As that answer to the other question states, you can just use the iText RTF Library.
I have used PD4ML to convert HTML to pdf. Even though it is a commercial app. It is very reliable and supports CSS well.
JasperReports. If you look at this package it supports export to:
pdf
html
rtf
xls
xml
You have two options to create the documents:
via iReport - a visual designer for reports
via an API, where you construct everything with Java code.
Note that even though JasperReports's main function is to create reports, it can very well create other documents, with no tabular data for example.
You could also try Docmosis since that supports the output formats provided by OpenOffice (including the ones you specified) and you can often do the job with a lot less code.

Categories

Resources