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.
Related
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.
I have been trying to display a data access policy(URL PDF file) in my tool and initially tried implementing it using the lighbox feature. It did not work for my PDF URL file but it did work for some other test PDF URL file.
I think the problem here is that the PDF is in ONLY DOWNLOADABLE FORMAT in a browser and NOT VIEWABLE in the browser.
I also tried to embed the source PDF URL file but it just returns a plain grey box and nothing else.
Can someone please tell me how can I force this PDF to be viewable in the browser so the user can see the agreement without downloading it?
Thanks.
/rd
content-disposition:inline is probably what you want.
Inline read into the browser
Attachment make it for download.
Can someone please tell me how can I force this PDF to be viewable in the browser so the user can see the agreement without downloading it?
If the user doesn't have a PDF reader installed or have his or her browser's MIME types set so that PDFs are open within it with a reader, there's no way you can control that. Also, even though it opens in a browser, the client can still save it locally, so the data is downloaded anyway.
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.
Hello fellow stackoverflow'ers!
Today I was tired of old dead links to my fav internet radio, so I decided to make a downloader for all channels from di.fm. The idea was simple: download the page, get to the menu and parse it. After that create a playlist and make user download it.
So I created a PHP script as an API for my JS script. PHP functions were to download the page (JS cannot really do that), save playlist sent via POST in cookies and to provide it as a file. Cookies are supposed to be a communication channel between JS and PHP (with POST I cannot really make file download itself).
So far so good. Everything works like a charm under Opera. Things are getting complicated in Chrome and Firefox. Chrome reloads the page without a download dialog, Firefox works about the same, just sometimes lets me download the list... that is empty.
Any ideas how to solve it? Here is the code (feel free to use it yourself if you like it):
http://pastebin.com/dcEzxV9w
Thanks in advice,
Dracco
Is there any way to disable the download dialog box in Firefox, Chrome, IE, etc.. using php?
Because I have a project, its like a file management, where the users (client) will just view the files (.doc, .ppt, .pdf, etc) and they should not be able to download it.
For me, I think it cannot be.. But to you guys I know you have ideas on how to do it. Any suggestion is greatly appreciated..
they should not be able to download it
It does not depend how a browser offers a user-interface for a resource located at an internet-address (URL or URI): Dialog box or view-port - the file is always downloaded.
So the answer is no because a user is always able to download it - as the browser must be able to do so.
I used MS Office itself to convert all my docs to .html extension.. then I upload it to my intranet site.. so my members can only view the information I uploaded.. I used some javascript to disable the right click button so no one can save that file.