[ 
https://issues.apache.org/jira/browse/PDFBOX-5355?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17909700#comment-17909700
 ] 

Tilman Hausherr commented on PDFBOX-5355:
-----------------------------------------

You should use the splitter() tool. That one has been improved last year that 
it fixes the structure tree too, and removes destinations that are no longer 
valid. Here's the result on your page, it validates: 
[^with_image-splitter-result.pdf]

> remove page from pdf with image violate conformance level pdf1.7
> ----------------------------------------------------------------
>
>                 Key: PDFBOX-5355
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5355
>             Project: PDFBox
>          Issue Type: Bug
>    Affects Versions: 2.0.20, 3.0.0 PDFBox
>            Reporter: lappa-lappa
>            Priority: Major
>              Labels: StructureTree
>         Attachments: 554dd11e-3c3d-44cd-bc31-d8f960e671e3.pdf, 
> 96977696-26b5-4d53-8fe9-8c8f974de749.pdf, image-2022-01-11-12-57-46-755.png, 
> pdf_result.pdf, with_image-splitter-result.pdf, with_image.pdf
>
>
> open [https://www.pdf-online.com/osa/validate.aspx] and upload 
> "with_image.pdf" document, validation passed
> Execute following code (update absolute paths to files):
> {{{}byte[] withImage = 
> readFile("C:/r/{}}}{{{}pdf/{}}}{{{}with_image.pdf");{}}}
> {{try (PDDocument boxDocument = Loader.loadPDF(withImage)) {}}
> {{  boxDocument.removePage(0);}}
>     try (ByteArrayOutputStream bos = new ByteArrayOutputStream()) {
>         boxDocument.save(bos);
> {{    byte[] pdfBytes = bos.toByteArray();}}
> {{{}    Files.write(Path.of("C:/r/{}}}{{{}pdf/{}}}{{{}pdf_result.pdf"), 
> pdfBytes);{}}}
>     }
> {{} catch (IOException e) {}}
> {{{}  e.printS{}}}tackTrace();
> {{}}}
> {{upload pdf_result.pdf into [https://www.pdf-online.com/osa/validate.aspx] , 
> validation is not passed.}}



--
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

Reply via email to