effectiveTrimBox returns unexpected result

Hi,

I’m not sure if this is a bug or if I’m using the object incorrectly.

I have two versions of the same A4 pdf. One is Portrait (original) and the other Landscape (rotation applied).

So, in order to get the correct measurements (based on visual instead of defined) I’m using effective trimbox:

const docWidth = Math.ceil( (app.doc.pages[0].effectiveTrimBox.right - app.doc.pages[0].effectiveTrimBox.left) / 2.835 );
const docHeight = Math.ceil( (app.doc.pages[0].effectiveTrimBox.top - app.doc.pages[0].effectiveTrimBox.bottom) / 2.835 );

If I use app.doc.pages[0].trimBox…right/left, etc. I get the measurements I’m expecting (210w x 297h) for both since this is the defined size.

However, if I use effectiveTrimBox I’m getting:
Portrait: 230w x 317h
Landscape: 317w x 226h

Not only I get an unexpected size, but they differ between the two pdfs.

The ArtBox is 230w x 317h, but I don’t see anything that could be 226mm:

I was expecting to get 297w x 210h when using effective trim box on the landscape pdf. Is this correct?

Thank you for letting us know. I can confirm that this is a bug in version 16.1.661, which has already been reported to us via the support. A new version fixing this problem will be available soon.

Just for completeness, the problem has been fixed with the latest release 16.1.662 and is already available.

2 Likes