Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Document document = new Document();
- MemoryStream stream = new MemoryStream();
- try
- {
- PdfWriter pdfWriter = PdfWriter.GetInstance(document, stream);
- pdfWriter.CloseStream = false;
- document.Open();
- document.Add(new Paragraph("Hello World"));
- }
- catch (DocumentException de)
- {
- Console.Error.WriteLine(de.Message);
- }
- catch (IOException ioe)
- {
- Console.Error.WriteLine(ioe.Message);
- }
- document.Close();
- stream.Flush();
- stream.Position = 0;
- return File(stream, "application/pdf", "DownloadName.pdf");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement