Generate an HTML report with BIRT from an HTML Template - java

In a project I'm working on, we're using BIRT to generate some HTML reports from some XML Traces.
However these reports are pretty simple and ugly and we wish to improve them. We made a mockup/template in HTML/CSS (and some JavaScript that we want to be embedded in each reports) but now that we're happy with the design, there seem to be a problem (that we should have seen before):
Can we use this template with BIRT? AFAIK, we have to design the birt template using birt's tools ; and it'll be a lot of (useless) work to do so, and we're not even sure we'll be able to obtain the same design with birt as we tweaked things very tightly with CSS.

You can give bookmarks to all of your visualizations in the BIRT report and then use the JavaScript API to display the content in your template. Alternatively, if you are building even the visualization in the HTML template, you can use the REST API to extract data into JSON format and then visualize that as you like in your HTML pages.
You could also load the external CSS file with the BIRT report.

Related

rich PDF generation framework in java

I have hundreds of rich PDFs that need to be generated from my application, they have images and colorful content. I was looking to build a framework which support a template and data model and can take care of rest, so adding anew pdfs would be just adding a new template. In the past i have used free-marker to generate HTML and that print HTML to PDFs, are there any better recent solution to solve this problem?
There are various things you could do:
generate xml data, apply xslt transformation to style it, and convert
the html document to a pdf
code a small class that converts whatever data format you have to a pdf document (you would need to do all the layout through code)
create a template (using whatever design program you want) pdf document, insert form fields, and have iText fill the form (several of our customers go for this approach)
Keep in mind that JasperReports uses a proprietary format. Whereas the approaches I suggested use only open and well-established formats.
Take a look at JasperReports.

How to convert TestNG report index.html to pdf

I am trying to convert TestNG report to PDF.
I have tried so many options present on google but all are converting HTML code to PDF but I required replica of index.html or emailable report to PDF.
Many are offering different plug-ins.. I do not have problem with them unless there presentation and information​ they sharing is some what equalvent to TestNG report.
I understand the index.html have other dependansies like css and other things like images.
Can anyone suggest a good option.
Please specify the jars required and import if possible.
It will really help :)
If you want a pdf report, you can use this TestNG extension: http://uttesh.com/pdfngreport/
Or you can write your own by implementing the IReporter interface, and maybe combined with IText or any other pdf generation lib.
If don't want to use above plugin and you just want to convert your index.html, you can refer the following thread.
A java library for converting xml/html to pdf

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

Is there a GUI for designing PDF reports generated by Java?

I've written some Java code using the iText library to generate a PDF report, but specifying the layout seems very manual and takes a lot of time, re-running the code to test small adjustments.
Does anyone know of a report designer for PDFs which would work with Java? It doesn't have to be iText based, that's just what I'm using at the moment.
Yes, JasperReports. It has the iReport visual designer. Also, the API is pretty straightforward.
As far as I know, BIRT is an alternative to JasperReports.
Have in mind that both are complex reporting solutions that support exporting to a number of different formats.
You could look at Docmosis which uses Word or OpenOffice documents to provide the layout and formatting (that is, a template). It has a property you can set that will "watch" templates for changes and automatically process the changes in the background, so you can keep changing a template, then render it again without any code/compile changes.

Categories

Resources