Image To Pdf Pdfbox. For creating an image in the pdf file pdimagexobject class is used. Using the pdpagecontentstream we can call the drawimage method.

Pdfbox library provides you a class named pdfrenderer which renders a pdf document into an awt bufferedimage. Using the pdpagecontentstream we can call the drawimage method. Execute the application above you will get the imagedocument pdf file as below.
Download the pdf document here apache pdf if you would like use the same pdf file.
We can create an image using pdimagexobject createfromfile image doc. A createfromfile string imagepath pddocument doc b createfromfilebycontent file file pddocument doc c createfromfilebyextension file file pddocument doc d setheight int h. For creating an image in the pdf file pdimagexobject class is used. Follow the steps below to insert image in the existing pdf document.