PDA

View Full Version : Downloading a pdf using "save as"


bobohearn
03-22-2007, 03:07 PM
I am trying to give the user the option to save a pdf from the cd to a location of their choosing. I know the user can save the pdf itself but my client wants a button on the interface. tried a few things in the Dialogue and File actions but without any success. Any help would be appreciated. Thanks, Bob

RizlaUK
03-22-2007, 03:20 PM
Here, Try this

just edit the path to your pdf file

SaveAs = Dialog.FileBrowse(true, "Save File As", _DesktopFolder, "All Files (*.*)|*.*|", "", "pdf", false, false);
if SaveAs[1] ~= "" and SaveAs[1] ~= "CANCEL" then
File.Copy("AutoPlay\\Docs\\yourfile.pdf", SaveAs[1], true, true, false, true, nil);

error = Application.GetLastError();
if (error ~= 0) then
Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
end
end

bobohearn
03-22-2007, 04:42 PM
Great! Thanks! Now I'm wondering if when the dialogue box opens it already has the name of the file in the drop down. Again many thanks, Bob

RizlaUK
03-22-2007, 04:53 PM
ok, you can put a default filename in the code,

change this line

SaveAs = Dialog.FileBrowse(true, "Save File As", _DesktopFolder, "All Files (*.*)|*.*|", "", "pdf", false, false);

to something like this

SaveAs = Dialog.FileBrowse(true, "Save File As", _DesktopFolder, "All Files (*.*)|*.*|", "myfile", "pdf", false, false);



EDIT:

also i just noticed that the button says "open" and not "save"

change the frist "true" to "false" and it will dispaly "save"
SaveAs = Dialog.FileBrowse(false, "Save File As", _DesktopFolder, "All Files (*.*)|*.*|", "myfile", "pdf", false, false);

bobohearn
03-22-2007, 05:59 PM
You just made me look briliant! Thanks for everything. Bob

RizlaUK
03-22-2007, 07:02 PM
hey no problem Bob, glad to help :yes