Opensource PDF generator for Angular and Java - java

I'm looking for the best PDF generators for Angular and JAVA. If there's one that can be used in both would be great. The requirements I have on these PDF creators are:
OpenSource
Easy to use
Can be used on Enterprise level
Generate custom PDFs (not just print-outs of what’s on the screen)
So far I have on my list:
iText (discarded)
Apache POI
Aspose (discarded)
PDFBox
PDF Clown (discarded)

In angular if you have data on UI then you can use following libraries which have good provision to export pdf:
"jspdf": "^1.4.1"
"jspdf-autotable": "^2.3.4"
If you need customized reports and have dependency on backend then you can use Jasper Reports which can give more reach appearance.

Related

Interactive charts in PDF

I want to generate interactive charts in PDF just like Google charts
but this is for embedding on web page I want to embed interactive chart in PDF. any help?
You specified Java, so I would say iText has some partial support for writing adobe-javascript actions. You must be aware that latest versions of itext uses AGPL license, so you must pay a commercial license if you want to use this in a commercial closed-source application.
Another option is to use Adobe Acrobat SDK, but I am not sure if you will be able to use it from Java.
You may also find this link useful: Acrobat JavaScript Scripting Guide - Adobe
This feature of the PDF specification (I mean embedded javascript) is not commonly used, so it might be a bit difficult to find start-up information and sample code.
Here you will find a few examples of interactive PDFs that use javascript, there is even an example of a flying helicopter in 3D, (it actually moves around while viewing the file).

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

Converting .xls to .pdf using Java(or not)

Is there a way to convert a xls file into a pdf?
I want to make a dynamical report directly to pdf file, but didn't find a way to make dynamic columns on iReport, so I've made a method on Java that exports to xls dynamically.
So I was wondering if is there a way to convert this file to pdf, but it need to be on a method from my code. Or if you have a better idea, it can be used too.
Maybe there's a way to make this pdf file from my code as I did with xls. Please help me out.
Thanks.
Try using iText http://itextpdf.com/ - I've used it to create PDFs with columnar structure.
In addition to using iText directly, there are a couple report engines that sit on top of it:
Eclipse BIRT (using 2.1.7, the last MPL/LGPL version)
Jasper Reports (which uses a Very Old version, 1.3.1 IIRC)
This is a commercial solution:
http://www.dancrintea.ro/xls-to-pdf/
If you want open source try jakarta POI.
Try using the Muhimbi PDF Converter Services. It comes with a Java compatible Web Services based interface and sample code. It does other things as well.
I worked on this application, so the usual disclaimer applies.

Converting JavaScript generated documents/pages to PDF

I'm using xhtmlrenderer + iText in Java to generate PDFs for some pages in my application. I've managed to convert some pages already. However, I came across a limitation to this approach where it can't convert pages dynamically created using JavaScript scripts (some by JQuery). Are there other available tools for this?
Thanks.
Your best bet is wkhtmltopdf. It's a PDF converter sitting on top of web kit, complete with its JS environment. I haven't tried it myself (yet).

Java - PDF Generation Framework

I am using PDF documents for various purposes using iText library.
Its like one class per PDF document. In a way there are a lot of similarities among the classes and the same have been listed below:
The fields have (x,y) location
The field can be wrapped after some no. of words
A field can have a value which is a function of one or more parameters
Subsequent page of PDF has to kept same or different
I am thinking of doing this layout business through a XML file. Any thoughts or innovative ideas of solving this are welcome.
take a look at PDFBox Library which is now in the incubator of Apache
PDFBox is nice, Used it before and good good help from the developer. You might want to have a look at XSL:FO. It is an XML based formatting language that can output the result as PDF (and other formats) using Apache:FOP.
What about Prince? It's a FOP engine that uses CSS files as styling, and has a Java API. It's not free though (apart from the free Personal License)
Flying Saucer supports using XHTML/CSS to create PDFs.

Categories

Resources