Bug - PXC_GetPageBox / PXC_SetPageBox

This Forum is for the use of Software Developers requiring help and assistance for Tracker Software's PDF-Tools SDK of Library DLL functions(only) - Please use the PDF-XChange Drivers API SDK Forum for assistance with all PDF Print Driver related topics or PDF-XChange Viewer SDK if appropriate.

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan

ondrejb
User
Posts: 29
Joined: Thu Sep 04, 2008 2:06 pm

Bug - PXC_GetPageBox / PXC_SetPageBox

Post by ondrejb »

Hello, I am evaluating PDF-XChange PRO SDK and I met some unexpected behavior...

1. If I save a PB_CropBox values by PXC_SetPageBox and then read it by PXC_GetPageBox, the Bottom and Top values are interchanged.
E.g. if I save Top value 50 and Bottom value 700, consequently I read Top Value 700 and Bottom value 50.

2. I have also a question concerning the PXC_PlaceImage function:
When using the 'y' parameter to horizontaly place the picture, the paramater value is aplied from the bottom of the page:
* value 0 -> picture is not visible - its top is on the page bottom,
* value 150 -> top part of the picture is visible on the bottom of the page,
* value = PageHeight -> picture is shown on the top of the page.
Is this behavior correct?

My configuration:
* PDF-XChange PRO 4 SDK, build 4.0.0.150 (downloaded before an hour :)
* VB.NET 2008, ver. 9.0.30729.1 SP (with SP1)
* Win Vista Business SP1
* I tried several GIF and JPG images with different resolution, always with the same outcome.

Thanks,
Ondrej Bouda
User avatar
Lzcat - Tracker Supp
Site Admin
Posts: 677
Joined: Thu Jun 28, 2007 8:42 am

Re: Bug - PXC_GetPageBox / PXC_SetPageBox

Post by Lzcat - Tracker Supp »

All of this is expected behavior. Please read Coordinate system in help file.
In short - y coordinate in pdf is from bottom to top, so in rect top is always greater then bottom.
When placing image you are specifying left-top corner of image and image width and height in same units as coordinates, not in pixels. Image will take full rect, regardless it size.
Victor
Tracker Software
Project manager

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
ondrejb
User
Posts: 29
Joined: Thu Sep 04, 2008 2:06 pm

Re: Bug - PXC_GetPageBox / PXC_SetPageBox

Post by ondrejb »

Thank for your answer!

I've got another question regarding the PXC_GetPageBox function:
* for PB_MediaBox, returns Top < Bottom,
* for PB_CropBox and PB_ArtBox, returns Top > Bottom.
(I didn't test other pBoxID values)

So, the media box coordinate system differs from the CropBox/ArtBox - is this correct behavior?

This difference pointed me previously to consider the CropBox values to be a bug...

I think, it also should be mentioned in the PXC_SetPageBox documentation that this function corrects meaningless input (I've just tested that the result is always the same, regardless of mischanging the Top and Bottom values).
Without such a note, I expected it either to set my values or fail...
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3556
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada

Re: Bug - PXC_GetPageBox / PXC_SetPageBox

Post by Ivan - Tracker Software »

Yes, there is a bug with PB_MediaBox.
Will fix it into the next release. Best practice here is to "normalize" rects returned from PXC_GetPageBox function.
Normalize means swapping left, and right when left > right, and swap top, bottom, when top < bottom.
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.