Sending PDF file back to client - odoo

I have made a wizard with a button. On buttons action the function generates a PDF file on the server. How can I send back this file from server disk to the client ?

If it's not a report, write the PDF file in a binary field.
See the export language wizard for example

Related

Export Excel file in Orangehrm

I have using open source of orangehrm ver 3.2.2 on my Server. I want add function export data (list leave, list emp, report..) to Excel file. But I don't how to do it.
For export data in excel file, you need following steps :
Put a button for generate excel file. On click button send ajax request which
is get data as per requirements.
after get data on server side use phpexcel library for generate excele file.
for generate excel file follow this example : http://www.blrf.net/blog/46/code/php/writing-excel-files-with-phpexcel/
save file in folder.
in responce, you need to send file path for download.
And on successfully received data, download file from responce.

SSRS : Using URL Access Parameters to printer

Currently, I am using this method to generate PDF file via SSIS and SSRS.
https://msdn.microsoft.com/en-us/library/ms152835(v=sql.105).aspx
However, I manage to output it to local drive only.
Is it possible to send the PDF file to network printer ?
and do I need to install Adobe Acrobat reader on this machine ?
Don't need to install adobe acrobat reader if you doesn't need to open this PDF. Export to PDF function is built-in in Report Viewer.
For printing, refer this link https://msdn.microsoft.com/en-us/library/dd220412.aspx
or write printing code from your backend, send PDF to printer.

Best practice to display the PDF file in the browser?

Am currently working on a web application which receives the encoded text from the web service and am decoding & saving as a PDF file. Once the user clicks for the details then I am supposed to display the PDF file in the web browser.
What is the best practice to display the PDF file in the browser? Am using VB.Net 2003
All you need to do is set the link to point to your pdf file. And if the user has any PDF reader installed, it will be opened using that reader.
The name you Want to Show as Link
EDIT:
The other way, if you dont want to display as link and directly open the file, is to set the correct MIME type in the headers, so that the browsers can detect it as PDF file instead of HTML file.
Response.AddHeader("content-disposition","inline;filename=YourPdfFileName.pdf")
Response.End

Creating, editing and saving pdf file (protected by certificate!) in a webbrowser

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)

XDP File using remote PDF

In one of our applications, we have a script dump data from a database into a well-formed XDP file, which the user can download. The XDP contains a reference to a PDF on the same server via the <pdf> tag. The idea is the user can dump the data, get the XDP, which will download the PDF and automatically fill in the data, which they can then save, print, or e-mail.
The problem is that Adobe Reader (or Acrobat) instead opens the default web browser to try to download the PDF, and if you open it from the browser it does not automatically populate the data dumped from the database. If I take the XDP and use a text editor to change the link in the <pdf> tag to a locally downloaded copy, the form populates fine, so the XDP is written correctly, however this is not a practical solution, as most users wouldn't know how to do that.
My question is if there is a way to automate this process, so that Adobe Reader or Acrobat downloads the PDF file and populates the data automatically, and doesn't try to route the process through the web browser.
EDIT
Using Seeker's answer we came up with the following short snippet in PHP:
$filename = ""; // Your file here
$contents = base64_encode(file_get_contents($filename));
Then in the PHP file that handles the XML:
<pdf xmlns="http://ns.adobe.com/xdp/pdf/">
<document>
<chunk><?php echo $contents ?></chunk>
</document>
</pdf>
I was dealing with the exact same issue today. You should include the PDF file using Base64 encoding inside your xdp file.
in your XDP file replace this: <pdf href="http://.../form.pdf"> with :
<pdf xmlns="http://ns.adobe.com/xdp/pdf/"><document>
<chunk>**CONTENT OF YOUR PDF IN BASE64 GOES HERE**</chunk>
</document>
</pdf>
That should solve your problem.