Google Chrome PDF print viewer - php

I have a PDF which is generate via TCPDF on the server side.
When opened in any browser it looks and acts fine, but when opened in Google Chrome - it looks fine but Googles PDF print viewer displays the PDF with about 100px top offset.
And prints it out with that offset...
When I switch the browsers plugins to force using Adobe tools for printing, it looks fine.
What could be the issue?
Tnx!

For future notice, yes there is a documented bug about this in Chrome - BUT it might also help to turn of the "Fit to page" option the print popup window.

Related

Display pdf generated using mpdf inline in mobile browsers

Is there any way to display pdf generated using mpdf inline in mobile browsers?
I went through mpdf documentation and tried destination option mpdf->output('filename.pdf','I'). It works pretty well across every browser in desktop except IE and doesn't work in mobile-browsers like Firefox, Chrome etc. It starts downloading automatically instead of displaying inline in IE in desktop and all mobile browsers.
Anyways to handle this?
I stumbled upon this StackOverflow post. You can also try Google embeddable PDF Viewer
As per the blog:
Google Docs offers an undocumented feature that lets you embed PDF files and PowerPoint presentations in a web page. The files don't have to be uploaded to Google Docs, but they need to be available online.
based on documentation :
I: send the file inline to the browser. The plug-in is used if available. The name given by $filename is used when one selects the “Save as” option on the link generating the PDF.
You need plug-in installed on your browser to embed the PDF document (Desktop and Mobile). If your browser doesn't has PDF Viewer plug-in, PDF document will be downloaded automatically.
You can use Javascript plugin such as pdfJs to embed your PDF document in cross browsers.

How to direct the generated PDF to download instead of preview?

I am successfully generating a PDF by using fpdf and fpdi libraries. The problem is that *$pdf->Output(); line opens the pdf for preview whereas I have been asked to let it download by default. Though I can change my own browsers' settings to force to download but i can not force the users of the page to do those settings. I can show my code if required. Please help!
Thanks,
baburman
Ok. I figured out.
Just provide parameters to output method like this:
$pdf->Output("filenametodownload.pdf", 'D');
It works for chrome, firefox, internet explorer and safari.

JavaScript to check computer for a specific browser

In my web site i have this thing it loads a different page if you are in IE
I loads the no_support.html, and on the no support page i have text saying try one of the two browsers bellow, and bellow i have two images one of google chrome and the other of mozilla firefox, and when you click on any one of them they go to the download page of that browser.
I was wondering is there some trick i can put in the no support page that when for example i open it in IE and this page says try one of the browsers bellow and i click on Google chrome and if i have google chrome installed on my PC it opens my website (supported) with google chrome and if i dont have it then it goes to the download page.
Nope, you can't open a browser on a users computer like that, as that would be a major security issue, and really annoying.

Facebook Open Graph images not displaying in Chrome; Displaying in Firefox fine

After wrestling with Facebook's new Open Graph/SDK, I've noticed the images I retrieve with no problem in Firefox are not displaying at all in Chrome.
Example:
When the following tag is rendered on a webpage
<img src="http://graph.facebook.com/angrybirds/picture">
Firefox displays it with no problem while Chrome displays nothing.
Is this a scripting error on my end or is this something that I need to work around to accommodate for Chrome?
PHP 5
Firefox 7.0.1
Google Chrome 14.0.835.202
This seems to be a local caching problem, the link is working wonderful for me in chrome.
Please provide us a little more of you code if still got problems like this after clearing your cache.
Are you sure it is not a cache problem?

How to embed PDFs that work in all web and mobile browsers

My client asked me to create a page which contains PDF. I used Embed, Iframe tags, it worked in Mozilla but did not work in IE and Mobile browser.
I know that all browsers will read .pdf directly but I want it to be embed.
Is there any way?
Please help me..
If you give a link to the PDF on the web page, any browser will be able to download the file and then the user can open it in a PDF viewer of his choice.
If you want to embed the PDF document in a web page, then the browser needs to have a PDF plugin installed. This may not be the case with all browsers. The PDF will be displayed only if the PDF viewer application's plugin is registered with the browser.
The other way of embedding the PDF document is to use a server-side component that renders the PDF as ordinary HTML web page elements. Google has an embeddable PDF viewer.
Google Docs offers an
undocumented feature that lets you
embed PDF files and PowerPoint
presentations in a web page. The files
don't have to be uploaded to Google
Docs, but they need to be available
online.
You can also use Mozilla's pdf renderer written in javascript. It is rather complex getting started, but all options are there. It is the pdf reader available in Firefox and extensions exist for other browsers. Fun fact: It is by far the most starred library on github when searching for pdf.
Try using adobe pdf api, i found is very easy and compatible with all browsers.
https://www.adobe.io/apis/documentcloud/dcsdk/pdf-embed.html

Categories