library to bring a pdf to code - java

I have the need to create some pdf through java code, pdf templates are fixed and are very complex too. Each pdf represents a module and I have to fill it with informations I get from other sources in my application and finally create the complete pdf.
So, is there a library which, given a pdf, scans it and creats some java code which will eventually create it back? This way once I get the pdf template in java code I just have to edit it adding my informations and create it back.

You can check these 2 link it's have all information regarding PDF CRUD operation.
How to read PDF files using Java?
http://mrbool.com/how-to-create-write-and-read-pdf-files-using-pdfone-and-java/27058

I have used with success iText http://itextpdf.com/ for various tasks involving creating, parsing and modifying pdf files. Please not that this one is not free for commercial use and the pricing isn't cheap either.
However, your question is a possible duplicate of the folowing one, so be sure to check the answers there:
https://stackoverflow.com/questions/6118635/what-is-the-best-pdf-open-source-library-for-java

itext is one of best approach for your need..
itext API'S

Related

Convert multiple files into PDF

My questions is rather theoretical. I need to implement an application that takes different file extensions such as [asp,bmp,doc,docx,html,jpg,pdf,pdf,png,pptx,sql,txt,xls,xlsx] and converts them all into a consecutive PDF file for print.
I did my research in terms of coding and found multiple libraries that do the job
such as Apache POI, iText, aspose.pdf.jar and others I tested them out on individual portions of the idea. They work great but require a lot of women-hours to implement the desired application. My question is, is there anything more complete that will speed up the job. For example a library such as apache POI that does not require specifying every single padding and background color.
Any suggestions are appreciated.
As per my knowledge and experience not a single API is present there who provide all solution without this. Because of that we need to use Apache POI, iText, aspose.pdf.jar , FOP.
In java(using jquery as per my knowledge) you are able take snapshot of rendered page using stream which you will need to proceed at serverside and generate PDF which generate pdf file same like html page without any extra formatting but it having limitation that you can't use landscape. If page data is big then it shrinks pdf which causes small font(in very large page even you unable to read pdf).

Java utility for printing PDF

I'm making a utility to grammatically making a document and printing it.
I am gonna apologize, I'm not good at formulating this and there may be some confusion, please bare over with me :(
This project is mostly for making a user friendly utility for creating documents in your program and printing it and also as a learning experience.
It uses objects which I will convert to MarkDown as its easy to work with, I convert it to HTML as its going to be used in a web form.
The problem occurs when I want the program to print this HTML file that i have now created to a PDF.
I've searched for a solution for a very long time but have yet to find results, all that I've found was either out of date, filled with bugs or just could not do what I wanted.
I have tried iText as that seems to be the most popular choice but as stated above, everything I found was out of date and no longer useful, mostly because the classes they speak of do no longer exist.
What I do want is eventually independence of other libraries so that is my ultimate goal, but for now I want a way to print a locally stored HTML file as a PDF, it needs to be CSS compatible.
As an extra thing if anyone could point me in the direction of learning how to make MarkDown to HTML and printing HTML to PDF I would be more than happy.
Edit 1:
Stephan C pointet the question is too wide and difficult to answer, I will try to explain:
Main thing I want is to print a PDF file using an HTML file and CSS which is stored locally.
Optional solutions is I would love to learn how to code this myself instead of implementing libraries, for example markdown4j and iText. Yes I know that's a lot to take on, but as stated this is a learning experience for me.
Have a look at Converting HTML files to PDF. It has sample code for using with iText and also other suggestions. If you run into problems with approach suggested post specifics here. Either modify your original question or ask new question.
Printing directly from HTML to pdf can be also worse than using iText or other libraries.
I just made some iText PDF not using low level pdf classes but compiling a PDF form from it.
If you need to fill a PDF form, you can use iText as following.
Make your html form a PDF form. (acrobat or other free softwares)
Use iText classes AcroFields to get the PDF form fields (you get them by names or you can return a map of fields using AcroFields.getFields();
Compile the required informations using AcroFields.setFields() or .setField();
PdfReader class allow you to open an existing PDF (the template)
PdfStamper allow you to write the stream to another one (the result)
Adding images and other binary stuff is really easy!
By this way, you can do it quickly and layouts will be fast and good too.
The limit is that you need as many template as many data you need. (if you have fields that is some cases are many in other just one, you need twice templates).
For a static number of fields is a good solution.
Hope it helps.

How to create Report from DB information in PDF format without using jasper

I want to create reports in PDF using the data available in database. I want to do some data manipulation and use the charts and details to be shown in pdf to the user.Suppose say there are 2 columns in DB a and b . I want to show in the PDF, the value of a and b and the addition of a and b. What i can use to generate this pdf report?
I thought of using jasper, but i donot want to use it. Instead is there any other logic in java that can help to solve this problem. Please suggest with examples.
Thanks
Birt is a tool that can be used to generate all sorts of reports. There are plugins for Eclipse that you can use to help you get going and you can definitely add logic in Java. It can output your report in multiple formats including PDF, HTML, and I believe even Word docs.
If you've used Eclipse before you should be able to figure out the basics, but it can get as complicated as you want. In its simplest form you attach data sources (such as a database with a JDBC connection) and you structure your joins and layout fields onto a form. You can even tie it into a Java EE container if needed.
There are examples on their website and it has a rather large community to help with questions.

How can I merge individual selected PDF files into one PDF upon download?

How can I merge individual selected PDF files into one PDF upon download?
I want to achieve the following:
http://annualreport2010.landsecurities.com/create-your-own-report.aspx
Do I require an ASP website, or could I do something similar using a static HTML site?
Static HTML won't do it.
You need something on the server side. The other answers have options that would work, I just wanted to also mention pdftk, which you could then call from the server side. Be sure to escape all file names and such, though, because you would have to use system calls.
pdftk is really easy. The very first example from their documentation shows how to merge several PDFs, named 1.pdf, 2.pdf and 3.pdf, into one PDF called 123.pdf:
pdftk 1.pdf 2.pdf 3.pdf cat output 123.pdf
For PHP, there even is pdftk-php, if you want to look into that.
I think that the Apache PDFBox project can be good for you.
In particular, take a look at the PDFMerger class.
You can also use iText but in my opinion it's less easy to use.
See if itext can help in merging. A quick search gives many links - like Java: Merging multiple PDFs into a single PDF using iText.
There is a Java PDF merging software at http://codesforus.blogspot.com/.
p.s. They link to this download page: http://messiahpsychoanalyst.org/Documents/Downloads.html#part1
You can find Source code for PDF split and Merge Source forge PDF SAM

populate data from java to pdf

I am currently looking for a solution to populate a PDF file from the java code, Is there any APi for that, I googled it and found JustformsPDF does the trick, but it works only for some pdf and not all + its a old API without recent developments/support.
Basically I have an existing PDF (and do not want to build it) I just need to populate my java data inside that pdf.
any suggestions ?
These two should be able to do the job (these are the ones I know, there may be more):
Apache PDFBox
iText
You can use our product PDFOne (for Java). It has a document component that can also fill form fields in existing PDF documents. Viewer and printer components are also available.

Categories