Programmatically adjust size of stamps  SOLVED

PDF-XChange Drivers API (only) V4/V5
This Forum is for the use of Software Developers requiring help and assistance for Tracker Software's PDF-XChange Printer Drivers SDK (only) - VERSION 4 & 5 - Please use the PDF-Tools SDK Forum for Library DLL assistance.

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Vasyl - PDF-XChange, Stefan - PDF-XChange

docu-track99
User
Posts: 518
Joined: Thu Dec 06, 2007 8:13 pm

Programmatically adjust size of stamps

Post by docu-track99 »

Hello,

Is there any way to programmatically adjust the size of stamps to a percentage (say 80%) of their size when placed. The reason we are asking is that a customer has created custom stamps which are only 14x14 pixels but they are still appearing too large for them to place them in in the boxes on their forms. They cannot make them any smaller by reducing pixel count, is there any other way for them to make them smaller.
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2448
Joined: Thu Jun 30, 2005 4:11 pm

Re: Programmatically adjust size of stamps

Post by Vasyl - PDF-XChange »

Its possible by javascript:

Code: Select all

var pn = this.numPages;
for (i = 0; i < pn; i++)
{
    var aa = this.getAnnots(i);
    if (aa.length == 0)
        continue;
    for (j = 0; j < aa.length; j++)
    {
        var a = aa[j];
        if (a.type != "Stamp")
           continue;
        var x = a.rect[0];
        var y = a.rect[1];
        var w = a.rect[2] - x;
        var h = a.rect[3] - y;
        a.rect = [x, y, x + w * 0.8, y + h * 0.8]
    }
}
HTH
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.
docu-track99
User
Posts: 518
Joined: Thu Dec 06, 2007 8:13 pm

Re: Programmatically adjust size of stamps

Post by docu-track99 »

Thank you
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19913
Joined: Mon Jan 12, 2009 8:07 am

Re: Programmatically adjust size of stamps

Post by Stefan - PDF-XChange »

:)