Active1 year, 6 months ago
Java Class Library
Is there any client-side library that can convert a web page to a PDF document? I have used jspdf but the generated pdf does not retain the formatted html (like tags should be boldface in the PDF).
Aug 16, 2019 JPEDAL – JPedal is an actively developed and very capable native Java PDF library SDK used for printing, viewing and conversion of files; pdfcrowd – it's another Web/HTML to PDF and PDF to Web/HTML conversion library, with advanced GUI; 8. In this article, we discussed the ways to convert PDF file into various formats. Conversion Input. Convert a local file and write the result to a local file. Parameter Description Default file The path to a local file to convert. The file can be either a single file or an archive (.tar.gz,.tar.bz2, or.zip). If the HTML document refers to local external assets (images. The HTML node tree you want to transform into a PDF is first transformed into a canvas using html2canvas (line 4) Then, an empty PDF structure is created using an A4 format. By the way, we tell jsPDF to use mm as the unit for the next operations (line 5) Almost finished, we turn the canvas into a PNG image using canvas.toDataURL('image/png') (line 6). One way is to use window.print function. Which does not require any library. 1.No external library require. 2.We can print only selected parts of body also.
Bruno Lowagie64.8k1010 gold badges8282 silver badges122122 bronze badges
Converting HTML Documents to PDF Documents. Quick Start (EJB mode): Converting HTML content to a PDF document using the Java API. Quick Start (SOAP mode): Converting HTML content to a PDF document using the Java API. Including LiveCycle Java library files. Setting connection properties. PDFBox is a Java PDF Library. This project will allow access to all of the components in a PDF document. More PDF manipulation features will be added as the project matures. This ships with a utility to take a PDF document and output a text file.
Sudipta RoySudipta Roy
33311 gold badge22 silver badges1919 bronze badges
closed as off-topic by Stephen Kennedy, Enzokie, Martin James, gnat, MachavityApr 8 '18 at 14:07
This question appears to be off-topic. The users who voted to close gave this specific reason:
- 'Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.' – Stephen Kennedy, Enzokie, Martin James, gnat, Machavity
1 Answer
Very simple if your page is not having any sensitive data
Just Do this:
ORJust Do this:
Download this tool.
And you can invoke it on any event like:
For more information
http://snapshotmedia.co.uk/blog/jspdf
http://itextpdf.com/
http://github.com/MrRio/jsPDFAmol M KulkarniAmol M Kulkarni
12.8k2828 gold badges104104 silver badges152152 bronze badges
Not the answer you're looking for? Browse other questions tagged pdf-generation or ask your own question.
Active2 years ago
Possible Duplicate:
PDF Generation Library for Java
PDF Generation Library for Java
I'm working on an invoice program for a local accounting company.What is a good way to create a PDF file with Java? Any good library?I'm totally new to PDF export (On any language).
lakshman1,74166 gold badges2828 silver badges5555 bronze badges
hogni89hogni891,06755 gold badges1717 silver badges3838 bronze badges
marked as duplicate by trashgod, Shog9♦Sep 23 '11 at 18:01
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
3 Answers
I prefer outputting my data into XML (using Castor, XStream or JAXB), then transforming it using a XSLT stylesheet into XSL-FO and render that with Apache FOP into PDF. Worked so far for 10-page reports and 400-page manuals. I found this more flexible and stylable than generating PDFs in code using iText.
Philipp ReichartPhilipp Reichart19k55 gold badges5050 silver badges6363 bronze badges
Following are few libraries to create PDF with Java:
I have used iText for genarating PDF's with a little bit of pain in the past.
Or you can try using FOP: FOP is an XSL formatter written in Java. It is used in conjunction with an XSLT transformation engine to format XML documents into PDF.
Lii7,62844 gold badges4747 silver badges6464 bronze badges
RiteshRitesh3,86888 gold badges2525 silver badges4646 bronze badges
Another alternative would be JasperReports: JasperReports Library. It uses iText itself and is more than a PDF library you asked for, but if it fits your needs I'd go for it.
Simply put, it allows you to design reports that can be filled during runtime. If you use a custom datasource, you might be able to integrate JasperReports easily into the existing system. It would save you the whole layouting troubles, e.g. when invoices span over more sites where each side should have a footer and so on.
pudaykiran5,04577 gold badges4949 silver badges7474 bronze badges
boxWhat Is A Java Library
box2,03822 gold badges2020 silver badges2929 bronze badges