• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Dialog box with event button?

New Here ,
Feb 09, 2018 Feb 09, 2018

Copy link to clipboard

Copied

I need to create an interactive dialog box that allows the user to select an image to be loaded as an icon into the stamp just before placement. Is this possible? Or can this be accomplished without a dialog box?

TOPICS
Acrobat SDK and JavaScript

Views

396

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 09, 2018 Feb 09, 2018

Copy link to clipboard

Copied

If you want a dialog, here's a tool for creating them

ACRODIALOGS OVERVIEW

However, the only way you are going to load an icon into a dynamic stamp is with a button field on the stamp. To do this all you really need is this code in your stamp script

this.getField("ImageButton").buttonImportIcon();

Of course you'll need to replace "ImageButton" with the name of your button field

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 09, 2018 Feb 09, 2018

Copy link to clipboard

Copied

So, when I have the button field loaded into the stamp, it only allows me to trigger the button event while I’m editing the stamp. The goal was to have it so that the stamp doesnt need to be edited every single time we need to update the icon. Is there a way to make that work or is the editing the Stamp the only way to do this?

Thanks for the the quick response.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 09, 2018 Feb 09, 2018

Copy link to clipboard

Copied

Well ok, it's a little more complicated than I said.   The import icon function will only work from a privileged context in a stamp.  It's been a while since I've done this

So to do this you have to create a folder level function for loading the button icon with this function, then call that function from the stamp script.

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 09, 2018 Feb 09, 2018

Copy link to clipboard

Copied

Actually, going back and looking at work I've done in the past, its more complicated than I thought. The import icon functions don't work well in the stamp context, unless you already have the path. There might be a way around this. I'll get back to you.

You'll find more info about stamps here: PDF Stamp Annotations

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 09, 2018 Feb 09, 2018

Copy link to clipboard

Copied

LATEST

So there is a solution to importing an image into a stamp. The "field.buttonImportIcon" function only works when the image file path is known. So the trick is to know the file path

Allowing the user to perform a general search for an icon is an advanced task and beyond the scope of this forum. If your interested in a custom solution, then this is what I do. Send me a message from my user page on this forum.

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines