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

Free Support Forum - aspose.com

PDF Printing is not working in local system printer setup if we access the server URL

Hi Team,

PDF Printing is not working in local system printer setup if we access the server URL (code depolyed in this server) in local system but PDF printing working if the code is in same system.

Our requirement is we deployed the code in one server.PDF Print should work in local printer setup if we access the server url in local system.

Please provide the sample code for this issue.

Used Code:

Aspose.Pdf.Facades.PdfViewer viewer = new Aspose.Pdf.Facades.PdfViewer();

viewer.BindPdf(pdfFilePath);

viewer.AutoResize = true;

viewer.Resolution = 600;

viewer.AutoRotate = true;

viewer.PrintPageDialog = true;

System.Drawing.Printing.PrinterSettings ps = new System.Drawing.Printing.PrinterSettings();

System.Drawing.Printing.PageSettings pgs = new System.Drawing.Printing.PageSettings();

System.Drawing.Printing.PrintDocument prtdoc = new System.Drawing.Printing.PrintDocument();

ps.PrinterName = prtdoc.PrinterSettings.PrinterName;

pgs.PaperSize = new System.Drawing.Printing.PaperSize("A4", 827, 1169);

pgs.Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0);

viewer.PrintDocumentWithSettings(pgs, ps);

viewer.Close();

viewer.PrintLargePdf(pdfFilePath, pgs, ps);

Thanks and Regards

Saravanan.l

Hi Team,

PDF Printing is not working in local system printer setup if we access the server url (code depolyed in this server)

but PDF printing working if the code is in same system.

Our requiremnt is we deployed the code in one server.PDF Print should work in local printer setup if we access the server url in local system

Used Code:

Aspose.Pdf.Facades.PdfViewer viewer = new Aspose.Pdf.Facades.PdfViewer();

viewer.BindPdf(pdfFilePath);

viewer.AutoResize = true;

viewer.Resolution = 600;

viewer.AutoRotate = true;

viewer.PrintPageDialog = true;

System.Drawing.Printing.PrinterSettings ps = new System.Drawing.Printing.PrinterSettings();

System.Drawing.Printing.PageSettings pgs = new System.Drawing.Printing.PageSettings();

System.Drawing.Printing.PrintDocument prtdoc = new System.Drawing.Printing.PrintDocument();

ps.PrinterName = prtdoc.PrinterSettings.PrinterName;

pgs.PaperSize = new System.Drawing.Printing.PaperSize("A4", 827, 1169);

pgs.Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0);

viewer.PrintDocumentWithSettings(pgs, ps);

viewer.Close();

viewer.PrintLargePdf(pdfFilePath, pgs, ps);

Thanks and Regards

Saravanan.l

Hi Saravanan,


Thanks for using our products.

From your above description, do you mean that as the code is deployed over server and when client accesses the system via URL and tries to print the PDF file, the application should use the printer attached to client machine or do you want the application to print the document on printer attached to server. Please share some details so that we can answer accordingly.
Hi Team,

Thanks for your reply.

Our code is deployed over server and when client accesses the system via URL and tries to print the PDF file, the application should use the printer attached to client machine .
We need to display the printer dialog box if user click the print button.In client side User should select the printer options and preview etc from printer dialog box.
Please provide us the sample code .
Thanks and Regards
Saravanan.l

Hi Saravanan,


In order to display the PrintDialog when printing the document, please follow the instructions specified at the end of Printing PDF File to Default Printer using Printer and Page Settings (Facades)

In case you still face the similar issue or you have any further query, please feel free to contact.

Hi Team,

Thanks for your reply.

I have used the same code but i am getting the below error

PrintDialog-->Error 223 The type or namespace name 'PrintDialog' could not be found (are you missing a using directive or an assembly reference?)

DialogResult--> the name "DialogResult" this does not exit in the current context.

Please help us on this.

PrintDialog printDialog = new PrintDialog();
if (printDialog.ShowDialog() == DialogResult.OK)
{
    // document printing code goes here 
    ......
}

used code:

Aspose.Pdf.Facades.PdfViewer viewer = new Aspose.Pdf.Facades.PdfViewer();

viewer.BindPdf(pdfFilePath);

viewer.AutoResize = true;

viewer.Resolution = 600;

viewer.AutoRotate = true;

viewer.PrintPageDialog = true;

viewer.PrintDocumentWithSetup();

PrintDialog printDialog = new PrintDialog();

