PDFClown .NET 打开 Windows 资源管理器而不是指定路径
PDFClown .NET Open a Windows Explorer instead of specifying path
目前我有这个测试代码
File file = new File();
Document document = file.Document;
Page page = new Page(document);
document.Pages.Add(page);
PrimitiveComposer composer = new PrimitiveComposer(page);
composer.SetFont(new StandardType1Font(document, StandardType1Font.FamilyEnum.Courier, true, false), 32);
composer.ShowText("Hello World!", new PointF(32, 48));
composer.Flush();
file.Save("test.pdf", SerializationModeEnum.Incremental);
System.Diagnostics.Process.Start("explorer", System.IO.Directory.GetParent(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName).ToString());
如何打开通用 windows 资源管理器另存为提示而不是保存到硬代码路径 "test.pdf"? (在file.save()
)
谢谢
为此使用 SaveFileDialog
:
https://msdn.microsoft.com/en-us/library/sfezx97z(v=vs.110).aspx
SaveFileDialog saveFileDialog1 = new SaveFileDialog();
saveFileDialog1.Filter = "PDF File|*.pdf";
saveFileDialog1.Title = "Save PDF";
if(saveFileDialog1.ShowDialog() == DialogResult.OK)
{
file.Save(saveFileDialog1.FileName, SerializationModeEnum.Incremental);
}
目前我有这个测试代码
File file = new File();
Document document = file.Document;
Page page = new Page(document);
document.Pages.Add(page);
PrimitiveComposer composer = new PrimitiveComposer(page);
composer.SetFont(new StandardType1Font(document, StandardType1Font.FamilyEnum.Courier, true, false), 32);
composer.ShowText("Hello World!", new PointF(32, 48));
composer.Flush();
file.Save("test.pdf", SerializationModeEnum.Incremental);
System.Diagnostics.Process.Start("explorer", System.IO.Directory.GetParent(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName).ToString());
如何打开通用 windows 资源管理器另存为提示而不是保存到硬代码路径 "test.pdf"? (在file.save()
)
谢谢
为此使用 SaveFileDialog
:
https://msdn.microsoft.com/en-us/library/sfezx97z(v=vs.110).aspx
SaveFileDialog saveFileDialog1 = new SaveFileDialog();
saveFileDialog1.Filter = "PDF File|*.pdf";
saveFileDialog1.Title = "Save PDF";
if(saveFileDialog1.ShowDialog() == DialogResult.OK)
{
file.Save(saveFileDialog1.FileName, SerializationModeEnum.Incremental);
}