Embed XML file into PDF - java

I need to embed an XML file (or simple text file) into a PDF generated via Java and Adobe LiveCycle SOAP call.
I can't use iText or another library but only HTML code submitted to LiveCycle for transformation.
How can I do?
Thank you!

If you have access to the LiveCycle server you can set up a simple process that makes use of the XSLT service bundled in Foundation (available on every LC installation) to transform the HTML to something that your PDF will consume. I can give advice but need more details on your environment and LC modules installed in your server.

Related

Set Watermark on Document Using CMIS After view or download

I have Created Custom web Application using Java Servlets, and Connected to Alfresco Repository using CMIS.
I also have created one simple workflow using activity.
Now My requirement is, In workflow after view or download document i want to dynamically set the watermark on only downloaded copy. but not on original document which is in the repository.
How can i achieve this using CMIS.
Please provide sample code if you have.
Thanks in Advance...
Once you have the document downloaded, you are dealing with a straight Java File object at that point. CMIS is out-of-the-picture. You can use any library that knows how to work with PDFs to add a watermark. One example is iText.

Trying to convert Rich Text to HTML with embedded images and file attachments

I've been reading about some xPages functionality about wrapping a document with DominoDocument.wrap(...) that is supposed to do this for you. However, I am in a stand along Java program.
Is it possible to get the xPages Jar Files to import into my application somehow? I do have the basic Notes Jars working.
it is unlikely you will get this working using the DominoDocument class. when you wrap the Document, it creates a 'DominoRichTextItem', during this process it extracts the attachments to the local filesystem so that the web server can easily serve the content during the user's browsing/editing session.
this attachment extraction process relies on the user's session information, as well as the xpages applications 'persistence service'.
you are better of trying to emulate this idea by using the standard notes API to extract the text/html mime part, and the extracting attachments/inline image mime parts for whatever your purpose

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.

Using templates for creating PDF files

I have some PDF template (with header and footer). I want to generate documents that are based on that template.
Is there any way to do that with iText? Thank you
P.S. Right now I am generate a document on-fly i.e. every time I generate header, footer and the context itself.
UPDATE: I have found incredible library called PD4ML. It's not free, but not such expensive, BUT it has really cool features such as HTML2PDF conversion on fly, supports a lot of HTML-CSS tags and has even its own jsp tags library! So I really suggest it when you need something instead of heavy and memory-eating JasperReports.
You can use JasperReports library and the iReport visual designer.
JasperReports use iText to produce PDFs from "jasper" templates, that are XML files (following the jrxml DTD) compiled in java classes, but allows you to use the template for generating MS Office files (with POI), html, etc.
Im not sure with iText, but you can use BIRT for this purpose. http://www.eclipse.org/birt/ Its too much using it just for PDF creation, you can do a lot (more than you can imagine) with it.
If you can choose your template format. I would go with JODReport and JODConverter.
JODReport use an ODT template and fill the mapping in the template with your java code.
JODConverter use LibreOffice to convert such template in PDF or whatever fortmat LibreOffice can handle to export.
You have to be able to use LibreOffice as a service installed remotely on a machine.
I used it back in 2012 but not sure if the project is still active

Generating and Displaying PDF file in Flex/Java

We have Flex on the front end and Java on the back end. When a user will request for a PDF file, request will go to the Java backend, where a PDF file will be generated using Jasper Reports. What we dont know is how to display this PDF file in browser; since we dont want to use JSP/Servlets etc - It has to be flex only. Any suggestions?
Flash Player cannot natively render PDF files. This is possible using Adobe AIR but not in a Flex application. Your best bet is to call navigateToURL() and open a Servlet in a new browser tab/window. The Servlet can simply write contents of the PDF file to the OutputStream and set the appropriate HTTP headers.
i think this question is old, but it may help others, there's a new library developed by Jasper Forge them selves, which deals with JasperReports directly, i mean it's not a PDF viewer, but a JasperReport exporting tool, you can download it from here
i tried it through using JasperServer, when viewing reports you can choose from different options to export it, one of them is flash, and it's working nice
Well for starters, PDFs don't always display in the browser. It depends on the user's settings. You essentially header them the pdf file and either they download it or a program like Acrobat Reader opens in the browser to display it.
Not sure how this is done in flex, I would imagine if you're using Java one simple servlet could do it.

Categories

Resources