Hello,

The change fixes the error.

So, I think it is OK.

Thank you all.

Bart klein Ikink
________________________________
Van: Tilman Hausherr <thaush...@t-online.de>
Verzonden: maandag 9 december 2024 08:58
Aan: users@pdfbox.apache.org <users@pdfbox.apache.org>
Onderwerp: Re: PDPage.getTrimBox() not working after migrating from pdfbox 
2.0.26 to 3.0.3

https://repository.apache.org/content/groups/snapshots/org/apache/pdfbox/pdfbox/3.0.4-SNAPSHOT/
https://repository.apache.org/content/groups/snapshots/org/apache/pdfbox/xmpbox/3.0.4-SNAPSHOT/
https://repository.apache.org/content/groups/snapshots/org/apache/pdfbox/preflight/3.0.4-SNAPSHOT/

Alternatively set pdfbox.version to 3.0.4-SNAPSHOT and add
https://repository.apache.org/ as repository.

     <repositories>
         <repository>
             <id>apache.snapshots</id>
<url>https://repository.apache.org/snapshots/</url>
         </repository>
     </repositories>


You can probably simplify your pom.xml by keeping preflight only, the
rest is dependent.

Tilman

On 09.12.2024 08:34, Bart Klein Ikink wrote:
> I just found out we don't use the pdfbox-app artifact. This is an extract 
> from our POM:
>
> <dependency>
>      <groupId>org.apache.pdfbox</groupId>
>      <artifactId>pdfbox</artifactId>
>      <version>${pdfbox.version}</version>
> </dependency>
> <dependency>
>      <groupId>org.apache.pdfbox</groupId>
>      <artifactId>xmpbox</artifactId>
>      <version>${pdfbox.version}</version>
> </dependency>
> <dependency>
>      <groupId>org.apache.pdfbox</groupId>
>      <artifactId>preflight</artifactId>
>      <version>${pdfbox.version}</version>
> </dependency>
>
> ________________________________
> Van: Bart Klein Ikink<bart_klein_ik...@hotmail.com>
> Verzonden: vrijdag 6 december 2024 17:23
> Aan:users@pdfbox.apache.org <users@pdfbox.apache.org>
> Onderwerp: Re: PDPage.getTrimBox() not working after migrating from pdfbox 
> 2.0.26 to 3.0.3
>
> Thank you. Due to security restrictions I have to ask permission.
>
> Hopefully, I can work on monday.
>
> ________________________________
> Van: Tilman Hausherr<thaush...@t-online.de>
> Verzonden: vrijdag 6 december 2024 13:39
> Aan:users@pdfbox.apache.org <users@pdfbox.apache.org>
> Onderwerp: Re: PDPage.getTrimBox() not working after migrating from pdfbox 
> 2.0.26 to 3.0.3
>
> It's now fixed, a snapshot build is available here:
> https://repository.apache.org/content/groups/snapshots/org/apache/pdfbox/pdfbox-app/3.0.4-SNAPSHOT/
>
> Tilman
>
> On 06.12.2024 12:17, Tilman Hausherr wrote:
>> Hi,
>>
>> Thanks for reporting, I created
>> https://issues.apache.org/jira/browse/PDFBOX-5919 . Likely a mistake
>> in refactoring, the javadoc is clear that it should return the cropbox
>> if trimbox doesn't exist.
>>
>> Sadly I can't fix it right now because of network problems (either
>> from my ISP or from Apache or in between)
>>
>> Tilman
>>
>> On 06.12.2024 09:01, Bart Klein Ikink wrote:
>>> I have a test where I do:
>>>
>>> try (PDDocument document = Loader.loadPDF(new
>>> ClassPathResource("/A5.pdf").getFile())) {
>>>       PDPage page = document.getPage(0);
>>>
>>>       assertTrue(isStandardPageSize(page.getMediaBox(), A5));
>>>       assertTrue(isStandardPageSize(page.getCropBox(), A5));
>>>       assertTrue(isStandardPageSize(page.getTrimBox(), A5));
>>>
>>> After migrating, it fails on page.getTrimBox()
>>>
>>> java.lang.NullPointerException: Cannot invoke
>>> "org.apache.pdfbox.pdmodel.common.PDRectangle.getWidth()" because
>>> "box" is null
>>>
>>> Under pdfbox 2.0.26 the code worked fine. It was:
>>>
>>>           try (PDDocument document = PDDocument.load(new
>>> ClassPathResource("/A5.pdf").getInputStream())) {
>>>
>>>       PDPage page = document.getPage(0);
>>>
>>>       assertTrue(isStandardPageSize(page.getMediaBox(), A5));
>>>       assertTrue(isStandardPageSize(page.getCropBox(), A5));
>>>       assertTrue(isStandardPageSize(page.getTrimBox(), A5));
>>>
>>> So, MediaBox and Cropbox still work but not Trimbox.
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:users-unsubscr...@pdfbox.apache.org
>> For additional commands, e-mail:users-h...@pdfbox.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:users-unsubscr...@pdfbox.apache.org
> For additional commands, e-mail:users-h...@pdfbox.apache.org
>
>

Reply via email to