PXCp_ET_GetElement Offsets do not match the real width

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.

Moderators: Tracker Support, TrackerSupp-Daniel, Chris - Tracker Supp, Vasyl-Tracker Dev Team, Sean - Tracker, Andrew - Tracker Support, Tracker - Clarion Support, John - Tracker Supp, Tracker Supp-Stefan, Ivan - Tracker Software, Support Staff, moderators

Post Reply
gotomaxx
User
Posts: 2
Joined: Fri Nov 21, 2008 10:48 am

PXCp_ET_GetElement Offsets do not match the real width

Post by gotomaxx » Thu Nov 27, 2008 9:50 am

I try to get the width of the text and individual chars using PXCp_ET_GetElement. I just can not get the correspondence between the Offsets and the real width of chars/text. Only when the FontSize is 1 I get the expected results. Do I miss something or is this a problem in the PDF-Tools SDK?

Example:
Attached is a PDF,
Test.zip
(817 Bytes) Downloaded 245 times
, with the text "ab" expressed in 2 chunks.
The first chunk, 'a', has the Matrix { 0.2448, 0, 0, 0.24, 28.32, 805.439 } This corresponds to the 3 transformations to be found in the PDF:
1 0 0 1 15.12 813.36 cm
0.24 0 0 -0.24 0 0 cm
1.02 0 0 -1 55 33 Tm
The second chunk 'b', right beside the first one, has the Matrix { 0.2448, 0, 0, 0.24, 34.32, 805.439 }
The FontSize is 41 and the Glyph size is 600, so we could compute the width of the first chunk as: (41*600 / 1000) * 0.2448 = 6.02 which confirms the X position of the second chunk 28.32 + 6 = 34.32.
So far so good. We have manually computed the width of the chunk as 600 glyph units, 24.6 untransformed user units or final 6 text units.
We want to get the same correct width from the PXP_TextElement.Offsets. The first chunk Offsets[1] is 2686.9349 and should give the width of the 'a'. I just can not infer any transformation that made the glyph width 600 to become 2686.9349.

Lzcat - Tracker Supp
Site Admin
Posts: 711
Joined: Thu Jun 28, 2007 8:42 am

Re: PXCp_ET_GetElement Offsets do not match the real width

Post by Lzcat - Tracker Supp » Thu Nov 27, 2008 3:00 pm

I am afraid - this is because your pdf does not conform to the PDF specification (object 8, font descriptor does not have the required property Type, see the PDF Reference, sections 5.7 Font Descriptors).

In this case xcpro40 ignores information from the font and uses the default char witdh (for now - incorrect, 65535 instead of 1000).

The Incorrect default width will be fixed in next build (Version 4.x not version3.x) also we will be adding a workarround for such fonts. For now - test with a correct PDF file and all shoudl be well.

HTH
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.

gotomaxx
User
Posts: 2
Joined: Fri Nov 21, 2008 10:48 am

Re: PXCp_ET_GetElement Offsets do not match the real width

Post by gotomaxx » Thu Nov 27, 2008 5:37 pm

Thank you very much, it solved our problem.

John - Tracker Supp
Site Admin
Posts: 8201
Joined: Tue Jun 29, 2004 10:34 am
Location: Vancouver Island - Canada
Contact:

Re: PXCp_ET_GetElement Offsets do not match the real width

Post by John - Tracker Supp » Thu Dec 04, 2008 4:04 am

Excellent :)
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards
Tracker Support
http://www.tracker-software.com

Post Reply