How to write in dynamic stamps

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

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

Post Reply
Haemte
User
Posts: 1
Joined: Thu Oct 26, 2017 2:34 pm

How to write in dynamic stamps

Post by Haemte »

Hi XChange community,

I want to use dynamic stamps with editable fields. So I added a text field to my stamp in the edit-mode. The automated field like 'current date' work perfectly with java script.

Now, I want to create a text field the user can (or better must) fill on his own by using a simple STRING (e.g. 'source of the document'). In the best case the stamp would pop up after it is added to a document.

Is this even possible? It seems like it does not matter which property I change - the stamp keeps uneditable.

Thank You!
Haemte
User avatar
Patrick-Tracker Supp
Site Admin
Posts: 1645
Joined: Thu Mar 27, 2014 6:14 pm
Location: Vancouver Island
Contact:

Re: How to write in dynamic stamps

Post by Patrick-Tracker Supp »

Hello Haemte,

Thank you for the post. I am afraid that it is not possible. Once the stamp is applied, the text fields are no longer form fields. The Date insertion works because it is auto-evaluated before the stamp is committed.

Cheers!
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.

Cheers,

Patrick Charest
Tracker Support North America
snarf2000
User
Posts: 4
Joined: Fri Dec 15, 2017 10:27 am
Contact:

Re: How to write in dynamic stamps

Post by snarf2000 »

Hello.

You can add text to your stamp before it is applyed to your document.
See the attachement.
stamp preview.JPG
Kindly regards
Frans
User avatar
Paul - Tracker Supp
Site Admin
Posts: 6897
Joined: Wed Mar 25, 2009 10:37 pm
Location: Chemainus, Canada
Contact:

Re: How to write in dynamic stamps

Post by Paul - Tracker Supp »

Thanks Frans - very cool!

Haemte, you will need to know some JavaScript to do this yourself:
https://www.pdfscripting.com/public/Fre ... cfm#Stamps
https://www.pdfscripting.com/public/All ... Stamps.cfm

I hope that helps.
Best regards

Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com
stafford
User
Posts: 1
Joined: Wed Jan 10, 2018 8:17 pm

Re: How to write in dynamic stamps

Post by stafford »

Frans,

can you send my the script voor a random text field. not sure what the stampname is. is that the file name of the stamp?


var cAsk = "Enter Exhibit Number" ;
var cTitle = "Exhibit Number: ";
if(event.source.forReal && (event.source.stampName == "#NeBeYUvp04_DiMyVZWil5D"))
{
var cMsg = app.response(cAsk, cTitle);
event.value = cMsg;
event.source.source.info.exhibit = cMsg;
}

gr Ralf
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3549
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada
Contact:

Re: How to write in dynamic stamps

Post by Ivan - Tracker Software »

Every stamp has a unique ID (this ID is automatically generated when a new stamp is added into a collection).

this code

Code: Select all

if(event.source.forReal && (event.source.stampName == "#NeBeYUvp04_DiMyVZWil5D"))
ensures that the UI is shown when:
a) stamps is being placed on a document (checking event.source.forReal property), but not just displaying in stamps palette;
b) it ensures that exactly required stamp is being placed, checking an ID of the stamp. That's required because dynamic stamps utilize form calculation event to update fields content, and that event is fired for all fields, but we have to show UI only when our field is being placed.
can you send my the script voor a random text field.
You will have to define your dialog and show it. Please referer to PDF JS documentation to find out more information about dialogs in JS.
Here is small sample that shows a dialog with one custom text box:

Code: Select all

f(event.source.forReal && (event.source.stampName == "#NeBeYUvp04_DiMyVZWil5D"))
{
// Dialog Definition 
var oDlg = {
    strName: "", initialize: function(dialog) {
        dialog.load({"usnm":this.strName});
    },
    commit: function(dialog) {
        var data = dialog.store(); 
        this.strName = data[ "usnm"]; 
    },
    description: {
        name: "Test Dialog", elements: [ {
            type: "view", elements: [
                { name: "Enter your name:", type: "static_text", },
                { item_id: "usnm", type: "edit_text", char_width: 15 },
                { type: "ok_cancel", },
            ]
        } ]
    }
};
// Dialog Activation
var cMsg = "Sample init value";
oDlg.strName = cMsg; 
if( "ok" == app.execDialog(oDlg))
{
   cMsg = oDlg.strName;
}
event.value = cMsg;
event.source.source.info.exhibit = cMsg;
}
HTH
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.
Post Reply