How do I set view/zoom level of an embed PDF? - javascript

I am trying to set the view of an embed PDF. I want it so that when the user clicks and opens the PDF in their browser, the view mode is already set to page width instead of the default automatic zoom.
I have looked at this pdf: http://www.heinelt.info/pdf/PDFOpenParameters.pdf for help.
Adding
#view=FitH
At the end of the url is what the pdf says to do, but that doesnt work, although things like page jumping ( #page=3 ) do.
Here is how I have my pdf linked
<a href="javascript:loadPDF('http://www.pdfpdf.com/samples/Sample3.PDF#view=FitH');"
The " javascript:loadPDF " before the link is for embedding the PDF, so that the pdf opens inside the same page. (So the PDF doesnt navigate away from the page or open in a new pdf.)
Help? Am I using the #view=FitH wrong?

Related

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

Can I display a popup over a CFDOCUMENT page?

Here's what I'd like to do in Coldfusion:
On a webpage there is a "Download" href link and I want another browser tab to open when the user clicks this link. In the new tab, I am creating a PDF via CFDOCUMENT in Coldfusion. This in of itself works.
However, since the PDF has a delay before it loads in the tab, I want to display a popup to the user that the PDF may take a few moments to load.
So what I tried to do was this sequence:
User clicks "Download" ->
On the same page, I trapped the link with jquery and displayed a popup
window alerting the user there may be a delay ->
User clicks OK on the popup ->
Using javascript window.open, redirected to a new browser window for the PDF.
This was unsuccessful because using window.open in javascript is not trusted by browsers and the new tab doesn't show up because of popup blockers.
So then I thought I'd create a popup in the new browser tab instead before the PDF loads, but discovered I can't use javascript on a page with CFDOCUMENT.
Any ideas as to how to best accomplish this if anything can be done?
I think iframe might be your friend here. It allows you to display another document in the pdf page.
Using your example in the comment, I created two files: one to display the prompt message and one to display the PDF.
cfprompt.cfm
<body>
<div> this is a test </div>
</body>
<cfflush>
<iframe src="pdf.cfm" >
</iframe>
pdf.cfm
<cfdocument format="pdf">
<h1>Hello ColdFusion</h1>
<p>This is <strong>PDF</strong> example document.</p>
<p>Genereated at: <cfoutput>#TimeFormat(Now())# on #DateFormat(Now())#</cfoutput></p>
</cfdocument>
You're still going to have to play with the formatting/sizing of the iframe so that it displays correctly, but hopefully this allows you to display the PDF.

I want Google Docs embeddable PDF viewer not to display "open external" link

I am making a pdf viewer using google doc viewer. I am facing an issue. I don't want the user to download the pdf. If user clicks open external button, an external application is opened and pdf can be viewed. I don't want that button. What can I do?
Please see the attached image.
Add rm=minimal to the URL and you will scale of features from your viewer.
Here is an example with rm=minimal in the URL:
https://docs.google.com/spreadsheets/d/1byEvnxDkjQ49GNqRldHJyBrptlibFVItO_eneLypWic/edit?rm=minimal#gid=0
And here is an example without rm=minimal in the URL:
https://docs.google.com/spreadsheets/d/1byEvnxDkjQ49GNqRldHJyBrptlibFVItO_eneLypWic/edit#gid=0
I think that what you can´t remove with rm=minimal can´t be removed unfortunately.
Update
If rm-minimal can´t scale of what you want you could try to remove the element by jQuery with:
$(".ndfHFb-c4YZDc-Wrql6b-SmKAyb").remove(); or by CSS: .css('display','none')

I needed to Hide the 'Open in New Window' button from the google viewer while i open my page using Iframe

I needed to Hide the 'Open in New Window' button from the google viewer while i open my page using Iframe. (Button as extreme right side on top)
for ex.
https://docs.google.com/gview?url=http://infolab.stanford.edu/pub/papers/google.pdf&embedded=true
actualy I dont want user to download the actual pdf file.
Isthere any way to acheive this?
Many Thanks in advance
If that's the sample URL that you're opening from YOUR site in iframe (in other words, if you're framing a page from external site), there is NO way to do what you want. It will NOT be possible to access that frame's content from your page (security issues).
Google controls the content on their site, and there's nothing you can do beyond hosting your PDF's somewhere else and controlling the file-download (you still won't be able to show PDF content and prevent the user from copying it to their disk).
I wonder what your concern/reason is for preventing the user from saving the file to their disk...
It's very simple! just click on OPEN IN NEW WINDOW and in the new windows click on file and click of "prevent viewers from downloading". You must logged on your google account.
Copy and paste this line of code into your address bar and hit enter:
javascript:function a() {document.getElementById('openInViewerButtonIcon').style.display = 'none';} a();
It hides the button via JavaScript, setting the display css attribute to none. You could try to load the page in a Frame, making it possible to inject your on javascript.

Trigger click on embedded PDF

I have a PDF embedded in a web page using the following code:
<object id="pdfviewer" data='test_full.pdf#page=1&toolbar=0&statusbar=0&messages=0&navpanes=0'
type='application/pdf'
width='500px'
height='350px'>
The PDF itself is set to open in full screen mode which shows no controls. The user can advance the slides by clicking on the view.
What I'd like to have is some way to trigger that click so that I can advance 2 similar PDF:s side-by-side (one for the actual slideshow and one for the speaker notes). Is this possible to do in javascript and/or jQuery? I have tried using the click()-method but it doesn't get through to the embedded PDF.
Update: Can't find any info on it, so I guess I'm out of luck and have to try a workaround. Am currently juggling 3 embeds of the same pdf (current page, next page and previous page), hiding and showing them and loading more pages as the user clicks around.
I doubt it. Allowing web page scripts to pass input events to the PDF viewer could be a security risk (since the viewer generally has access to system file dialogues via things like Save As).

Categories