Jump to content
uniGUI Discussion Forums
Sign in to follow this  
Servant5166

Downloading a PDF using a button or Menu option

Recommended Posts

Hi,

 

I'm using ReportBuilder 18, and I need an option to download PDF's to the user's machine instead of displaying the report. How do I accomplish this?

 

I'm using uniGUI 1.0.0.1420 and Delphi 10.2.

 

Thanks in advance.

Share this post


Link to post
Share on other sites

Hi,

 

Use UniSession.SendFile

\FMSoft\Framework\uniGUI\Demos\Desktop\SendFile

Best regards,

I'm not sure on how to do it. I would like a save dialog box to prompt the user for filename and location.

 

Here's my code to create the PDF below

 

function TrepDataModule.GenRep(ID: Integer; ReportName: string): string;
var
   lPDFDevice:  TppPDFDevice;
begin
      lPDFDevice := TppPDFDevice.Create(nil);
      lPDFDevice.PDFSettings := Reports.PDFSettings;
      lPDFDevice.FileName    := UniServerModule.NewCacheFileUrl(False, 'pdf', '', '', Result, True);
      lPDFDevice.Publisher   := Reports.Publisher;
      // generate the report
      Reports.PrintToDevices;
   finally
      lPDFDevice.Free;
   end;
end;
 
Thank you.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×