You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Radomir Mladenovic (JIRA)" <ji...@apache.org> on 2015/03/13 18:04:39 UTC

[jira] [Commented] (PDFBOX-2708) PDDocument.removePage() deletes the last page regardless of parameter passed

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

Radomir Mladenovic commented on PDFBOX-2708:
--------------------------------------------

I tracked this down to PDPageTree.remove() that was invoking COSArray.remove() which didn't work if page was indirectly referenced. Can be fixed using COSArray.removeObject() instead.

Pages were removed from the end of the document as the rest of PDPageTree.remove() was updating COSName.COUNT although removal from the dictionary actually failed.

I'll send a pull request with a fix.

> PDDocument.removePage() deletes the last page regardless of parameter passed
> ----------------------------------------------------------------------------
>
>                 Key: PDFBOX-2708
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2708
>             Project: PDFBox
>          Issue Type: Bug
>          Components: PDModel
>    Affects Versions: 2.0.0
>            Reporter: Radomir Mladenovic
>            Priority: Blocker
>              Labels: regression
>             Fix For: 2.0.0
>
>
> This can be easily reproduced using provided example 
> org.apache.pdfbox.examples.pdmodel.RemoveFirstPage that will delete the last page from document instead the first one.
> I think this bug was introduced within the last 3 months as my older snapshot build worked fine.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org