if (printDialog.ShowDialog() == DialogResult.OK)

{

System.Drawing.Printing.PrinterSettings ps = printDialog.PrinterSettings;

System.Drawing.Printing.PageSettings pgs = new System.Drawing.Printing.PageSettings();

pgs.PaperSize = new System.Drawing.Printing.PaperSize("A4", 827, 1169);

pgs.Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0);

viewer.PrintDocumentWithSettings(pgs, ps);

}

viewer.Close();

Thanks and Regards

Saravanan.l

Hi there,


Thanks for your inquiry. Please add reference of System.Windows.Forms namespace for resolving PrintDialog and DialogResult.

Best Regards,

Hi Team,

Thanks for your reply.

We are using aspx.cs file(asp.net,c# application).
So System.Windows.Forms namesapce is not supporting.Please provide us the namespace for aspx.cs file(asp.net,c# application)

Thanks and Regards

Saravanan.l

Hi Saravanan,


Sorry for the inconvenience faced. I’m afraid Aspose.Pdf doesn’t invoke the print dialogue but use printer and page settings for printing Pdf documents. Either you can use above shared code snippet for printing on default printer without invoking print dialogue or have to write some client side script for invoking print dialogue in your code according to your requirements.

Thanks for your understanding and cooperation.

Best Regards,

Hi Team,

The above code snippet for printing is also not working in client side.The code deployed in server.(pdf file in server-Server map path) .we are trying to print pdf from client default printer without print dialog box.Print is not working in client side.Please provide the sample code and suggestion for this issue as soon as possible.

Thanks and Regards

Saravanan.l

Hi Saravanan,


Sorry for the inconvenience faced. Could you please share your sample project and error message? So we will test it at our end and will provide your more information accordingly.

Best Regards,

Hi Team,

We are getting below error when we print pdf from clientside using print dialog.

"Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application"

The below code only we are using for print pdf from client side.Our requirement is we deployed the code in server.we need to print pdf from client side but print is not working in client side.Please help us on this issue.

private void PrintPDF(){

Aspose.Pdf.Facades.PdfViewer viewer = new Aspose.Pdf.Facades.PdfViewer();

viewer.BindPdf(pdfFilePath);

viewer.AutoResize = true;

viewer.Resolution = 600;

viewer.AutoRotate = true;

viewer.PrintPageDialog = true;

System.Windows.Forms.PrintDialog printDialog1 = new System.Windows.Forms.PrintDialog();

printDialog1.UseEXDialog = true;

printDialog1.ShowHelp = true;

printDialog1.AllowSomePages = true;

if (printDialog1.ShowDialog() == DialogResult.OK)

{

System.Drawing.Printing.PrinterSettings ps = printDialog1.PrinterSettings;

System.Drawing.Printing.PageSettings pgs = new System.Drawing.Printing.PageSettings();

pgs.PaperSize = new System.Drawing.Printing.PaperSize("A4", 827, 1169);

pgs.Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0);

viewer.PrintDocumentWithSettings(pgs, ps);}

viewer.Close();

}

Thanks and Regards

Saravanan.l

Hi Saravanan,


Sorry for the inconvenience faced. As we already replied here, Aspsoe.Pdf API doesn’t invoke dialogue. In your web application you have to use Aspose.Pdf without print dialogue or use some client side script for print dialogue.

Can you please share the error message you are getting while printing without invoking print dialogue?

Thanks for your understanding and cooperation.

Best Regards,

Hi Team,

Thanks for the reply.

I am using Aspose.Pdf without print dialogue.i am not getting any error but file is not printing from client machine.Please find the Aspose PDF Version

Aspose PDF Version:7.6.0.0

Product Version:2012.12.09

Thanks and Regards

Saravanan.l

Hi Team,

Any update on this issue?

We need fix this issue asap..please help us on this..

Thanks and Regards

Saravanan.l

Hi Saravanan,


Thanks for your patience. We are looking into your issue and will update you as soon as possible…

Sorry for the inconvenience faced.

Best Regards,

Hi Saravanan,

Thanks for your patience. I've managed to observe the printing issue in web application. For further investigation I've logged an issue in our issue tracking system as PDFNEWNET-34998 and also linked your request to it. We will keep you update via this thread regarding the issue status.

Please feel free to contact us for any further assistance.

Best Regards

The issues you have found earlier (filed as PDFNEWNET-34998) have been fixed in Aspose.Pdf for .NET 9.2.0.

The blog post for this release is created over this link


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.