PDF to PostScript conversion

The following code snippet also work with Aspose.PDF.Drawing library.

PDF To Postscript in C#

The PdfViewer class provides the capability to print PDF documents and with the help of this class, we can also convert PDF files to PostScript format. To convert a PDF file into PostScript, first install any PS printer and just print to file with the help of PdfViewer. To install a PS printer, refer to instructions provided by your printer vendor. The following code snippet shows you how to print and convert a PDF to PostScript format.

Checking Print Job Status

A PDF file can be printed to a physical printer as well as to the Microsoft XPS Document Writer, without showing a print dialog, using the PdfViewer class. When printing large PDF files, the process might take a long time so the user might not be certain whether the printing process completed or encountered an issue. To determine the status of a printing job, use the PrintStatus property. The following code snippet shows you how to print the PDF file to an XPS file and get the printing status.

Get/Set Print Job Owner name

Sometimes there occurs a need to get or set the print job owner name (i.e., the actual user who pressed a print button on a web page). This information is required when printing the PDF file. In order to accomplish this requirement, the property PrinterJobName is used.

Using Impersonation

Another approach of getting the Print Job owner name is to use impersonation (running printing routines in another user context) or user may change owner name directly by using SetJob routine.

Please note that there is no possibility to set owner value using Aspose.PDF printing API by security considerations. The property PrinterJobName may be used to set document name column value in spooler print application. Code snippet shared above just shows how the user can join user name into document name column (for example using syntax UserName\documentName). But the setting of Owner columns can be implemented in following ways directly by user:

  1. Impersonation. As owner column value contains the value of user who runs the printing code, there is a way to invoke Aspose.PDF printing API inside another user context. For example, take a look on solution described here. Using this Impersonator class the user can reach a goal:
  1. Using Spooler API and SetJob routine

The following code snippet shows how to print some pages of PDF file in Simplex and some pages in Duplex mode.