[ https://issues.apache.org/jira/browse/PDFBOX-5898?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17897459#comment-17897459 ]
Tilman Hausherr commented on PDFBOX-5898: ----------------------------------------- I think the problem is in java itself, the pattern has this: {code} 7 7 1 1 re f 6 7 1 1 re f 5 7 1 1 re f 4 7 1 1 re f 3 7 1 1 re f 2 7 1 1 re f {code} so it's creating many 1x1 rectangles, but isn't really perfect. PDF.js has the same problem at some resolutions. > 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 > Priority: Major > Attachments: TilingPattern-2371731399394458-1000%.png, > TilingPattern-2371731399416644-2000%.png, 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: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org