I\'m trying to scaling an image with size = 2496 x 3512 into a PDF document. I\'m using PDFBox to generate it but the scaled image ends up blurred.
Here are some snippet
Ok, I found a way to add images without losing the quality.
Actually to make the image not be blurred I let PDFBox to resize the image by giving it the desired size. Like the code below:
PDXObjectImage ximage = new PDJpeg(doc, new FileInputStream(new File("/usr/gyo/my_large_image.jpg")), 1.0f);
PDPageContentStream contentStream = new PDPageContentStream(doc, page, true, false);
Dimension scaledDim = getScaledDimension(new Dimension(ximage.getWidth(), ximage.getHeight()), page.getMediaBox().createDimension());
contentStream.drawXObject(ximage, 1, 1, scaledDim.width, scaledDim.height);
contentStream.close();
Thank you,
Gyo