I have PDF document saved into my PDFs folder. I have created one function whose duty is to load the PDF into PdfDocument
class, add some styles on runtime
, save it back as temporary file and preview it in WebClient
. My logic is working absolutely fine. I want to eliminate saving it back as temporary file. I want to directly preview it without saving, is it possible? I searched online but didn't get any good source. Following is my code:
PdfDocument pdf = new PdfDocument();
pdf.LoadFromFile("MyFile.pdf");
pdf.SaveToFile("ModifiedMyFile.pdf"); // Eliminate this part
WebClient User = new WebClient();
Byte[] FileBuffer = User.DownloadData("ModifiedMyFile.pdf");
if (FileBuffer != null)
{
Response.ContentType = "application/pdf";
Response.AddHeader("content-length", FileBuffer.Length.ToString());
Response.BinaryWrite(FileBuffer);
}
Aucun commentaire:
Enregistrer un commentaire