bai yuan created PDFBOX-5898:
--------------------------------
Summary: Converting PDF to images using PDFBox results in
unexpected outcomes.
Key: PDFBOX-5898
URL: https://issues.apache.org/jira/browse/PDFBOX-5898
Project: PDFBox
Issue Type: Bug
Affects Versions: 2.0.24
Reporter: bai yuan
Attachments: image-2024-11-12-15-45-48-011.png, test2.pdf
Running the following code, many fine red lines appear in the image.
{code:java}
String pdfFilePath = path + "test2.pdf";
String outputDir = path + "/out/";
try {
PDDocument document = PDDocument.load(new File(pdfFilePath));
PDFRenderer pdfRenderer = new PDFRenderer(document);
for (int page = 0; page < document.getNumberOfPages(); page++) {
BufferedImage bim = pdfRenderer.renderImageWithDPI(page, 300,
ImageType.RGB);
ImageIO.write(bim, "PNG", new File(outputDir + "page-" + (page
+ 1) + ".png"));
}
document.close();
System.out.println("PDF converted to images successfully.");
} catch (Exception e) {
e.printStackTrace();
}
{code}
!image-2024-11-12-15-45-48-011.png!
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]