PrintDocumentWithSetup Procedure

Last post 07-04-2009, 2:15 PM by Deva_123. 2 replies.
Sort Posts: Previous Next
  •  07-01-2009, 8:59 PM 186498

    PrintDocumentWithSetup Procedure .NET

    I would like to allow the user to print a PDF document after previewing it.  I used the Aspose.PDF.Kit for this.  Before the user prints the PDF document, I would like to show a print dialog box which allows the user to specify the number of copies and the printer for printing.  I used the following codes but they don't work:


            Dim aw_PDF_Viewer As Aspose.Pdf.Kit.PdfViewer

            aw_PDF_Viewer.OpenPdfFile("D:\Customer_Letter.pdf")
            aw_PDF_Viewer.PrintDocumentWithSetup()
            aw_PDF_Viewer.ClosePdfFile()


    The above codes cause the program to freeze.

    How can I display a print dialog box and permit the user to print the PDF document?


    Thanks.




     
  •  07-02-2009, 1:34 AM 186530 in reply to 186498

    Re: PrintDocumentWithSetup Procedure

    Hi James,

    If you're using this code in a remotely hosted web application, then I'm afraid it'll not work, because in this scenario you can't show a dialog box on the client machine. However, if you're having this problem in a Win Form application then please share the PDF you're having problem with. This will help us investigate the issue at our end. We'll let you know about the results the earliest possible.

    We're sorry for the inconvenience.

    Regards,

     


    Shahzad Latif - [Follow me on Twitter!]
    Support Developer/Developer Evangelist
    Aspose Sialkot Team
    Aspose - Your File Format Experts

    Keep in touch! We're on Twitter and Facebook
     
  •  07-04-2009, 2:15 PM 186879 in reply to 186530

    Re: PrintDocumentWithSetup Procedure .NET

    I was able to get the PDF to print using the following code:


    Dim viewer As PdfViewer = new PdfViewer() viewer.OpenPdfFile(@"d:\test.pdf")

    viewer.AutoResize = true 'print the file with adjusted size

    viewer.AutoRotate = true 'print the file with adjusted rotation

    viewer.PrintPageDialog=false;//do not produce the page number dialog when printing

    viewer.PrintDocumentWithSetup()

    viewer.ClosePdfFile()





     
View as RSS news feed in XML