n my case, I have a type in which a user gets in all information and sends out those information through mail in HTML format. It is working appropriately.
Now I want to transform the HTML to PDF, so that i can send the html as the mail body and have the PDF File connected.
i desire that filled details in PDF format, means user filled details online and send that detail to client, client get that information in html format in his mail, so i desire on that button click all that detail should transform in pdf and send as attatched file.
When you send kind, create PDF file using any of PHP plugin like TCPDF, then connect created file in e-mail header, So that any one can download.
I am providing link of a pdf file on my websites for download, like listed below
<a href="http://myfile.pdf">Download Brochure</a>
The problem is when user clicks this link then
If the user have set up Adobe Acrobat, then it opens the file in the exact same web browser window in Adobe Reader.
Then it pop-up to the user for Downloading the file, if the Adobe Acrobat is not installed.
But I want it constantly pop-up to the user for download, irrespective of “Adobe acrobat” is set up or not.
Please inform me how i can do this?
Rather of connecting to the.PDF file, rather do something like
<a href="http://pdf_server.php?file=pdffilename">Download my eBook</a>
which outputs a custom-made header, opens the PDF (binary safe) and prints the information to the user’s browser, then they can pick to save the PDF in spite of their internet browser settings. The pdf_server. php ought to look like this
This is a typical concern but couple of individuals know there’s a basic HTML 5 service:
<a href="http://./directory/yourfile.pdf" download="newfilename">< a href= "./ directory/yourfile. pdf "download=" newfilename" > Download the pdf Where newfilename is the recommended filename for the user to save the file. Or it will default to the filename on the serverside if you leave it empty, like this:
<a href="http://./directory/yourfile.pdf" download>Download the pdf</a>
Compatibility: I evaluated this on Firefox 21 and Iron, both worked fine. It may not work on HTML5-incompatible or outdated browsers. The only browser I tested that didn’t force download is IE …
Inspect compatibility here: http://caniuse.com/#feat=download
Rather of using a PHP script, to flush the file and read, it’s more neat to reword the header using.htaccess. This will keep a “great” URL (myfile.pdf rather of download.php?myfile).
Content-type application/x-pdf-document or application/pdf is sent while sending PDF file. Adobe Reader generally sets the handler for this MIME type so browser will pass the document to Adobe Reader when any of PDF MIME types is received.
in a Ruby on Rails application (especially with something like the Prawn gem and the Prawnto Bed rails plugin), you can accomplish this a bit more merely than a complete on script (like the previous PHP example).
Here’s a various technique. I choose rather than to count on internet browser support, or address this at the application layer, to use web server reasoning.
If you are using Apache, and can put an.htaccess file in the pertinent directory you could utilize the code listed below. Obviously, you could put this in httpd.conf also, if you have access to that.
The FilesMatch instruction is simply a regex so it could be set as granularly as you desire, or you could include in other extensions.
The Header line does the very same thing as the first line in the PHP scripts above. If you have to set the Content-Type lines as well, you could do so in the same way, but I have not discovered that necessary.