Force download itextsharp created anchor in PDF - pdf

I need to develop application which creates pdf files and serve them via http. PDF is created using iTextSharp. In my pdf files are lot of anchors navigating to images and videos stored on the same server f.e. http://192.168.10.10/video.mp4 .
Files are generated and trasmitted via http correctly, but when I click on those anchors in my pdf source files are opening in browser. I would like to force download them.
I read all itextsharp documentation and cannot find anything.
Is there some way to do that?

Related

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

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.

how to implement pdf.js to view pdf files in the pdf viewer?

i want to open pdf files that are linked to in a document in a new page in the pdf.js viewer.
i have downloaded the zip file from github:
https://github.com/mozilla/pdf.js
and gone to both of the index.html files in the examples folder.
i get blank pages when opening either of these files.
can anyone please tell me how to implement pdf.js so that i can open pdf documents in a new page in the pdf viewer?
thank you.
Try using '?file=url' in query-string with viewer.html.
For example: www.example.com/pdf-js/web/viewer.html?File="URL"
Source: pdf-js on github
And yes, you will most definitely have cross-domain issues if not using any web-server, as mentioned by #Silent.
Cheers.
Let me guess that you tried to directly open the examples via chrome. Your url probably starts off with file:///. This is causing a cross origin request error to occur on your browser. To properly view the examples, you need a LAMP stack.

How to force to show PDF in google chrome using Adobe PDF Plug-In only

I am facing a problem while showing a pdf in Google Chrome. The issue is that Chrome shows some pages of the pdf as black.
This happens when Chrome PDF Viewer is enabled. If I disable this plug-in and use Adobe PDF Plug-In it works fine.
Is there any way to show a PDF in Google Chrome using the Adobe PDF Plug-In only.
AS I am showing PDF using an HTML object tag, is there any parameter which forces Chrome to show the PDF using Adobe PDF Plug-In?
There's no way for a website to force the browser to use one renderer or another: those decisions are all made client-side. As you noted, disabling the Chrome PDF plugin bubbles the Adobe plugin to the top, but that's a decision the user would have to make.
That said, if you have a PDF with rendering issues that you can share, please file a bug at http://new.crbug.com/. I'll be happy to put it in front of the correct team for triage.
The only way that you can be 100% that all users can open your PDF correctly currently, is to force that the PDF is downloaded.
Use some headers within your apache or backend.
Example for Apache
https://stackoverflow.com/a/11991050/3086639

Joomla 1.6 Upload file field in article manager

I wanted to add pdf file in my articles. I have added a custom form field with type="file" in the article manager by hacking the xml and artical.php file in administrator/component/com_content directory.
But I am not able to save the uploaded files on server. What causes this?
Also I used the field type="Media" but it does not display pdf files?
I had a requirement a while back where with every articles they wanted to be able to attach files for download. The trouble was that the end user had to be able to do this and they were not very tech savvy. I used this Joomla attachment extension and it has worked like a charm. I would recommend it.
In your case I would check the directory where the files are being uploaded, see if it has permissions that would allow files to be uploaded. Can you upload images fine and attach them in an article?
Update
This attachment does not work with Joomla 1.6+, the developers do have a plugin that is in Release Candidate stage that you can use.

How to show pdf in blackberry?

i have to show pdf file in the blackberry by first downloading it from the server. is there any default feature that blackberry provides to show the pdf in blackberry app?
all suggestions will be appreciated...thanx
As far as I know there is no default viewer on the BB to show local PDF files (outside the attachments). You will have to use a third party tool (or write your own viewer)... See this thread for more info.
One interesting option you can use is have the pdf in a browser accessible location and pass in code the url of the file to the browser - this should open the file using the BB compressed view (the attachments viewer), though it might only be available with BES/BIS, not sure.