I am using below code but instead of saving it to Disk , i want to keep the data in memory, and using that data in memory i want to display the pdf in browser. Below code is working fine but i want to keep data in memory rather than saving to disk. What changes can be made to this ?
[Aspose.Pdf.Document document = new Aspose.Pdf.Document(@“C:\TestArea\Destination\SUP000011\ATM-1B4L2KQ0ZE0-0001\OpenAML.pdf”);
//create TextAbsorber object to find all instances of the input search phrase
TextFragmentAbsorber textFragmentAbsorber = new TextFragmentAbsorber("(?i)" + searchText, new TextSearchOptions(true));
////accept the absorber for all the pages
document.Pages.Accept(textFragmentAbsorber);
////get the extracted text fragments
for(int i = 1; i < textFragmentAbsorber.TextFragments.Count + 1; i++)
{
textFragmentAbsorber.TextFragments[i].TextState.Font = FontRepository.FindFont("Verdana");
textFragmentAbsorber.TextFragments[i].TextState.FontSize = 9;
textFragmentAbsorber.TextFragments[i].TextState.ForegroundColor = Aspose.Pdf.Color.FromRgb(System.Drawing.Color.Blue);
textFragmentAbsorber.TextFragments[i].TextState.BackgroundColor = Aspose.Pdf.Color.FromRgb(System.Drawing.Color.Yellow);
}
// Save resulting PDF document.
document.Save(@"C:\TestArea\Destination\SUP000011\ATM-1B4L2KQ0ZE0-0001\Highlightdoc.pdf");
WebClient User = new WebClient();
byte[] buf = User.DownloadData(@"C:\TestArea\Destination\SUP000011\ATM-1B4L2KQ0ZE0-0001\Highlightdoc.pdf");
if (buf != null)
{
Response.ContentType = "application/pdf";
Response.AddHeader("content-length", buf.Length.ToString());
Response.BinaryWrite(buf);
}](http://)