PDFsharp & MigraDoc Foundation
http://forum.pdfsharp.com/

User can choose to save file and error under .net 7
http://forum.pdfsharp.com/viewtopic.php?f=2&t=4456
Page 1 of 1

Author:  Sascha [ Fri Jul 07, 2023 2:54 am ]
Post subject:  User can choose to save file and error under .net 7

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!

Author:  TH-Soft [ Fri Jul 07, 2023 6:21 am ]
Post subject:  Re: User can choose to save file and error under .net 7

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 });

Author:  Sascha [ Fri Jul 07, 2023 7:36 am ]
Post subject:  Re: User can choose to save file and error under .net 7

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!

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/