0

I'm storing a pdf file(FileInputStream) in varbinary column of azure sql database from Java. I want to retrieve the blob data and modify few contents and then store it into a pdf again.

Examples I'm seeing in online are related to retrieving and saving it to a pdf using FileOutputStream. But I want to modify some contents before storing it into the pdf. How to achieve this?

Link Followed: https://www.sqlitetutorial.net/sqlite-java/jdbc-read-write-blob/

Note: I'm using Spring JdbcTemplate for connecting with azure sql.

Manoj kumar
  • 227
  • 6
  • 19
  • I think the easiest way to modify a PDF file using java code is to use a third party library like _iText_. Refer to [Editing PDF text using Java](https://stackoverflow.com/questions/4131031/editing-pdf-text-using-java) – Abra Apr 30 '21 at 10:42
  • @Abra will check this.. but i'm exploring if any options are available to modify the content right after fetching from blob and before storing it in a pdf. – Manoj kumar Apr 30 '21 at 10:46
  • Your content is already in PDF format, so you certainly don't want to edit the bytes directly. Do like @Abra suggested, use a PDFReader to read your blob data as a PDF, do whatever changes, and then write it to the file/back to the database – JP Moresmau Apr 30 '21 at 11:04

0 Answers0