Free Support Forum - aspose.com

CLOSED: Is non-interactive printing in a Web-Service/Windows-Service supported?

Hi Aspose-Support,

we are investigating a customer request and need the capability to print existing PDF files to a Ghostscript printer driver to create a postscript file. This must be done non-interactively in the context of a windows service or a web service. Since PdfViewer class it is a viewer, it might have a dependency to GUI elements and environment and it even has properties like "PrintPageDialog", so I am not shure if it can be used on the server. Is this supported by PdfViewer?

Additionally, is there another way of converting a PDF to a Postscript using Aspose technology?

Best regards,
Ernst

Hi Ernst,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Currently, Aspose.Pdf for .NET does not support the
conversion of PDF to PostScript. We already have a new feature request
registered in our issue tracking system with issue id:
PDFNEWNET-29340. But I am afraid that this feature
may not be available soon.<o:p></o:p>

Regarding PdfViewer, it is a class in
Aspose.Pdf.Facades namespace which can be used for printing the PDF document
programmatically. It supports printing to a physical printer and virtual
printers like Adobe PDF and XPS printers. I am not sure whether it will work
fine with
Ghostscript printer driver. Please download the latest version of Aspose.Pdf for .NET v6.7
and try it. Please see the following sample code
regarding Printing of PDF file using the Default Printer. <o:p></o:p>

Printing
PDF File to Default Printer using Printer and Page Settings
<o:p></o:p>

Printing
PDF to an XPS Printer
<o:p></o:p>

Please feel free to contact support in case you have any
further queries.<o:p></o:p>

Thank You & Best Regards, <o:p></o:p>

Hi,

thanks for the Info. My primary question was if printing is supported not only in an interactive windows application but within a Windows service or web service where no interactive context ist present. So it is required to make sure that e.g. no form to be confirmed by a user may ever be visible.

Could you please give me this information as well?

Thanks, Ernst

Hi Ernst,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

You can use PdfViewer class of Aspose.Pdf.Facades namespace in Windows Services / Web Services for printing the PDF documents without user interaction. You can set Page and Printer settings (like PrintPageDialog to false to disable the Print Dialog). You can check the documentation links shared above for further details.

Thank You & Best Regards,

Great, thanks!

Ernst

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


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

Hello Aspose-Support,

this is great news. Can you please point me to a code sample or documentation that demonstrates how to do that? Is there more info about which features are supported and which are not yet implemented? Since this is the first version able to do this conversation I expect it to have some spots that are not covered yet.

Thanks, Ernst

Hi Ernst,

Please note that in order to convert PDF file into PostScript file, first you should install any PS printer and just print to file with the help of PdfViewer. You may follow the instructions specified over following link (http://www.hawaii.edu/askus/637) on how to install PS printer.

The following code snippet produces Hello.ps from Hello.pdf.

[C#]

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

viewer.BindPdf("Hello.pdf");

//set PrinterSettings and PageSettings

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

printerSetttings.Copies = 1;

//set PS printer, one can find this driver in the list of preinstalled printer drivers in Windows

printerSetttings.PrinterName = "HP LaserJet 2300 Series PS";

//set output file name and PrintToFile attribute

printerSetttings.PrintFileName = "d:/Hello.ps";

printerSetttings.PrintToFile = true;

//disable print page dialog

viewer.PrintPageDialog = false;

//pass printer settings object to the method

viewer.PrintDocumentWithSettings(printerSetttings);

viewer.Close();



You may consider using GSview or any other software to view the PostScript files.

Hello Aspose Support,

support for this was announced in new version, but what is the new feature then?

This was possible all the time (with some limitations in the PostScript generated). I really hoped that you would were announcing some new support for native conversions.

Best regards,
Ernst

Hi Ernst,


Thanks for following up. You are right its not a new feature but a workaround for the requirement. As the requirement/issue was logged as new feature in our issue tracking system so its resolution/workaround published in new feature category in current release.

Sorry for the inconvenience faced.

Best Regards,