Printing with .NET is slow

The Amyuni PDF Converter is our Printer Driver that enables you to convert any documents to PDF format. If you have any questions about installing and using the Amyuni PDF Converter please post them here.
Post Reply
floele
Posts: 8
Joined: Wed Nov 14 2007

Printing with .NET is slow

Post by floele » Fri Aug 20 2010

Hi,

I'm using 4.0.1.0 of the Amyuni PDF Converter, on Win7 x64. I'm printing a document of 3 pages to the PDF printer using C#/.NET 2.0, but it is very slow (10 seconds).
I wonder why that is, because both a print preview (with PrintPreviewDialog) of the document and printing a document with the same printer using a different component of my application (written in C++) is much faster.

The code for printing is basically this:

Code: Select all

        public void PrintDocumentToPdf(PrintDocument document, string filename)
        {
            DriverInit (this.m_sPDFDriverName);
            SetDefaultFileName (this.m_iPrinterHnd, filename);
            SetFileNameOptions (this.m_iPrinterHnd, FileNameOption.NoPrompt | FileNameOption.UseFileName );
            document.PrintController = new StandardPrintController();
            document.PrinterSettings.PrinterName = this.m_sPDFDriverName;
            document.Print();
        }
Looking for differences between the C# and C++ way of doing things, I noticed that the C# version results in a file with PDF version 1.3, and the C++ version outputs 1.4. Could that be a speed difference? And if so, how do I set the PDF version option? Couldn't find anything in the docs.

Regards,
Florian

Post Reply