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

Tilman Hausherr commented on PDFBOX-5332:
-----------------------------------------

newPDF is a different document than the one from which you print first. You 
attach a page that doesn't have its own media box, so PDFBox takes a default. 
Yeah this is unusual, so the best would be to take mediabox and cropbox from 
the old one and reassign it. (The same problem can also happen with resources). 
See the javadoc of PDDocument.importPage(), this may help a bit.

> media box size changes after addPage
> ------------------------------------
>
>                 Key: PDFBOX-5332
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5332
>             Project: PDFBox
>          Issue Type: Bug
>            Reporter: Sally Oh
>            Priority: Major
>         Attachments: screenshot-1.png, 스크린샷, 2021-11-26 16-11-30.png, 실패하지 않는 
> 책 스터디.pdf
>
>
> After addPage to a new PDDocument, it seems like that added page size is 
> changed to 'Letter size'
> {code:java}
> val page = PDDocument.load(File(path).pages.get(0)
> println(page.mediaBox.height) // prints 540.0
> newPdf.addPage(page)
> println(newPdf.getPage(0).mediaBox.height) // prints 792.0{code}
> Every other pdf files I have doesn't have this issue but only this file.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to