-
Inserting text to existing PDF file (21 messages)
- Posted by: Kamesh Ramaswamy
- Posted on: May 29 2004 01:08 EDT
I have a PDF File that contains fields ID,name etc, one below the other. The user details from web page(or XML) are to be inserted against the appropriate fields in PDF files. I tried inserting texts using Itext Software for PDf. But it overwrites the existing file and is not suitable to my needs. Can anybody suggest a solution on how to insert texts at appropriate place without overwriting existing PDF file using JSP.Threaded Messages (21)
- Inserting text to existing PDF file by Paul Strack on May 30 2004 22:42 EDT
- Thanks for information by Nataly Arlingston on November 03 2009 10:39 EST
- A pdf editor by angelacat sara on May 25 2011 05:07 EDT
- method to insert text to pdfs by angelacat sara on May 25 2011 05:10 EDT
- taking notes on a pdf file by chris dix on April 10 2012 16:13 EDT
- iText PdfReader by Sean Sullivan on June 01 2004 11:36 EDT
- Basic iText Example by Simon Ward on June 28 2004 05:52 EDT
- How to do this with Web Application. by andy Chiang on June 24 2005 04:12 EDT
- How to do this with Web Application. by Thomas Philip on September 14 2005 12:16 EDT
- pdf by matt coleman on December 19 2012 23:53 EST
- How to do this with Web Application. by andy Chiang on June 24 2005 04:12 EDT
- inserting text into pdfs by sunil gv on January 19 2005 04:41 EST
- Java: Merging multiple PDFs into a single PDF using iText. by eliza sahoo on March 18 2010 05:29 EDT
- Thanks! by Richard Busby on March 28 2012 12:53 EDT
- Inserting text to existing PDF file by santa wify on July 02 2012 06:12 EDT
- Inserting text to existing PDF file by santa wify on July 02 2012 06:13 EDT
- Thanks! by Richard Busby on March 28 2012 12:53 EDT
- Inserting text to existing PDF file by Popa Nan on July 10 2012 04:14 EDT
- Inserting text to existing PDF file by Oktopus Oktovber on July 10 2012 04:46 EDT
- Inserting text to existing PDF file by arron lee on April 27 2013 02:30 EDT
- convert by Michelle Pinto on May 16 2013 07:33 EDT
- pdf by Matt Coleman on May 22 2013 11:07 EDT
-
Inserting text to existing PDF file[ Go to top ]
- Posted by: Paul Strack
- Posted on: May 30 2004 22:42 EDT
- in response to Kamesh Ramaswamy
I don't know of any easy way to do this. PDF is designed to be a platform-independent printing specification, not a data-storage format.
I strongly suggest you store your data in something other than a PDF (XML is good), then use some other utility (say XSL-FO) to convert your data to PDF as needed.
If you absolutely must do things the hard way (because you don't have control over the data format), the best you can do is directly hack the contents of the PDF file. This is going to be very ugly and very error prone. Check out:
http://partners.adobe.com/asn/tech/pdf/specifications.jsp -
Thanks for information[ Go to top ]
- Posted by: Nataly Arlingston
- Posted on: November 03 2009 10:39 EST
- in response to Paul Strack
Thanks for the information. But to tell the truth I thought that the response will be different. As for meI adore reading. Very often I find books that are worth reading in pdf format (maybe because I use this pdf seach engine http://pdf.rapid4me.com but it's very nice and it can find any book I want). Of course I can't read without making notes. That is why I needed a positive response so much. -
A pdf editor[ Go to top ]
- Posted by: angelacat sara
- Posted on: May 25 2011 05:07 EDT
- in response to Paul Strack
if you want to fill in a pdf form, you can use a Pdf editor to add text to pdf file. Because it has a form-filling mode to automatically detect blanks or check box then you can write on it as you want. And save all the added text in original PDF file with a click. It's very convenient!
-
method to insert text to pdfs[ Go to top ]
- Posted by: angelacat sara
- Posted on: May 25 2011 05:10 EDT
- in response to angelacat sara
you can read some precise info from here: http://www.convertpdf.org/add-text-to-pdf.html
-
taking notes on a pdf file[ Go to top ]
- Posted by: chris dix
- Posted on: April 10 2012 16:13 EDT
- in response to Paul Strack
copy paste into another format, or print and take notes the old fashioned way?
-
iText PdfReader[ Go to top ]
- Posted by: Sean Sullivan
- Posted on: June 01 2004 11:36 EDT
- in response to Kamesh Ramaswamy
-
Basic iText Example[ Go to top ]
- Posted by: Simon Ward
- Posted on: June 28 2004 05:52 EDT
- in response to Kamesh Ramaswamy
This will take an existing PDF called "somePDF.pdf" read the file, then add content to the fields in the PDF, then write the file to a new file called "aNewPDF.pdf". This is the most basic form of this method. For instance if the field names are unknown you can get a list of all field names and iterate through them. If you wish to combine pdfs into a single document you can. As I said this is just a bit of basic code.
import com.lowagie.text.pdf.*;
import com.lowagie.text.DocumentException;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
import java.util.*;
//Insert the following into a servlet or adapt it to a standard java class
ServletContext context = getServletContext();
//get a handle to the file location
templatePath = context.getRealPath("/SomeDirectory");
if(templatePath == null)
{templatePath = File.separator;}
else if(!templatePath.endsWith(File.separator))
{templatePath += File.separator;}
//Reads in the pdf Template
PdfReader reader = new PdfReader(templatePath + "somePDF.pdf ");
try
{
PdfStamper stamp = new PdfStamper(reader, new FileOutputStream("aNewPDF.pdf"));
AcroFields form = stamp.getAcroFields();
//set the field values in the pdf form
form.setField("fieldName","aValue");
...etc...
...etc...
stamp.setFormFlattening(true);
stamp.close();}
catch(Exception e)
{System.out.println("Error: " + e);} -
How to do this with Web Application.[ Go to top ]
- Posted by: andy Chiang
- Posted on: June 24 2005 04:12 EDT
- in response to Simon Ward
This is a nice example to explan how to insert text into pdf template file. In thie example, it make a new pdf file that is not I want. My requirement is to insert data into pdf template file and make a new pdf datastream and response to WEB http via servlet... I think it just need to change a little bit. But I have no idea how to do. Does anyone who can answer my question? -
How to do this with Web Application.[ Go to top ]
- Posted by: Thomas Philip
- Posted on: September 14 2005 12:16 EDT
- in response to andy Chiang
Instead of using a File OutputStream use a ByteArrayOutputStream and get the bytes from the ByteArrayOutputStream -
pdf[ Go to top ]
- Posted by: matt coleman
- Posted on: December 19 2012 23:53 EST
- in response to Simon Ward
Simon, I appreciate the codes you shared here regarding text insertion in pds files
-
inserting text into pdfs[ Go to top ]
- Posted by: sunil gv
- Posted on: January 19 2005 04:41 EST
- in response to Kamesh Ramaswamy
has anyone got the solution for this problem. -
Java: Merging multiple PDFs into a single PDF using iText.[ Go to top ]
- Posted by: eliza sahoo
- Posted on: March 18 2010 05:29 EDT
- in response to Kamesh Ramaswamy
iText is a library that allows you to generate PDF files on the fly. Please find more details on iText on below link.
http://www.lowagie.com/iText/
Here is a code snippet which takes multiple PDFs stream as input and merging them to a new PDF fileHope it did answer your question -
Thanks![ Go to top ]
- Posted by: Richard Busby
- Posted on: March 28 2012 12:53 EDT
- in response to eliza sahoo
Thanks a lot the last comment helped me a great deal!
-
Inserting text to existing PDF file[ Go to top ]
- Posted by: santa wify
- Posted on: July 02 2012 06:12 EDT
- in response to Richard Busby
PDF is largely based on PostScript but simplified to remove flow control features like these, while graphics commands such as lineto remain. Thanks.
Regards,
-
Inserting text to existing PDF file[ Go to top ]
- Posted by: santa wify
- Posted on: July 02 2012 06:13 EDT
- in response to Richard Busby
PDF is largely based on PostScript but simplified to remove flow control features like these, while graphics commands such as lineto remain. Thanks.
Regards,
-
Inserting text to existing PDF file[ Go to top ]
- Posted by: Popa Nan
- Posted on: July 10 2012 04:14 EDT
- in response to Kamesh Ramaswamy
thx. really helped me this topic. urologie
-
Inserting text to existing PDF file[ Go to top ]
- Posted by: Oktopus Oktovber
- Posted on: July 10 2012 04:46 EDT
- in response to Kamesh Ramaswamy
there is any way to add a video to a pdf document? thx finisaje
-
video[ Go to top ]
- Posted by: l esca
- Posted on: December 19 2012 02:03 EST
- in response to Oktopus Oktovber
yes a video tutorial would be helpful to further explain SOA
-
Inserting text to existing PDF file[ Go to top ]
- Posted by: arron lee
- Posted on: April 27 2013 02:30 EDT
- in response to Kamesh Ramaswamy
Of course it is possible. but i suggest you'd better choose some tools . have you ever tried someone. if not, i want to recommend a professional PDF Plugin i've used before. it is pretty a genius. i believe you can add page numbers and consecutive numbers in locked PDF documents with the help of it. you can also other free trials of Yiigo. to deal with different files of documents, images, and barcodes. i wish i've offered a good choice for you. Bset Regards Arron -
convert[ Go to top ]
- Posted by: Michelle Pinto
- Posted on: May 16 2013 07:33 EDT
- in response to Kamesh Ramaswamy
Couldn't you just convert it to .docx and then back to .pdf -
pdf[ Go to top ]
- Posted by: Matt Coleman
- Posted on: May 22 2013 11:07 EDT
- in response to Kamesh Ramaswamy
i hate editing PDF! learn to bartend