ExpertPDF Run JavaScript only in PDF - javascript

I am using old version of ExpertPDF.
I have web page and I click PDF link.
I have some JavaScript that I only want to run in the PDF window.
How do I check in JavaScript that the script will run in the PDF generated window? I am trying to hide some elements that don't need to show in the PDF.

Related

How to download PDF in chrome viewer using automation script

I have to download PDFs using any automation script, when i click on download PDF button, it opens up in new tab in chrome pdf viewer, manually I can click on Download button and download. But when I try to automate it, I can see the button id 'Download' in Inspect element, but when I use command Document.GetelementbyID('Download').click(), the button or any other icon on screen in not getting identified.
I tried changing the chrome setting to directly download pdf, instead of opening in new tab, but it fails for large PDFs (maybe something wrong with source application). I cannot change browsers.
So is there a way to download pdf from pdf viewer, some key shortcut or some script to retrieve the PDF from chrome temp.

Print PDF.JS without print btn

I can see a pdf.js document in a digital viewer. Is it possible to print it without seeing a print button or the hotkey?
If I print with the browser function of printing, its just that one page, that I see.
I need it without the whole border stuff, just like the pdf and every page, not just what I see.
If I could have access to the original pdf somehow, this would be fine too.
Extension in FFox enabled right click again and then I could print the iframe to pdf

How to open a file directly from msSaveOrOpenBlob?

I am using IE 11 for web development. Now in javascript, I do window.msSaveOrOpenBlob(fileBlob), a pop up shows on the button of the page with save and open option.
Now what I want to achieve is that perform click event on open so the file will be open automatically(without user click open).
Here is the case:
User click a link, it should open the associated file with whatever file reader that can open the file. PDF, will be adobe reader, word document will be opened in microsoft word.
Things still works when I click the open button from pop up. I just want to skip this manual click and do it in the code.
I've seen some webpage does this, but can't figure out myself. Need some help.
As far as I know, we can't control the "open or save" prompt using JavaScript. It is the browser behavior.
As a workaround, to the pdf file, I suggest you could try to use the pdf.js plugin to display the pdf file. To the Office documents, you could check the following article to use the Office Web Viewer to view the document.
Office Web Viewer: View Office documents in a browser
Besides, here is an article about displaying (Show) Word, Excel, PowerPoint (PPT) and PDF files in browser web page in ASP.Net, you can also refer to it.

How do i convert all the data in my webpage to a pdf and download it on the browser?

My task requires me to click a button on the webpage and download the data as a pdf file. Simply printing the webpage wont do as there are certain tabs which are visible only upon selection.The data source is readily available on the pagenameVM.js. I tried using jsPDF but that works only for a certain div in the page.I need to write the all the required data into the pdf and then download it.
Is it possible?

Automatic printing PDF programmatically in IE6

I would like to be able to print a PDF document automatically when a user clicks on a print button. Currently what the way I am doing it is I render the PDF and save to the server disk and have it appear in an iframe then I tried to print the content of the iframe using javascript:print(). however what is printed is an empty html page.
I am doing this because using the norm HTML print is wrecking the layout of the webpage i am trying to print. so i'm rendering the page to a pdf format to print the webpage. i don't want the users to be able to save the pdf hence i am trying to slient print the pdf page. hence i am loading it in an iframe by changing the src in the code behind and re-rendering the page and then triggering the js script.
function printPDF(){
document.iframe_printArea.focus();
document.iframe_printArea.print();
}
I am wondering if it is possible to print a pdf document loaded in an iframe using print() or whether this is even possible. I have extensively googled on this and have yet to come up with any solutions that works for a web application. Most of the resources are devoted to C# windows app. The platform I am using is .NET C#.
First of all I'm very sorry for whom that have to deal with IE6.
There is an non-standard DOM event developed by Microsoft that fire before print. It's onbeforeprint event (docs). What you can do is hiding everything but the iframe and shrink the iframe to the window size before print. and after print reverse the document to normal statues with onafterprint event.
function window.onbeforeprint()
{
// hide other elements and shrink the iframe
}
function window.onafterprint()
{
// unde what heppened onbeforeprint
}

Categories