Question How to download pdf using link label?

Anonymous

Well-known member
Joined
Sep 29, 2020
Messages
84
Programming Experience
Beginner
I am creating a pdf using PDFsharp and saving it automatically on button click-

C#:
 // Save the document...
            string filename = "Barcode.pdf";

            document.Save(@"E:\" + filename);

            MessageBox.Show("PDF saved successfully!");

Instead of automatically saving it by button click, I want to generate a download link for the pdf using link label in windows form -

1688480007220.png


How should I do this? Thank you.
 
Is this a WinForms application? If so then I will move this thread to the Windows Forms forum, where it belongs. It's not a question about VS at all, because the solution will not depend on where the code is written.
 
Some this is a WinForms program, the code is already running on the user's machine, and the file created is already on the user's machine? What is there to download? Downloading is copying from a server to local machine.

If you want to "download" just save to the user's "Downloads" directory.

Or is your real reason for "downloading" is to trigger the automatic launching of a PDF viewer?
 

Latest posts

Back
Top Bottom