I have a script that generates a temporary PDF file, binary-streams it to the client, then deletes it.
If you click on "Save Page As" in the browser File menu, it wants to save the correct file name that I specified through Content-Disposition.
However, if you click on the Save button in the Acrobat reader or Acrobat Pro, it wants to save the name of the script file, replacing ".asp" with ".pdf". It's like Acrobat completely ignores "Content-Disposition"
It's important that I don't use a static URL, but instead use a Dynamic script to generate the PDF, so that I can delete it immediately upon closing the stream. Otherwise, I can't know when the client is finished downloading.
Is there a solution to this? I've seen several threads, but none with an answer.
You can use a URL rewriter to point a "static" path to your dynamic script.
See this blog post on classic asp redirection.
So, you can have a link like:
http://www.example.com/12_234_file.pdf
Redirect to:
http://www.example.com/dynamic.asp?id=12&id2=234
The client will see the URL before it was re-written and should use that.
Related
Background
I am attempting to automate the downloading of an Excel file given a URL. I know how to do this, and realize there are many examples for how to do this using either the webbrowser or webclient control however my situation is somewhat different.
Problem
If I simply paste the URL into a normal browser, it will result in asking me to save / open the file like normal. When using the same URL with either the web browser or web client controls, it results in no file. I believe this is because the URL is simply a SharePoint link, that sends a request to get the file, but is not the actual file itself.
This can be done for security reasons or whatever the case is but I was wondering if anyone has ever found a way around this?
Perhaps a way to even just emulate the browser, then emulate clicking save?
The URL for the Excel file does NOT end in .xlsx, it ends in something like:
webclient/zhZZXYRyAaLUgD?TC_file=redirs/viewdataset
which is why I think the server simply processes the request and then provides the browser the file.
I am attempting to do this in VB.NET but VBA or VB answers seem like they should work as well.
Fiddler Results
I seemed to find an easy way to solve my problem. After downloading my file within Internet Explorer, and then viewing my recent downloads, IE has an option if you right click and select "Copy Download Link". This puts the true download URL in the clipboard and actually works using the My.computer.downloadfile method.
I have: LiveCycle server (ES3, JBOSS), Workbench, Designer.
Using LC Desginer I convert PDF to XDP - it's template now.
Now I need to convert that XDP file to PDF.
So, I guess I should somehow call LiveCycle server by HTTP request, in body of this request I can send body of XDP document. All what I need from LC is just PDF.
Looks like simple task, but I can't find ANY information how to do this. I see a lot of examples how to do this in Java, but I don't need Java, I need to do it via HTTP (REST endpoint or SOAP if it's not possible).
Maybe I need to create some "application" in Workbench? If so, is there any step-by-step documentation? Or maybe somebody can explain me, how to do this. Maybe there is already build-in application in ES3 Server - I think it's very common and simple case.
UPD: I've opened job at Odesk for this issue, I promise to post solution here to share knowledge with community
As was promised, here is how to solve this issue:
It's not enough just put PDF into LiveCycle Designer. You exactly need to design form in LC Designer. You can use your PDF as template, but for all things which you want to fulfil by your custom data, you need to add objects in LC Designer (take a look at the "Insert" menu, try Table or Text Field) and add Data Connection in the "Data View" tab. I think it's pretty easy step for professionals, but it can take some time to get by beginners. Save results of your work as, for instance, Template.xdp file.
Also you now have the example of XML file - source of the data. Let's name it DataSource.xml
Now we can install LiveCycle Server. Best for LC ES3 is RHEL 5.5 (we spent around 2 days just to find correct combination of OS and settings). You'll need a clever system-administrator (or just experienced in Adobe LiveCycle :))
Server is working now, you can see web-interface, so let's create application in Adobe LiveCycle Workbench ES3. Add an application with new name and add a process to that application. It will take to many words to describe all steps of process, just take a look at screenshots of result (and notice variables also):
Now most easy part - call this app by the HTTP request. But we can't just send usual POST request to Adobe LiveCycle :) We have to send content of 2 files (Template.xdp and DataSource.xml) as multipart/form-data and names of the parts are the names of input variables (in my example is xmlTemplate and xmlData). And don't forget Authorization header with Basic authorization credentials.
In the Response you'll receive base64-encoded body of the PDF document.
Thanks to Thierry Stortenbeker for this application and for help and patience.
Yes, you have to create an LC application using workbench. Here is how to do it:
Create a new application in workbench using File -> New -> Application.
Create a new Process using the right click menu at the application.
Drop in renderPDF form activity from the activity and name it "renderPDFForm".
Select renderPDF form activity to add variables using the bottom pane of variables.
Add a variable of "Document" type and name it "inputXDP". We will use this to pass xdp file. Mark it to be "input" variable.
Add a variable of "Document" type and name it "outPDF". Mark it to be "output" variable.
Now double click renderPDFForm activity, this will open a property editor on the left side.
Expand "Input" section if not expanded already. Make sure "Form" to be picked up from variable. Then choose "inputXDP" from the dropdown.
Expand "Output" section if not expanded already. Make sure "Rendered Form" to be picked up from variable. Then choose "outPDF" variable from the dropdown.
Now deploy your application by right click menu on application.
That is it. You are ready to go. Now save the process and double click "default start point" to get the rest url where this service would be exposed. The rest url should look like http://localhost:8080/rest/services/RestFormRender/renderForm:1.0. Here RestFormRender is name of the application and renderForm is name of the process. Now make a GET/POST call to this REST url and specify XDP bytes in "inputXDP" request parameter.
I was wondering if it is possible to open a pdf file (located on a web server) in a web browser, edit it and then save it with the changes. Basically what I need is to open, edit and save a certificate protected pdf file in my web browser, without ever having to download a copy to my desktop. The pdf file contains textfields that needs to be filled out with text before saving the changes.
I know that it is possible to view pdf files in a browser, but im unsure if it is possible to edit it when it is protected by a certificate.
What you are asking can be performed in the following methods: First which is the simplest way is to use Adobe Forms server. If you would like to use your own PDF, you will need to extend reader extensions display the form in a frame and perform cross scripting to tell the form to post itself to the server. Note: read Adobe Reader Extension licensing extending reader extension has restriction on usage.
Obviously you can enable reader extension allow user to download edit and upload the file to your server.
Certified forms means you cannot change the form structure but you can fill the form and save it (if it is reader extension enabled)
My application is in JSP/Struts and running on WebSphere. I don't have access to the server /really/ so I'm trying to do all this from within the app itself (Struts actions & config, JSP, etc).
I have a page that displays links for PDF documents that the user might want to look at. When they click on the link, it is forwarded to the 'document view' STRUTS action which performs the work to retrieve the PDF from the back-end system and then displays the PDF in the browser window. This all works fine.
The users have asked to have the file name of the document be customized for each document when they go to File->Save As... but right now the browser wants to try to name the document after the name of my Struts action. Example: "documentView.pdf"
I have the filename I want to use forwarded to the STRUTS action and I tried using the "Content-Disposition" header to set this, but haven't been able to get it to work. Actually it works great if I use "attachment; filename="myfilename" " but then it FORCES the "Save As..." dialog straight away, which I don't want either.
I want to be able to look at the PDF inline in the browser window and save it with a custom filename if I so choose.
I have read that this might be possible to do with URL rewriting but I'm having trouble sorting out how this technique might work.
Any ideas will be greatly appreciated.
Change the "attachment" part of the Content-Disposition to "inline".
Browser support for Content-Disposition is flaky.
Before it was supported, you used to be able to get the browser to do the right thing by putting a superfluous key/value at the end of the URL. Like:
http://example.com/getPDF?id=123213&filename=mydoc.pdf
Some browsers picked up the last bit of the URL as the filename. Not sure if that still works.
I've got a form that I downloaded, I'd like to prefill some content on the form (this is easy using cfpdfform).
Where it gets tricky is I would like to allow the user to modify the contents of that form, and then somehow have those modified contents accessible to me. I didnt build the source PDF so I dont know how to allow the user to "save" the new contents so they can be read.
Any ideas on where I might start on this one?
You can also use the cfpdfform tag to read/write data to a PDF file which has a form. The important thing is that the PDF document already have the form fields available, or that you add them.
I just recently completed a task where I had to have a user fill out a normal web form, and then create a filled version of an existing PDF document. It worked like a breeze!
I think that depending on what you are trying to accomplish, having the user fill out the data in a web form is less confusing than serving up a PDF and expecting them to save that to update a file on a remote server. Just my opinion, though.
http://www.cfquickdocs.com/cf8/?getDoc=cfpdfform#cfpdfform
It's possible for users to complete most PDF forms in Adobe Reader, but when user's try to save the changes they get a popup prompting them that the PDF cannot be saved and would need to upgrade to Adobe Acrobat to have this functionality.
Since Acrobat 7 (or possibly) 8 it's possible to create a form so that it can be completed and saved in reader. In Acrobat open your PDF, and select Advanced -> Enable usage right in reader from the menu. This will prompt you to save the form and then anyone using Adobe reader can complete it.
Once that's done you can open the form in ColdFusion, populate some of the fields and serve it up to the user. Once they fill it in, save it and get it back in ColdFusion you can read the contents using the PDF related tags.
Please note: It's currently not possible to set the "enable usage rights in reader" flag from ColdFusion, you need a copy of Adobe Acrobat or access to Adobe LifeCycle server to do this.
This document may help you:
http://www.adobe.com/education/instruction/teach/coldfusion/CF8-2_advanced_cf8_development_unit8.pdf