Can pdf and doc files be opened in a browser using coldfusion - pdf

Can a pdf file or a doc/docx file be opened in a browser? I have a link which when clicked opens up the document as such in pdf and in MS word. But is it possible to open them in browser using Coldfusion?
thanks in advance

ColdFusion has little to do with how they are opened in the browser. That depends on how the user's browser is configured. If it is configured to open in a standalone app, then it will do so, if it is configured to open in the browser then it will do that. You have some influence if you are serving the file via ColdFusion using the <cfcontent> tag, but since you have provided no code or any explanation of how you are serving these files I will assume you are just doing something like pdf which will just load the file in the browser and the browser determines whether to download it or view it directly.
If you are using <cfcontent> to serve the file then you can also use <cfheader> and send the file as either inline or an attachment which can help tell the browser how it should load it. That said, it is still up to the browser's configuration.
Something like:
<cfheader name="Content-Type" value="application/pdf" />
<cfheader name="Content-Disposition" value="inline;filename=mypdf.pdf;" />
<cfcontent type="application/pdf" reset="true" variable="#myPDFBinary#" />
would serve a PDF binary, telling the browser to load it inline, which should, if properly configured, open the PDF in the browser.

This is not something that ColdFusion can address. This has to do with the particular web browser being used and what related software a user has installed locally.
If the user has a browser that supports PDF natively (e.g. Chrome) or they have the Adobe Acrobat browser plugin installed, then the PDF will open in the browser. Otherwise, it will open in the Acrobat program or any program they have that can view PDF documents. There is no MS Word plugin for browsers, so the browser will always try to open a .doc file in MS Word (if they have it installed) or any other program they have that can read that type of file.

Related

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

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?

WebDav Pdf Saving error

I have set up a webdav folder that I can access thorugh chrome and edit files and save them back to the server, for example, I can open a word doc, edit it and save it back.
When I come to open a pdf, it wont save back to the server and downloads a copy of the pdf instead of the original.
Is there a way of enabling this to edit a pdf?
My end goal is to be able to open a pdf, add comments/highlights and save it back to the server, through my browser.
Thank you
Edit:
I have set this up through Apache 2.4, no plug ins through chrome, I have mapped a network drive to the server folder where I can open and edit files. Except PDFs, I would like to add comments to a off but when I open one the option is greyed out and when I try and save it after opening it tries to save to my desktop.
I'm not sure i've got your use case right, but if i've understood you correctly you have a link in a web page to a PDF which you're viewing in chrome. You click on that link and the PDF downloads to a temp file from which it is opened. If you edit and save those changes are simply saved to the temp file on your local PC. Is that correct?
If so, then this is simply normal behaviour for links in web pages. There is absolutely nothing in the HTML standard which suggests links should be opened by an editor with knowledge of the source location.
What you really want is for the link to launch an editor program which retrieves the remote document in edit mode (probably locking the remote resource) and then have edits saved back to the server. For this to happen there generally needs to be some special interaction in the browser. In Internet Explorer this is provided by the sharepoint dll and special script code. I think there's a plugin for Chrome which does the same thing, although differently.
I havent used the Chrome plugin, but i think this might help - https://code.google.com/p/npapi-msdocs/

XFDF URL reference to PDF form not working

I'm populating a PDF form using XFDF. The XFDF is produced by my Java webapp. I want to reference the PDF form from XFDF using a URL because I want form templates to be stored on the server. The form is password-protected, so I can't flatten it server-side with iText.
Using a local path works fine:
<f href="C:\Users\...\MyForm.pdf"/>
but a URL fails:
<f href="http://localhost:8080/app/servlet/PdfForm?id=176"/>
From the article below it seems it's possible, but I've looked through the XFDF spec and it doesn't mention URLs, only local paths:
http://wiki.developerforce.com/page/Adobe_XFDF
Neither Acrobat Reader X nor Acrobat Pro X seem to handle it. The browser fires up but and form doesn't get merged. I've tried changing default browser from Chrome to Firefox to IE with no luck.
Does anyone know if a URL reference works?
I think the URL should be only http://xx.xxx/xxx/test.pdf, a pdf form, not a stream.
I was able to open it in Internet Explorer on a PC with Adobe Acrobat Reader DC installed, but other browsers seem to be unable to do so.
Reference: https://helpx.adobe.com/jp/acrobat/using/display-pdf-in-browser.html

Opening a local PDF file in Chrome

Ok I see these 2 questions:
How to open PDF file in Google Chrome in new tab?
Can Google Chrome open local links?
But I'm not sure they answer my question. I'm trying not to install any PDF reader (Adobe sucks) and know that Chrome will open PDFs I open from the internet. So my question, is why won't it work if the PDF is local to my machine? Is there a workaround/plugin/other browser I can use to accomplish this?
The argument of security is totally bogus; how would a PDF I'm opening on the internet be any more secure/safe than a PDF I have on my local machine?
I'm running Chrome 8.0.552.18 on my computer now, under Windows 7, and I just clicked and dragged a PDF onto it, and it loaded it up no problem...
And no, it doesn't look like it's using Acrobat or Foxit, or another PDF reader... it looks like Chrome 8 does have its own PDF renderer.
I'm assuming you are on Windows. So, if your PDF is c:\some\path\some.pdf, simply use this URI in Chrome's address and search field:
file:///C:/some/path/some.pdf
On Linux I'd expect this for /some/path/some.pdf to change to
file:///some/path/some.pdf
(but have no chance to test this).
When you say "open a PDF in Chrome", what do you mean, exactly? Are you opening it through Gmail or Google Docs? If so, that's Google doing conversion behind the scenes, converting it to HTML on their servers, with Chrome simply rendering the HTML as usual.
As far as I'm aware, Chrome has no built-in PDF viewing capabilities.
edit looks like Chrome 8 does have its own PDF viewer built-in. Wowj.