Q: I am trying to create a stamp prompting user for input, how can I create such stamp in PDF Studio?
A: PDF Studio 2022 and over allows you to create your own “fillable PDF stamps” or “dynamic PDF stamps”. This will be done by creating your own PDF Stamp where the PDF is a PDF form that contains interactive form fields. Users will be prompted for data when placing the PDF stamps on the page, assuming the form fields in the PDF stamp contain appropriate correct JavaScript calculation.
Sample #1: Below is an example of a PDF stamp that will prompt users to enter data whenever placed on a PDF page:
1) Create a new PDF form
-
-
- Click on Form in the Ribbon Toolbar
- Create a text form field called Text1
- Right click on Text1 and select Properties
- Select Calculate tab and click “This field has a custom calculation” option
- Copy and paste the following code:
var cAsk = "Please enter a name";
var cTitle = "Document State For Stamp";
var cMsg = app.response(cAsk, cTitle);
event.value = cMsg;
- Select OK and select Yes on JavaScript prompt screen
- Create another text form field called Text2
- Right click on Text1 and select Properties
- Select Calculate tab and click “This field has a custom calculation” option
- Copy and paste the following code:
var cAsk = "Please Enter Date";
var cTitle = "Date";
var today = new Date();
var monthname = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
var dd = String(today.getDate()).padStart(2, '0');
var mm =today.getMonth();
var mmmm = monthname [mm];
var yyyy = today.getFullYear();
var cDefault = dd + ' ' + mmmm + ' ' + yyyy;
var cMsg = app.response(cAsk, cTitle, cDefault);
event.value = cMsg;- Make sure to resize your document to the size of your stamp to avoid large empty area when placing stamp.
- Save the document called “sample stamp.pdf”
-
2) Create a PDF stamp
- Go to the Comments Tab > Create > Create PDF Stamp from the menu
- Under Browse section, click “…” to select the document created above “sample stamp.pdf”
- Set the other options and select OK
3) Place your PDF Stamp
- Start placing the pdf stamp on your document and system date will be prefilled or you can enter a custom date, click OK
- Enter a value for your Text field. for example: we entered “Qoppa Software”
- Select OK and it will update Text field’s value.
Sample #2: Below is an example of a PDF stamp that will prompt users to enter the name of the checkbox they wanted to check on a PDF page:
1) Create a new PDF form
-
- Click on Form in the Ribbon Toolbar
- Create a text form field called Text1 and three checkboxes called CB1, CB2, CB3
- Right click on Text1 and select Properties
- Select Calculate tab and click “This field has a custom calculation” option
- Copy and paste the following code:
var cAsk = "Which checkboxes to check CB1, CB2, CB3";
var cTitle = "Enter name of checkbox";
var cMsg = app.response(cAsk, cTitle);
event.value = cMsg;
if (event.value.toString()=="CB1")
{
this.getField("CB1").value = "Yes";
}
if (event.value.toString()=="CB2")
{
this.getField("CB2").value = "Yes";
}
if (event.value.toString()=="CB3")
{
this.getField("CB3").value = "Yes";
}
Select OK and select Yes on JavaScript prompt screen - Make sure to resize your document to the size of your stamp to avoid large empty area when placing stamp.
- Save the document called “pdf stamp.pdf”
Repeat step2 and step3 from the Sample #1 above