473,779 Members | 1,952 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Force PDF Download & Acrobat Reader Plugin

27 New Member
Does anyone know how I can prevent the Acrobat Reader plugin from loading a pdf into the web browser? I need to force the user to download the pdf file and run the pdf using the full Adobe Acrobat Reader program.

The code I'm using at present isn't working - any browser with the plugin loaded doesn't download the file it gets loaded into the browser window via the plugin:

[PHP]<?php

$mytalk = $_GET['varrqust'];

if($_GET['varrqust'] == "1"):
$mytalk = 'Talk 1';
$talksize = 3Mb';
$talkpath = 'talk1.pdf';

elseif($_GET['varrqust'] == "2"):
$mytalk = 'Talk 2';
$talksize = '3Mb';
$talkpath = 'talk2.pdf';

elseif($_GET['varrqust'] == "3"):
$mytalk = 'Talk 3';
$talksize = '3Mb';
$talkpath = 'talk3.pdf';

endif;

$path = $talkpath;
$file = basename($path) ;
$size = filesize($path) ;

//do download
header("Pragma: public");
header("Expires : 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false) ;
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=$file" );
header("Content-Transfer-Encoding: binary");
header("Content-Length: $size");

@readfile($path );

exit();

?>[/PHP]

Thanks in advance.
Oct 11 '07 #1
0 1766

Sign in to post your reply or Sign up for a free account.

Similar topics

1
2076
by: surfspider | last post by:
Hi, I have a little problem with the header function. I have a few links to pdf files on eshop.php. The links are like this : download.php?pdfid=1 In download.php I get the filename from the database and initiate the download. If I click on the link, I get the internet explorer dialog box "open, save or cancel". If I choose save, it correctly saves the file to my hard drive. But when I choose open, Adobe acrobat says it can't find the
8
12591
by: Chris | last post by:
Hello all, I wish to automate printing of PDF documents in a C# application. Is there an Adobe .net object? I tried to create a reference to the COM Object Adobe Type Library, but I get error "Exception from HRESULT 0x80131019" Thanks Chris
2
3667
by: jimfortune | last post by:
I have modified my GetAcroPath function to: Function GetAcroDir() As String Const LatestVer = 7 Dim strAcroDir(LatestVer - 2) As String Dim I As Integer strAcroDir(1) = "C:\Program Files\Adobe\Acrobat 3.0\Reader\" strAcroDir(2) = "C:\Program Files\Adobe\Acrobat 4.0\Reader\" strAcroDir(3) = "C:\Program Files\Adobe\Acrobat 5.0\Reader\"
0
1748
by: philipp | last post by:
I have the following problem: My client application (c#, WindowsForms) uses the IE Browser ActiveX Control to display either HTML or PDF files. This is fine so far. If the Acrobat Reader is configuered appropriately, the pdf-Files are displayed right in that Browser Control. Only problem is, when closing the Application there is a memory access violation. It occurs outside of my application, only when its Thread is just about to...
5
2807
by: gaubo79 | last post by:
I am wishing to force the Open|Save dialog box for a PDF and Excel file. I am using the following code: Response.Clear(); Response.ContentType = "application/octet-stream"; Response.AddHeader("Content-Disposition", "attachment; filename=" + saveFilename ); Response.Flush();
3
6594
by: moroni | last post by:
No problem 2 set Access up to get address data from tblClients then to use a form as a letterhead and to keyboard in the letter content then save the letter to a tblCorrespondence Get a scanner. Scan in your letters received to pdf format.Now insert in a form Adobe Acrobat Control For ActiveX (the pdf.ocx). Set the src property of the ActiveX control to the path of the pdf file you want to view. No problem it all works fine. Now try to...
5
7462
by: CDMAPoster | last post by:
I have changed how I get the shell path for Acrobat Reader based on code posted by John deKrafft. Does anyone see any problems with this code running on various Windows OS's? '--Begin Module Code 'Support functions and constants for reading a string from the registry 'I have modified the code posted by John deKrafft slightly '---- Declare Function RegQueryValueEx Lib "advapi32.dll" Alias
10
10369
by: Mauro | last post by:
I'm trying to use the following VB function to transform a pdf document to a tiff one: http://forums.microsoft.com/msdn/showpost.aspx?postid=1665127&siteid=1&sb=0&d=1&at=7&ft=11&tf=0&pageid=1 Private Sub savePDFtoTIF(ByVal fullPathPDF As String, ByVal fullPathTIF As String) Dim PDFApp As Acrobat.AcroApp Dim PDDoc As Acrobat.CAcroPDDoc Dim AVDoc As Acrobat.CAcroAVDoc Dim JSObj As Object
4
7402
Eleven
by: Eleven | last post by:
Hi, Got a problem detecting if Acrobat Reader is installed on a machine, would really appreciate your help. I've got a PDF Report that I export to a directory then open it with Acrobat Reader. I need to check if the PC has Acrobat Reader installed before I open it... I found this code but it's not working, i always get the messagebox even if the PC has the software installed. string RegPath =...
0
9474
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10306
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8961
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7485
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6724
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5373
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4037
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3632
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2869
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.