[PDFNet] Printing PDF/XPS using PDFNet SDK

Q: Do you have pdf printing SDK in your product stack that can offer
me follwoing features.

1. It should print a pdf document through C# code, running as a window
2. It should print on the printer and tray / paper source , specified
3. Page size and orientation can be set dynamically.
4. It should work in multithreaded environment.

This tool should be preferably in the form of a dll, so that it can be
encapsulated in our application and can be deployed at multiple
location. Can I use PDFNet SDK for high quality and efficient PDF
A: There are several ways to print a PDF document using PDFNet. In
case you are running Windows 7 or Vista with Platform Update the
optimal solution would be to use
'pdftron.PDF.Print.StartPrintJob(...)' as shown in PDFPrint sample:

The main disadvantage of StartPrintJob is that it does not offer as
much flexibility as printing using PDFDraw.DrawInRect(which is also
showin in the above PDFPrint sample). Using pdfdraw.DrawInRect you
have full flexibility to set all DEVMODE properties on the printer and
to render a page in a given region on the output HDC/Graphics context.
The main disadvantage of pdfdraw.DrawInRect() is that it only supports
bitmap or EMF output so the performance is usually worse than printing
via XPS print path.

On client side you can also use pdftron.PDF.Convert.ToXPS() method (as
shown in Convert sample http://www.pdftron.com/pdfnet/samplecode.html#Convert)
to convert PDF to XPS and then print the XPS using .NET API. For

try {
  pdftron.PDF.Convert.ToXps(input_file, output_xps); }
catch (PDFNetException e) { Console.WriteLine(e.Message); }

// Print XPS (see http://msdn.microsoft.com/en-us/library/aa969772.aspx)
LocalPrintServer localPrintServer = new LocalPrintServer(); PrintQueue
defaultPrintQueue = LocalPrintServer.GetDefaultPrintQueue();
PrintSystemJobInfo xpsPrintJob = defaultPrintQueue.AddJob(output_xps,
nextFile, false);

Unfortunately XPS support is part of WPF and according to MSDN (http://
msdn.microsoft.com/en-us/library/bb613549.aspx), the use of WPF in
Windows services is unsupported. By extension XPS printing with .Net,
including use of System.Printing, is also unsupported for services. On
the other hand the use of 'pdftron.PDF.Print.StartPrintJob(...)' in
Windows services is safe and is supported.

All of the above methods of printing PDF using PDFNet are safe for
multithreaded execution.

You received this message because you are subscribed to the "PDFTron PDFNet SDK" group. To post to this group, send email to support@pdftron.com
To unsubscribe from this group, send email to pdfnet-sdk-unsubscribe@googlegroups.com. For more information, please visit us at http://www.pdftron.com