Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I am looking for a free java library to convert html to pdf. Html page is formatted with CSS, and those styles contains images (.gif). At the moment I am using Flying Saucer but this library cant convert CSS with images properly.
Thanks in advance.
Marek
I use YAHP.
http://www.allcolor.org/YaHPConverter/
It does have CSS. I have had issues with some CSS styles, such as the roundborder ones specific to chrome/firefox, but it does have CSS. I can't remember ever having a problem with CSS images.
one lame way (but hey you may be desperate) is there is a java library for contacting openoffice running as a headless server. This is http://www.artofsolving.com/opensource/jodconverter ... and use openoffice to convert. OTOH, this is pretty kludgy, and definitely not pure java) and I'm not sure how good the openoffice html import filter is ... but I guess it's worth looking at. There used to be some html to pdf converters built into iText but they have been removed (and were pretty limited).
Try this HTML to PDF converver: http://pd4ml.com/index.htm. It's writen purely in Java
Try the Adobe -Generate PDF API (Java)-- http://livedocs.adobe.com/livecycle/8.2/programLC/programmer/help/wwhelp/wwhimpl/common/html/wwhelp.htm?context=sdkHelp&file=000447.html - here you can see the how to, and at the bottom, a quickstart which contains working sample java code to convert a web page into PDF.
Prince XML is the best and easiest to use PDF generator I've used. A commercial license costs a pretty penny, but if you're OK with a small watermark on the first page of your document, the free version is great. It can be integrated with a number of programming languages, including Java.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I have been working on my own project for the past few months and i have stumbled upon a problem. I need to attach some data from database(in pdf format) to emails i will be sending to clients. I know this could be done using Itext, but for commercial licence they charge around 1300$ for 2500 emails which is insane.
Do you guys know any other library i could use in my application i plan to offer commercially? Any other idea which will help me solve this problem will be greatly appreciated!
Cheers
I used PDFBox in the distant past. Admittedly, I was using it for reading PDF files, but it did a good job and seemed well-designed.
First you can try
flying saucer
Basically it uses an old version of iText which was free (more here)
Flying Saucer will allow you to render PDF on server-side from an HTML template (CSS 2.1 is supported) - we're using this solution (with mustaches templates) in our project
Another option (valid for Google Chrome) - you can do PDF exporting on client, just calling window.print() and using Chrome "Print to PDF' functionality
You can use Apache's FOP library for generating PDF. It is released under Apache 2 licence.
https://xmlgraphics.apache.org/fop/
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
Which Java PDF library to use in commercial project? I need to generate a printable (and good if it will be editable, like .xls) report (it contains table, some text and report's total page count - this is because I can't use HTML( I can't calculate page count)).
P.S. I can't use iText because it's licence don't allow to use free version of iText in commercial projects.
Thanks.
We are in the same boat at my job, and are moving to pdfbox. For what it's worth, generating real print quality PDFs (like, ones that get printed hardcopy by a print company) for office documents is somewhat non-trivial. In my experience, distiller does the best job. But PDFBox is certainly more straightforward if that will meet your print needs.
You can use below three Java libraries to create HTML+CSS template to makeup your PDF file.
Flying-saucer + Freemarker + Itext
Flying-saucer:https://code.google.com/p/flying-saucer/
Freemarker: http://freemarker.org/
Itext 2.1.7: http://itextpdf.com/ (Please note this is the free version of iText in commercial projects.)
You can also Check this project which is using these three libraries:
https://github.com/xiang-lee/pdf-generator
Personally I have used Apache FOP supports several output formats. You might also be interested in JasperReports it supports pdf, html, excel and openoffice.
Apache PDFBox perhaps?
http://pdfbox.apache.org/
iText wasn't always under AGPL. You might consider using iText 2.7 or 4.2 which are under LGPL.
See also this question: What is latest version of itext that is not AGPL?
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I have a user guide for my application that I would like to provide both an HTML verson and a PDF version (and possible some other indexed version for a Java help). Are there any tools, preferably for maven that I could integrate into my build cycle that will convert from HTML to PDF? Currently I have a word doc format that I manually convert to PDF (and no HTML version available), which is prone to errors and really just a pain.
Well, after a short search, I went on http://www.xhtml2pdf.com/ and if you have your HTML, it does the trick.
However, I prefer using a wiki for documentation. It has all advantages, since it can be edited in parallel, in multiple languages, and a lot of them have both static HTML export and PDF export.
I should recommend you Dokuwiki (and you can find your plugins at http://www.dokuwiki.org/plugins) because it's really easy to install and administrate, but you can also use any other one that have PDF and HTML export.
You might use a tool like DocBook and write the documentation in a scripting language (XML in their case). Then use the tool to transform the source to the target formats, e.g. HTML and PDF.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
I'm looking for an open source OCR library that runs on Linux. I need this to work for PNGs and PDFs. Mostly I would like to interface this library from java or ruby. Any idea if there is anything available?
Regards.
Tesseract is a very good OCR engine: https://github.com/tesseract-ocr/tesseract
The project has been launched by HP Labs and is now continued and sponsored by Google (for Google Books !). It is released under the Apache license, and it runs on Linux. It uses Tiff or PNGs files ; for PDFs, you will need to convert to one of these formats. I suppose that there is no binding so you should invoke this software as a subprogram...
Cuneiform is free and does a decent job. You could invoke it as a subprogram but there's no language binding that I know of. It won't read PDFs directly but you can easily take apart PDFs that are sequences of scanned images to feed them to Cuneiform. There are also scripts to reassemble the images and text back into a searchable PDF.
Try tesjeract, which uses JNI to call Tesseract OCR API.
For PDF, you'll need to convert them to image first, using GhostScript, for instance.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
So I am working on a jsp/servlet that came to me and I'm looking at the jsp file and it is just a jungle of jstl tags, java code and html thrown together. At first it looked like someone ran the standard eclipse formatter on it and had the page width set to 40 so alot of stuff is broken up, I tried to format it with a larger page width but that seemed to make it worse to the point of not being able to tell what is going on without formatting parts of it first.
Anyone have any luck with any jsp/code formatter?
Are you using Eclipse WTP plugin? If not, take a look at it - it has quite a few ways to customize formatting of JSP.
If you are, JSP formatting can be customized under Window -> Preferences; Web -> JSP Files -> Editor; note that there are two separate links there - for XML and HTML JSP.
Netbeans does a decent job at formatting my jsp code. You could download Netbeans 6.5.1 and format the files in there.
I know that this question is for JSP, and not javascript, but this works pretty well all the same: http://jsbeautifier.org/
Use this to format any HTML,JSP or any other language tag: https://www.freeformatter.com/html-formatter.htm
Try maybe IntelliJ IDEA. I can't guarantee it will do the job better but it won't hurt to try.
This seems to work fine for mine JSP and JS code (free at the momenti'm using it)
http://www.danstools.com/javascript-beautify/