-2

Which of the following is the best way of generating pdf in java using iText:

  1. Generate pdf from scratch each time.
  2. Have a predefined pdf, and each time push the data values to the predefined pdf and save as new pdf.
  3. Generate a XML each time from the data to be pushed and generate a new pdf each time.

Appreciate your response.

Verhagen
  • 3,885
  • 26
  • 36
user1457957
  • 195
  • 1
  • 6
  • 21
  • 2
    Each has advantages and disadvantages. Unfortunately broad questions like this are not on-topic for SO. You'll need to reform your question to post a specific query with an objective solution. – CollinD Oct 28 '15 at 19:00
  • Can you add some more background to the problem, as it is to broad at the moment. – Verhagen Oct 28 '15 at 19:16
  • To elaborate more of my question - I have a UI where the user will fill First name, Last name, Address and so on. After clicking on the save button i need to generate a PDF with the details of first name, last name, address and so on. Which option you think it will suit to my requirement – user1457957 Oct 29 '15 at 04:18
  • This question is very similar to http://stackoverflow.com/questions/26218444/generate-and-design-pdf-with-itextsharp-or-similar – Bruno Lowagie Oct 29 '15 at 22:42

1 Answers1

2
  1. When you have the PDF Generating code GENERIC to appending data and making STYLING and TRANSFORMATIONS to the DYNAMIC CONTENT, it is advised to pass your data to that and GENERATE from the SCRATCH.
  2. If you are adding IMAGES, STYLING and TRANSFORMATIONS to the STATIC CONTENT, it is better to make a PREDEFINED PDF with DATA-HOTSPOT-IDs so that you can REPLACE those IDs with your DYNAMIC CONTENT.
prgmrDev
  • 910
  • 1
  • 10
  • 20
  • Looks like a good answer but did you intend to format those parts as bold-cap? – Jason D Oct 28 '15 at 19:57
  • Yes, I mean to say that those are very few factors which are relevant to the solution I have given. Much more factors may diverge the solution. – Deepak Penaganti Oct 28 '15 at 20:03
  • To elaborate more of my question - I have a UI where the user will fill First name, Last name, Address and so on. After clicking on the save button i need to generate a PDF with the details of first name, last name, address and so on. Which option you think it will suit to my requirement. – user1457957 Oct 29 '15 at 04:17
  • @user1457957 See **Option 2** of my answer to [Generate and design PDF with iTextSharp or similar](http://stackoverflow.com/questions/26218444/generate-and-design-pdf-with-itextsharp-or-similar) and please read [the documentation](http://pages.itextpdf.com/ebook-stackoverflow-questions.html) before asking questions that are asking to be closed. – Bruno Lowagie Oct 29 '15 at 22:44