Stamp not placed correctly  SOLVED

PDF-XChange Editor SDK for Developers

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

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
DeKo
User
Posts: 56
Joined: Thu Sep 28, 2017 9:45 am

Stamp not placed correctly

Post by DeKo »

Hello all!

I have a somewhat weird behavior with stamps. The notable method which returns the rectangle in which the stamp should be placed is:

Code: Select all

        private PXC_Rect GetRectByPoint(int breite, int hoehe, int x, int y, uint pageNum) // breite = width, hoehe = height
        {
            IPXC_Page page = pdfCtl.Doc.CoreDoc.Pages[pageNum];

            var rect = page.get_Box(PXC_BoxType.PBox_PageBox);

            PXC_Rect pRect2 = new PXC_Rect
            {
                bottom = y - (hoehe),
                left = x,
                right = (breite),
                top = y
            };

            return pRect2;
        }
The only call of that method is the following:

Code: Select all

stampRect = GetRectByPoint(stempel.Width, stempel.Height, 5, Convert.ToInt32(pageHeight) - 5, pageNum);
The stempel variable is a wrapper for my custom stamp, which basically just represents a image of the stamp. With this rectangle i always place the stamp in the top left corner and up until now i never had problems. Now one of our customers scanned an empty page and tried to stamp it with our software. Stamping was succsesfull, but it placed it in the bottom left corner and the stamp is turned by 90°. It seems like the the pdf is treated as if it is turned by 90°, but the viewer shows it like a normal paper.

Am i assuming it correclty? If yes, can i somehow make the pdf control treat the paper as if its in the usual alignment?

Thanks in advance!

Greetings,
Dennis
Attachments
20180808154822321.pdf
(321.19 KiB) Downloaded 64 times
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Stamp not placed correctly  SOLVED

Post by Sasha - Tracker Dev Team »

Hello Dennis,

The page itself is rotated 270 degrees, thus the stamp is placed that way. You should take the pages rotation into an account when calculating the rectangle. Also, you should rotate the stamp itself by changing the rotation of the annotation data.
We have a sample like that (6.1.) in the CoreAPIDemo application that you can download from here:
https://github.com/tracker-software/PDFCoreSDKExamples

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
DeKo
User
Posts: 56
Joined: Thu Sep 28, 2017 9:45 am

Re: Stamp not placed correctly

Post by DeKo »

Hello Alex,

thank you! I forgot about that sample, im sorry! Will look into that. As most of your examples are on point, im sure i will find my answer there. If something comes up, i will come back to you :)

Greetings,
Dennis
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Stamp not placed correctly

Post by Sasha - Tracker Dev Team »

:)
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply