mailDoc

New Here ,
Jun 26, 2022 Jun 26, 2022

Copy link to clipboard

Copied

Is it possible to use mailDoc in a button as mouse UP to send different file via email?

TOPICS
How to , JavaScript , PDF forms

Views

79

Likes

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
LEGEND ,
Jun 27, 2022 Jun 27, 2022

Copy link to clipboard

Copied

Goodness me, no, that would be a very bad security hole indeed.

Likes

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
Adobe Community Professional ,
Jun 27, 2022 Jun 27, 2022

Copy link to clipboard

Copied

It's not possble to use any of the mail functions to do this, but it is possible with a form submit. Unfortunatley for you, the files cannot be emailed directly, but are wrapped in FDF. So in a practical sense it's not doable. 

 

 

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

Likes

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 ,
Jun 27, 2022 Jun 27, 2022

Copy link to clipboard

Copied

Thank you. @Thom Parker would it be possible if both files are opened in two tabs, to copy button field from one file into another with a script and place it on exact same place?It would be two same file only one is flattened.

Likes

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
Adobe Community Professional ,
Jun 27, 2022 Jun 27, 2022

Copy link to clipboard

Copied

By different file, did you mean a PDF file?  That's different than sending an arbitrary file.  So yes, it's possible to use the mailDoc function to send a PDF that is different from the PDF that the script is operating from, but there are some difficulties. 

Mainly, other Open PDF files are not automatically visible to a script in a PDF.   Scripts inside a PDF are "sandboxed" for security. There are two ways for a script in a PDF to get past the security and access another PDF file.

1. Disclose the other file.  This means that the other file contains a script that sets the "disclosed" property of the file when it is opened in Acrobat. So the other file has to be setup ahead of time for this action. If that's not possible, then you need to use the other method.

2. Create a trusted context (script). A trusted scripting context does not have the same security restrictions as a regular document script. Here's an article on the topic.

https://www.pdfscripting.com/public/Trust-and-Privilege-in-Acrobat-Scripts.cfm

 

 

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

Likes

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 ,
Jun 28, 2022 Jun 28, 2022

Copy link to clipboard

Copied

Here is short description of my problem, I set up my file so when I click on a button it print my file (adobe printer) then it's automaticaly saved and opened in new tab, that part is working fine. My problem is I want it to be automaticaly send by email also (the new printed file not the original one). Is that possible?

Likes

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
Adobe Community Professional ,
Jun 28, 2022 Jun 28, 2022

Copy link to clipboard

Copied

LATEST

Yes it is possible.  To do this you'll need to create a folder level trusted function for accessing the newly opened file. 

All open files in Acrobat are listed in the "app.activeDocs" array. However, in a particular script, this array only lists the documents that the scripting context can access, hence the need for a folder level trusted function. There is also an additional complication. From the perspective of the script, it is impossible to know when the newly printed document will be opened in Acrobat.  So there are two possibilities for a solution. Both of which are more on the expert Acrobat programming side. 

 

1. Use a timer interval in the folder level script that checks for a new document appearing in the app.activeDocs array. When the document appears, it gets emailed. 

2. Have the folder level script create a toolbar button that emails the current doc when pushed. You wait for the new document to be opened, then push the button to print it.

 

However, I would question the whole process you've created. I understand you are new to Acrobat and don't know how to create the best process design. For example, why print the document with the Adobe Printer?  To what end? Why not just save the PDF to a new name?  It's so much easier and would avoid all these complications.   In fact, your entire process is better handled as a folder level function executed from a toolbar button. 

 

This article might help:

https://www.pdfscripting.com/public/Automating-Acrobat.cfm

 

 

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

Likes

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