Load PDF from Memory ASP.Net

Posted by Sandhurst on Stack Overflow See other posts from Stack Overflow or by Sandhurst
Published on 2010-03-18T04:35:15Z Indexed on 2010/03/18 4:41 UTC
Read the original article Hit count: 591

Filed under:
|
|
|

I am using ITextSharp to generate pdf on the fly and then saving it to disk and display it using Frame.

The Frame has an attribute called src where I pass the generated file name.

This all is working fine what I want to achieve is passing the generated pdf file to Frame without saving it to disk.

HtmlToPdfBuilder builder = new HtmlToPdfBuilder(PageSize.LETTER);
HtmlPdfPage first = builder.AddPage();

//import an entire sheet
builder.ImportStylesheet(Request.PhysicalApplicationPath + "CSS\\Stylesheet.css");
string coupon = CreateCoupon();
first.AppendHtml(coupon);

byte[] file = builder.RenderPdf();
File.WriteAllBytes(Request.PhysicalApplicationPath+"final.pdf", file);
printable.Attributes["src"] = "final.pdf";

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about c#