简体   繁体   English

保存之前预览PDF

[英]Preview PDF before save it

I want to preview a PDF file. 我想预览PDF文件。

I used iTextSharp in C# to generate the PDF file. 我在C#中使用了iTextSharp来生成PDF文件。

How can I make a function to preview PDF file before print it. 如何在打印之前创建preview PDF文件的功能。

I didn't find anything on the preview with iTextSharp 我在iTextSharppreview找不到任何preview

I did find an answer of my question and I want to shared it with all. 我确实找到了我的问题的答案,我想与所有人分享。

So, I have make a personnal viewer with Windows.Data.Pdf library. 所以,我用Windows.Data.Pdf库创建了一个personnal查看器。

I would just open the By saving it the opening it then having a check to see if it is open and if it isn't open anymore deleting it. 我只是打开通过保存它打开它然后检查它是否打开,如果它不再打开删除它。

Document doc = new Document(iTextSharp.text.PageSize.A4, 10, 10, 20, 10);
PdfWriter wri = PdfWriter.GetInstance(doc, new FileStream("submitted.pdf", FileMode.Create));
doc.Open();
// do your generating code here
doc.Close();
System.Diagnostics.Process.Start("filepath\\submitted.pdf");
System.IO.File.Delete("filepath\\submitted.pdf");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM