I am using Aspose PDF to add a PrintDialog NamedAction as the OpenAction of a generated PDF like so:
var printAction = new NamedAction(PredefinedAction.PrintDialog);
PdfDoc.OpenAction = printAction;
However, the action of launching the print dialog is never fired when this PDF is opened in FireFox, because the action exists as JavaScript within the PDF file. Within the PDF I have found:
In FireFox’s pdf.js viewer, JavaScript is blocked from running and so the print dialog is never launched (the same is probably true for other pdf readers).
Is it possible to replace how the PrintDialog NamedAction is handled behind the scenes, from JavaScript to a real Adobe named action?
For example:
56 0 obj
<</Type/Action/S/Named/N/Print>>
endobj
This would allow the action to actually be fired in affected pdf viewers.
You can add JavaScript against page action. In order to accomplish this requirement, PageActionCollection is implemented. This class has properties:
public PdfAction OnOpen
public PdfAction OnClose
You may use following code snippet to accomplish your task.
C#
JavascriptAction javascript = new JavascriptAction(“this.print({bUI:true,bSilent:false,bShrinkToFit:true});”); pdf.OpenAction = javascript;
Moreover, I have tested the scenario with above code and have observed print Dialogue does not appear in Firefox browser. For the sake of correction, I have logged a ticket PDFNET-42481 in our issue tracking system. We will further look into the details of this issue and will keep you updated regarding the resolution of this issue within this forum thread. Please be patient and spare us a little time.
If you still face any issue or your requirement is different as per my understanding, please feel free to contact us.
We would like to share with you that earlier logged issue is currently under investigation process and we are working over resolving the logged ticket. As soon as we have some definite updates regarding its resolution, we will let you know. Please spare us little time.
Hi, any update on this issue? We are experiencing this issue with Edge browser as well and works when JavaScript is replaced with Adobe name action, similar to what was suggested in original post. A solution for this is greatly appreciated. Thanks!
Please note that the issue priority is already high and its under process of investigation. However, the issue is quite complex in nature and need more time to get investigated. We have recorded your concerns as well and will definitely consider them during investigation. As soon as some definite updates are available, we will share with you. Please spare us little time.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.