We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Show print dialog

I need to open pdf document inline and at the same time show print dialog

here is my code that open the document on new page:

HttpContext.Current.Response.Buffer = False
HttpContext.Current.Response.ContentType = "application/" & ext
HttpContext.Current.Response.AddHeader("content-disposition", "inline; filename=""" & FileName & """")
HttpContext.Current.Response.AddHeader("content-length", mMemoryStream.Length)
mMemoryStream.Position = 0
Dim Buffer(1024) As Byte
Dim byteCount As Integer
byteCount = mMemoryStream.Read(Buffer, 0, Buffer.Length)
HttpContext.Current.Response.OutputStream.Write(Buffer, 0, byteCount)
Catch ex As HttpException
If HttpContext.Current.Response.IsClientConnected Then Throw
End Try
Loop While (byteCount > 0)

is showing the print dialog doable?? if so please let me know how

Hi there,

Thanks for your inquiry. You may use JavaScript to achieve your requirements. Please set OpenAction of your PDF document as following, so when PDF document will be opened it will open the printer dialog. Hopefully it will help you to accomplish the task.

doc = new Aspose.Pdf.Document(“input.pdf”);<o:p></o:p>

doc.OpenAction = new JavascriptAction("this.print({bUI:true,bSilent:false,bShrinkToFit:true});");


Please feel free to contact us for any further assistance.

Best Regards,
thank you for quick replay
this code is working but for some pdf I tried it did not
I noticed that it is not working when pdf has "(Secured)" on the title
how do I get rid of that Secured status?


Hi there,

Thanks for your feedback. Please share your sample problematic document here, we will look into it and will guide you accordingly.

We are sorry for the inconvenience caused.

Best Regards,

attached here problematic document

Hi there,

Thanks for sharing your source document. It seems it is expected behavior, as your document is secured document and printing is not allowed. We follow Adobe Acrobat standards and Adobe Acrobat also does not support this.

Please feel free to contact us for any further assistance.

Best Regards,