PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sat Apr 27, 2024 8:18 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Fri Jul 07, 2023 2:54 am 
Offline

Joined: Mon Apr 26, 2021 7:58 pm
Posts: 5
Hi everyone,
I've been using PDFSharp and MigraDoc for a while. Currently I save the file to a given path. Is there a way I can let the user choose where to save the PDF?

I currently have the problem under .net 7 that Process.Start outputs the following error:

Quote:
An error occurred trying to start process 'C:\Users\schra\Desktop\Sascha-Mathematik-Großen-7a-Förderplan.pdf' with working directory 'D:\Programming\Visual Studio\HLS_ManagementProgram\HLS_ManagementProgram\bin\Debug\net7.0-windows'. The specified executable is not a valid application for this OS platform.


Is there a solution for this?

Thank you very much for your help!


Top
 Profile  
Reply with quote  
PostPosted: Fri Jul 07, 2023 6:21 am 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 916
Location: CCAA
Sascha wrote:
Is there a solution for this?
There is a solution. It can been seen in any sample file that opens PDF files after creating them.

https://github.com/empira/PDFsharp.Samp ... ram.cs#L47

Code:
// Save the document...
var filename = "HelloWorld_tempfile.pdf";
document.Save(filename);
// ...and start a viewer.
Process.Start(new ProcessStartInfo(filename) { UseShellExecute = true });

_________________
Best regards
Thomas
(Freelance Software Developer with several years of MigraDoc/PDFsharp experience)


Top
 Profile  
Reply with quote  
PostPosted: Fri Jul 07, 2023 7:36 am 
Offline

Joined: Mon Apr 26, 2021 7:58 pm
Posts: 5
That works, thank you very much.

Do you have any idea how I can give the user the chance to choose a save path? This is how I set the path.


Edit: I found the ookii Dialogs WPF Nugget. There i can open a File Browser.
Thank you!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 365 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group