You store PDFs in a table called IMAGES in a column called Image? Highly confusing.
Why are you treating the data differently based on the filename for the target file? Presumably all data from the DB should be stored in the file, yes?
Have you tried something like this?
posted 1 month ago
The name of the BLOB column in SQL is "IMAGE" and the Table name is "IMAGES" because some .png images are stored as a binary large object.
I tried to create PDF in the same way as you suggested. I just commented out the "For PDF writing" part because the part of the code after "else" is the same as
you suggested. It creates PDF but when I open it I got the same format error.
You can't convert between file formats by changing the file extensions. You need to use a library that can create PDFs, like PDFBox. There is an example of how to create a PDF with an image on this site: https://coderanch.com/wiki/659953/PDFBox
posted 4 weeks ago
Thank you very much Tim for your suggestion! I accepted. I could solve the issue with the following code: