Moussawi
Moussawi

Reputation: 403

Preview PDF before save it

I want to preview a PDF file.

I used iTextSharp in C# to generate the PDF file.

How can I make a function to preview PDF file before print it.

I didn't find anything on the preview with iTextSharp

Upvotes: 5

Views: 3493

Answers (2)

Moussawi
Moussawi

Reputation: 403

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.

Upvotes: 1

ZoomVirus
ZoomVirus

Reputation: 615

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

Upvotes: 0

Related Questions