I have this code for printing the PDF Document from file stream (using PdfSharp Library):
private HttpResponseMessage PrintPdfDocument2(MemoryStream fileStream)
{
HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK);
PdfSharp.Pdf.PdfDocument document = PdfSharp.Pdf.IO.PdfReader.Open(fileStream);
PdfSharp.Pdf.PdfDictionary dict = new PdfSharp.Pdf.PdfDictionary(document);
dict.Elements["/S"] = new PdfSharp.Pdf.PdfName("/JavaScript");
dict.Elements["/JS"] = new PdfSharp.Pdf.PdfString("this.print(true);\r");
document.Internals.AddObject(dict);
document.Internals.Catalog.Elements["/OpenAction"] = PdfSharp.Pdf.Advanced.PdfInternals.GetReference(dict);
var outputStream = new MemoryStream();
document.Save(outputStream);
result.Content = new ByteArrayContent(outputStream.ToArray());
result.Content.Headers.ContentType = new MediaTypeHeaderValue("application/pdf");
return result;
}
It work fine in chrome and i.e but not work in Firefox
Any idea for this problem????
Thanks u guys for reading!