Hi,
You could use the source code of ExtractImages (in the source code
download) to get the sizes.
Btw the current version is 2.0.24.
Tilman
Am 28.07.2021 um 03:31 schrieb [email protected]:
I want to dynamically specify the dpi specification when converting from
PDF to JEPG file.
In the case of 300dpi, I changed it to 72dpi because Out of Memoey
occurred in the PDF that retained the image. In that case, the characters
were crushed in the JPEG file that output only the text, and it became
difficult to see.
Is there a way to see if there is an image in the PDF file attributes or
to see the pixel value?
implementation 'org.apache.pdfbox:pdfbox:2.0.23'
code
----------------------------------------------------------------------
try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
ImageOutputStream ios = ImageIO.createImageOutputStream(baos);) {
bufferedImage = pdfRenderer.renderImageWithDPI(i, 300, ImageType.RGB);
ImageWriter writer =
ImageIO.getImageWritersByFormatName("jpeg").next();
writer.setOutput(ios);
JPEGImageWriteParam jpegParams = new JPEGImageWriteParam(null);
jpegParams.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
writer.write(null, new IIOImage(bufferedImage, null, null),
jpegParams);
writer.dispose();
imageDataList.add(baos.toByteArray());
} catch (IOException e) {
return PDF_CONVERT_ERROR;
} finally {
if (bufferedImage != null) {
bufferedImage.getGraphics().dispose();
bufferedImage = null;
}
}
----------------------------------------------------------------------
--------------------------------------------------
コベルコシステム株式会社
ソリューション事業部
インダストリーソリューション本部
第2開発部 第2グループ
内田 一之(ウチダカズユキ)
TEL:080-9594-1560
E-mail:[email protected]
---------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]