• Post Reply Bookmark Topic Watch Topic
  • New Topic

Reading and Editing the Same PDF File

 
Jacob Abraham
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Friends,
I would like to know if it is possible to read and edit the same pdf file using Java. ie my PDF file named "Sample.pdf" has contents like

First Name = &F_NAME

Last Name =&L_NAME

what I want is to parse the Sample.pdf file and look for &F_NAME and replace it with "Jacob" and &L_NAME and replace it with "Abraham" so that the contents within that pdf file look like

First Name = Jacob

Last Name =Abraham

Please let me know if it is possible to do like this. All suggestions are welcome. Thanks is advance.
 
jeremy reynolds
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, i have one idea.

When you want to access your file, do so with an RandomAccessFile. This allows you to have an object which references to you pdf. And this object has both read and write functionality.

You just have to be careful about where you are writing to - you dont wont to overwrite other parts of the file.

Jeremy
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!