Cannot open pdf file in browser using fpdf - pdf

I am new to fpdf. In my application, if a user clicks on a link, then I create a pdf file and the file gets downloaded. But I wanted the file to be opened in the browser. Here is my code
$fpdf->Output("Circular.pdf", "I");
But the code isn't working. The browser is showing garbage. I don't know what I am doing wrong. In the attached image you can see the output that I can see in the browser.

read up on the Content-Type header: https://www.rfc-editor.org/rfc/rfc2616#section-14.17

Related

How to block the file chooser in Firefox?

I'm developing an application that uses Selenium for automation of a certain process that involves file upload.
There is a button on that website that executes some ajax which loads in the file input element, but also tries to open file chooser for some reason.
In Chrome it works fine - the file chooser is blocked (message from the console: File chooser dialog can only be shown with a user activation.).
The problem is that I can't block it in Firefox. I looked through about:config and found nothing useful.
So how do I block it?

PDF loads on computer but downloads on mobile

I have my resume hosted on resume.momohossa.in
My issue is that when I try to reach this site on my computer, it just opens in a new page. However, when I try to open it on my phone, it has to download the file. Then, I have to open the downloaded file on a PDF viewer such as adobe. I would like for it to not immediately download on my phone. Does anyone have any advice?
Thank you in advance!
By default, on iOS devices, its safari browser can view PDF file directly, and for android deveices, its chrome browser also can do that.
make sure you pdf file is not a stream output file. just make it a static file, e.g. http://host/target.pdf not http://host/pdf/target

how can I download a pdf file from my browser that allows browsing only(read only)

My question is how can I download a pdf file from my browser that allows browsing only(read only) and does not allow downloading or printing as shown in the attached picture.
I think this pdf file can be downloaded through (php) could help me one specializes in php and Site Script?
please see the picture
enter image description here
enter image description here
/downloads/MTIyNTUtMTIucGRm.html
This is the link for pdf
http://185.62.36.66:812/web/viewer.html?file=%2Fdownloads%2FMjEwLTEucGRm.html#textLayer=off
There is no download button and no printing
Is there anyone who can upload it to me?
I think it is somewhere in properties of program where do you edit pdf file or right-click on that file and hit properties, and check Read-Only. Then upload the Read-Only applied file to web.

click pdf link in web, how to preview instead of download?

I have my resume linked in my home page.
But I found when I host the pdf file on two different storage server, the default behavior when click on the link differs: one directly download the pdf file bug the other preview in a new tab.
the two links are as below:
http://data-10045577.file.myqcloud.com/doc/Zhao.Kai_ShanghaiUniv.pdf
http://7xocv2.dl1.z0.glb.clouddn.com/doc/Zhao.Kai_ShanghaiUniv.pdf
I have tested on firefox chrome IE that this is not a browser issue.
For some price issue I have to switch to the storage server of which the default behavior is downloading pdf file.
what settings should I have so that click the pdf link then preview instead of downlod?
Additionally, the storage server provide a configure option that can set the "http header", I know little about the web, so can setting a header work, if so, how to ?
I googled it and it seems the content-disposition argument in http header account for this. But I add content-disposition='inline', doesn't help.
if not the browser's issue, then the download one is added programmatically with headers, and the preview one is just putting your file in that folder on the server

open pdf file through URL using uid

I work with alfresco 4.2
I want to get an image from alfresco through URL using uid
I can get the result through this link
http://localhost:8080/alfresco/service/api/node/content/workspace/SpacesStore/98996554-212 f-4846-876a-89b40999901a/test.jpg
my problem is to do the same thing but for a pdf file
with chrome I can not open the file
and firefox the file is opened in binary format
is there a way to open a pdf file through URL using the uid of alfresco file
I'd try using the download servlet. I believe the url you are using is not setting the mimetype headers correctly. This url should do the trick:
/alfresco/download/direct/workspace/SpacesStore/0000-0000-0000-0000/myfile.pdf
Possible reason could be mimetype of your pdf file is not correctly set. Normally browsers have addons avilable out of box which enable them to read pdf file correctly.
https://helpx.adobe.com/acrobat/using/display-pdf-in-browser.html
Those appliation are associated with perticular file types so whenever it detects that file type browser invoke that application to deal with it. So you can make sure your file's extension and mimetype are correct.
One more thing you can try is download that file and try to open it directly in browser.
Also, there are chances file may be corrupt. Are you able to see prview of pdf in alfresco?