[javascript] Doc.setPageBoxes() weird behavior?  SOLVED

Forum for the PDF-XChange Editor - Free and Licensed Versions

Moderators: Daniel - PDF-XChange, PDF-XChange Support, Vasyl - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Paul - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

Post Reply
Mathew
User
Posts: 564
Joined: Thu Jun 19, 2014 7:30 pm

[javascript] Doc.setPageBoxes() weird behavior?

Post by Mathew »

I'm having three problems with the Doc.setPageBoxes() command.

The first problem:
problemCrop.pdf
(1.08 MiB) Downloaded 65 times
For the attached pdf file, I can expand the media box by running:

Code: Select all

this.setPageBoxes({ 'cBox': 'Media',
                    'nStart' : 0,
                    'rBox':  [-187.0426025390625,792,791.093505859375,0] })
It then expands the page:
image.png
If I then reset the page by running:

Code: Select all

this.setPageBoxes({ 'cBox': 'Media',
                    'nStart' : 0,
                    'rBox':  [0,792,612,0] })
All appears good on the surface:
image(3).png
However, if I try to run the first command again, nothing happens! The undo history says a crop has happened, but I cannot find any changes. At this point, I can't figure out what's messed up in the page boxes. If I run 'Normalize Pages' for instance, it thinks they're already "normalized". Art, Bleed, BBox, Trim, Crop all seem to have the same values that they did originally:

Code: Select all

Art: 0,792,612,0
Bleed: 0,792,612,0
BBox: 67.46399688720703,753.8079833984375,565.0999755859375,27.7340087890625
Trim: 0,792,612,0
Crop: 0,792,612,0
The second problem is how javascript is responding to errors with the parameters in this method. Instead of returning a javascript error, it's popping up a dialog which makes handling any error impossible:
image(1).png
or
image(2).png
The third problem
API states that the parameter rBox is optional. If not provided, the specified box is removed.
However, if I try

Code: Select all

doc.setPageBoxes({ 'cBox': 'Trim', 'nStart':0});
I get an error popup
image(4).png
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19822
Joined: Mon Jan 12, 2009 8:07 am
Contact:

Re: [javascript] Doc.setPageBoxes() weird behavior?

Post by Stefan - PDF-XChange »

Hello Mathew,

I see that Dan has passed the above to our devs and they said that they will look into the above and try to reply to you within the next 24h. So we are looking into this, it just can take us a bit longer to get back to you!

Kind regards,
Stefan
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2444
Joined: Thu Jun 30, 2005 4:11 pm

Re: [javascript] Doc.setPageBoxes() weird behavior?  SOLVED

Post by Vasyl - PDF-XChange »

Hi Mathew.

All problems described will be fixed in the upcoming build. Thanks for the report.

Cheers.
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Mathew
User
Posts: 564
Joined: Thu Jun 19, 2014 7:30 pm

Re: [javascript] Doc.setPageBoxes() weird behavior?

Post by Mathew »

All good in build 394. Thank you. :D
Post Reply