Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google PDF Viewer default fit to width embed

Tags:

html

pdf

embed

When I embed a pdf using google's PDF viewer

<iframe src="https://drive.google.com/viewerng/viewer?embedded=true&url=http://jugglegood.com/out/scot-nery-resume-grand.pdf"  ></iframe>

it defaults to displaying the pdf with a lot of space around it.

enter image description here

Then, I click the + magnify (zoom) button at the bottom of the viewer and it zooms to fit to width.

enter image description here

Is there a way to default using parameters or something to the fit to width zoom version of the embed? I couldn't find an answer, so i even tried using jquery to manually click the zoom button... no dice.

like image 746
Scot Nery Avatar asked Jul 24 '18 07:07

Scot Nery


People also ask

How to make a PDF fit to window width in edge?

"Fit to window width" should be started up as the default page size of an opening PDF in Edge, namely, when a PDF file is opened by Edge, just should be in "Fit to window width" mode, rather than have to click "Fit to window width" button to achieve that state. Because the "Fit to window width" mode can satisfy most demands for reading.

How to embed a PDF document on a website?

First, You have to upload the PDF Document (PDF file) on some server or any file storing service so that the PDF Document is accessible online. Now you can use this html <iframe> code below to embed the PDF document on your website and show it to users / readers using the Google Docs Online viewer.

How to view a PDF or Doc on a web page?

So, if you wanted to view a PDF or DOC on your web page you would use an IFrame and the document (PDF, DOC, etc.) If, for example you have a document called ‘TOP-15-ESSENTIAL-FREE-SOFTWARE.pdf’ the various options to view this document would be:

How to display a PDF in chrome V43?

I am having same issue with chrome v43 (but not in 40/41). Solution: Instead using <embed> tag to display PDF. Use <iframe> with src attribute with PDF rendering URL. If you don't want to disclose your PDF path then give your script path, which will print PDF content with header application/pdf.


1 Answers

here are some ideas:

  1. check your CSS to see if there are any settings for a class, id, iframe - your stylesheet could be telling the browser how to display the PDF on screen.

  2. You can tell the iframe in the HTML to be 100% width. I run into this a lot for Google Maps hosted on a site.

    <iframe src="https://drive.google.com/viewerng/viewer?embedded=true&url=http://jugglegood.com/out/scot-nery-resume-grand.pdf" width="100%" aria-hidden="false" tabindex="0"></iframe>

I keep the aria-hidden [this is for screen readers for people who are blind] and tabindex [keyboard navigation for people with disabilites]. Pleasee see my GitHub WAPS system for website code and design for people with diverse needs.

like image 81
Shellie Lewis Avatar answered Nov 14 '22 19:11

Shellie Lewis