Posts

Showing posts with the label pdf

Using the PDFBox library to embed an Image to a PDF document

I tried to embed an image into a PDF using the apache POI and iText libraries but none of them worked to me. So I tried with the pdfbox library and it worked!

Java function to create a PDF document with an embedded image

Image

In this post I will show a Java function that pastes an image into a brand new PDF. The input and output of this function will be Base64 encoded.

Why did I need it? The client requested that the images attached to the case be converted to PDF in order to be sent to a service that only accepts PDF documents.