Duplicate Security Warning In Adobe PDF - javascript

My object is to automatically open a URL whenever a user opens a PDF inside Adobe Acrobat. I am using PyPDF2 to inject javascript inside the PDF only once
addJS('app.launchURL(URL,true);')
It's working fine but the issue is that is am getting security warnings twice .
I want this message to appear only once but we don't recommend users to select Remember this action for the site as the URL will be dynamic for every user.

Related

Acrobat JS : Open another PDF and Navigate to Specific Page

I am trying to open another "Attached" PDF file and navigate to a specific page number using Acrobat JS.
Looking through the JS developer guide by Adobe Acrobat, I came across the following script which successfully opens the file, but only to the first page.
this.exportDataObject({ cName: 'Attached_File.pdf' , nLaunch: 2 });
How can I modify the script to go to a specific page number in the attached file?

Why does this URL do different things depending on how it's activated?

In a related post (here) I discuss a problem I'm having with a URL action in a SQL Server Reporting Services report. I thought I had solved the problem, but I now realize that I haven't. (I'll update the related post in due course.)
I'm generating a URL using string concatenation, and using Javascript so the URL opens in a new browser tab. Here's the code that generates the URL, which I think is pretty standard:
="javascript:void(window.open('http://www.ic.gc.ca/app/opic-cipo/trdmrks/srch/viewTrademark?id="
+ Fields!applicationNoWithExtn.Value
+ "&lang=eng&tab=reg','_blank'))"
And here's an example of the URL that's generated when a value is inserted:
http://www.ic.gc.ca/app/opic-cipo/trdmrks/srch/viewTrademark?id=159511-00&lang=eng&tab=reg
The generated URL works. It takes you to an online database web page for a Canadian trademark having application number 159511-00 (you don't see the "-00" suffix on the web page, but it's the correct application number).
The problem is that when the user clicks the generated URL, the browser's print dialog opens immediately after the web page opens. That's very distracting; the user has to click Cancel to dismiss the print dialog. If the web page is reloaded or refreshed within the browser, the browser's print dialog opens again. However, if I copy the URL and paste it into a new browser tab, I get the desired web page without the print dialog. I don't get it; it's the identical URL, but the version of the URL generated by my application somehow triggers the print dialog, whereas a copy/pasted version of the identical URL doesn't. I've tried different browsers (Chrome, Edge and IE) and different machines, but I keep getting that print dialog when I click the URL generated by my application. If I change the code to generate a standard URL like http://google.com the generated standard URL works without triggering the print dialog. So the problem seems to be with the particular web site that I am accessing via the concatenated URLs shown above.
Can anyone explain what's going on and how I can suppress that print dialog?

Get Firefox PDF viewer information

I have a web application written in c# that shows pdf documents.
What I do is when a user click a document, I open a new browser tab and show the pdf.
Everything works fine but in Firefox i have a boring problem.
If the PDF viewing option is set to 'Preview in Firefox' goes fine, otherwise the browser downloads the aspx page where the document should be shown.
Is it possible via javascript or c# code know what option is set and so manage the situation in a proper way?

Show error information in web form while generating document

I have an ASP.NET web page that is called from JavaScript using:
window.open( url, '_self', ...
This ASP.NET page generates on the fly an Excel worksheet so the browser starts downloading it and then opens Excel when it is finished without leaving the caller web page (the one with the JavaScript function).
Now I want to handle all posible errors that might happen while generating the Excel document, catching the exceptions in ASP.NET and showing some error information in a JavaScript alert dialogbox.
I have tried adding in the catch block the following:
Response.Write("<script>alert('Error while generating Excel
> worksheet');</script>");
but after accepting the alert window, the browser remains in a blank page. In that situation, I would like to close the alert and remain in the calling web page in the same state as it was when it called the Excel generation ASP.NET page through JavaScript. I have tried using history.back() but this reloads the web page losing all changes the user might have done previuosly there.

How to fetch javascript heavy pages from chrome extension

I am developing an extension that fetches pages that the user is likely to access on a website. My extension uses jQuery.get() to fetch a page. This works correctly for a site like amazon.com.
But if the user logs in to gmail and I try to fetch some other pages like "account settings", I get an incomplete page. Somewhere in that page, I get the message:
"Your browser does not support Javascript or Javascript has been disabled.As your browser does not support Javascript or has Javascript disabled, we are not able to display the requested page."
Is there some way to fetch complete page in such cases?
I ended up opening a new tab and fetching the page in that tab. Then using content script, I analyze the page data. Sure this is a problem in the sense that a user will see newly opened tab. But then it is also transparent to the user.
If you are developing an extension on Firefox using Jetpack, you can use page-worker which is an invisible page and gives access to the DOM.

Categories