How to customize the default scrollbar on the pdf document? - html

How can I customize the default scrollbar that browser shows on pdf file?
<object data="/pdf/sample.pdf" type="application/pdf" width="100%" height="100%">
<p><b>Example fallback content</b>: This browser does not support PDFs. Please download the PDF to view it: Download PDF.</p>
</object>

It is unclear which scroll bar you're talking about. Is it part of the browser or part of the PDF viewer? More importantly: Which browser and viewer are you using?
Suppose you're using Adobe's PDF viewer, then you can add an argument to the url like this:
data="/pdf/sample.pdf?scrollbar=0"
See: http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/pdf_open_parameters.pdf
This can however have no effect when using other pdf viewers. More so, the scroll bars are often there for a good reason.
Activating touch mode can also remove the scroll bar in some viewers.
Basically you don't have much control over this.
Your real question is about customization. This could mean a lot of things, for instance making the scroll bar wider, changing its color, etc. Clearly this cannot be easily done when the scroll bar is part of the viewer.
Lastly, the message; 'This browser does not support PDFs.', is not entirely accurate. It will also be shown if the PDF file doesn't exist.
EDIT:
This works to get rid of the extra scroll bar in Chrome:
<html>
<body style="overflow:hidden;margin:0">
<object data="sample.pdf" type="application/pdf" width="100%" height="100%">
<p>Error!</p>
</object>
</body>
</html>

Related

I canĀ“t show PDFs correctly in Microsoft Edge ussing iframe

I have problem using Microsft Edge for view PDF files with HTML. In my webpage, i use iframe tags and the src attribute with file path.
The images are shown smoller than the iframe and with random size, and add a scrollbar. (Not happen when i use Chrome, Safari or Firefox).
Simplified code:
<div id="contenedor">
<div>
<iframe id="pdf1" src="pdfs\Prueba1.pdf#toolbar=0&navpanes=0&scrollbar=0&statusbar=0&messages=0&view=fitV" frameborder="0" class="frame"></iframe>
</div>
<div>
<iframe id="pdf2" src="pdfs\Prueba2.pdf#toolbar=0&navpanes=0&scrollbar=0&statusbar=0&messages=0&view=fitV" frameborder="0" class="frame"></iframe>
</div>
<div>
<iframe id="pdf3" src="pdfs\Prueba3.pdf#toolbar=0&navpanes=0&scrollbar=0&statusbar=0&messages=0&view=fitV" frameborder="0" class="frame"></iframe>
</div>
</div>
I attach image of the visualization examples.
smoller than the iframe and scrollbar
random size and scrollbar
My doubt are if the parameters that i add to the src are corret for obtain the fit of the iframe to have the same size for all and not have visible scrollbar.
I will be very grateful.
Disable the following flag: edge://flags/#edge-smooth-scrolling-enabled-pdf
Note: Make sure you update the latest version of Microsoft Edge.
The server cannot control the browser it can only offer "recommendations" such as "download" or "download and view", it is the client decides on preferences and media actions.
those Acrobat settings for scrollbars etc are only for Acrobat or PDF viewers that respect them.
So exactly same as a PDF reader does not have to respect NO COPY, simply adding Bad Arguments to an iFrame can be ignored.
Currently this is the best way to send recommendations to Edge.
You may wonder why the first two do not both FitV
and the answer is I as client chose my screen to be 66% thus the image is 66% of FitV.
So why then does the first one keep at FitV ?, its because there are more pages.
And why is the last one a Fit is because the frame is 25% of the page fit.

When embedding a pdf, page no longer scrolls

<object data="NAME.pdf" type="application/pdf" width="100%" height="1200px">
<p>Alternative textMy CV</p>
</object>
So let's say I embed my pdf into my page like this, so that the entire page is the pdf document. EXAMPLE
The issue I get is that when you scroll inside the object (pdf), it only scrolls the object, so when it's full screen nothing happens. I would like the user to be able to scroll the site, not the pdf.
Also is there a way to change the object pdf background color?
Thanks for the help, there doesn't seem to be much documentation on this. If you have any other suggestions on integrating a full-page pdf please let me know. I am using pure HTML/CSS.

Scale PDF page sizes with screen using <object> tag

I am currently doing so like this:
<div class='embed-responsive' style='padding-bottom:150%'>
<object data="../pdf/Invoice_file.pdf" type="application/pdf" width="95%" height="800px"
style="display: block; margin: 0 auto;" />
<p>Not supported by browser.</p>
</object>
</div>
I looked at the other solutions on here but none of them worked. If possible I'd like to scale the PDF page size as the screen gets smaller. Any ideas would be appreciated, thanks!
Unless your PDF of choice has a JS interface, you may find you can't achieve what you want. Why not - well I just opened a PDF file in Chrome and resides the browser window. The PDF page in view did not scale - so I conclude that Chrome's PDF viewer is coded to re-center the page on viewport dimension changes but not to scale the page.
I your PDF viewer of choice provides a JS interface, then you probably can do it.
Problems will no doubt occur if you cannot dictate the PDF viewer your users will choose.

Reset PDF Settings and View back to default in IE 11

I currently open a pdf in an iframe. The iframe is hidden and whenever the user hits the button, the iframe loads the pdf source. When the window closes, it removes the source.
The problem that I have is that when a person views the iframe, messes with the zoom and pages, then closes down the iframe, the next person is stuck with the work that the other person was doing. Is there a way I can reset a pdf back to the default zoom, page, orientation, etc?
I've been doing some testing and it seems that adobe has a cache that will cache the settings until the browser closes down. An example is go to
http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/pdf_open_parameters.pdf
Mess with the zoom and pages, go to a different web page, and when you go back to that url, you'll see it's the exact same as you left it. I assume that there is a setting that I have to set in adobe reader. I've also tried setting defaults with parameters, but that doesn't seem to be working.
This is for internet explorer 11.
Additional Info
this is for a kiosk system that is running IE11 in Kiosk mode. The shell has been replaced by ie, and it's set to load the site with the hidden iframe. The system is running Adobe Reader X 11.0 and I'm using the following to embed:
<object id="pdf" data="kill-charts.pdf" style="display: none;" width="100%" height="100%" type="application/pdf">
</object>
I've tried embed as well, but it doesn't make a difference. I swapped to object because I wanted to try with parameters. I tried this
<object id="pdf" data="kill-charts.pdf" style="display: none;" width="100%" height="100%" type="application/pdf">
<param name="zoom" value="100" />
</object>
but that didn't work after the second load.
If you look on the last page of the link you provided you will see that you can append #zoom=50 to the URL as follows:
http://example.org/doc.pdf#zoom=50
This will make the browser open it at 50% every time. You can also add other parameters as well such as page number:
http://example.org/doc.pdf#page=1&zoom=50
This method will work at least for the Adobe plug-in, but not guaranteed for other PDF plug-ins.

Is there a way to programmatically scroll to a PDF page within a Ipad Safari?

I'm current trying to display a pdf inside an iframe
<iframe id="iFrame" height="583px" width="785px" src="pdf/test.pdf" scrolling="yes" ></iframe>
after i test on ipad, i found out that it cannot be scroll. is there any solution to this?
Thanks.
I would highly suggest using Scribd's service, it even let's you restrict user downloads if that is a concern.
If you place two fingers on the text in the pdf, you can scroll that text instead of the whole page.