Page 1 of 1

Best way to print a pdf document

Posted: Wed Dec 02, 2009 12:53 pm
by benilu
Hello,

We are using version 6.4.0.9 of GDPicture.NET.dll.

I have to do the following in a .NET application Iam developing:

* Load a document stored on the file system. (without showing it)
* Print its content. Printing should not be blocking the application, so it has to run in background.
* Delete de document from the file system.


This is the way I am trying to perform this printing (pseudo code):

Code: Select all


Public Sub PrintDoc()

Dim pathOfDoc = ... 'here I set the path to the document

'I create a new viewer in order to load the document
'NOTE: I don't show the viewer itself on the GUI
Dim mygdviewer as New GDviewer
mygdviewer.DisplayFilefromByteArray (IO.File.ReadAllBytes(pathOfDoc))

'I set the pages to print
mygdviewer.PrintSetFromToPAge(1, mygdviewer.PageCount)

'I tell the viewer to pring
mygdviewer.PrintFit()

'I delete the file
IO.File.Delete(pathOfDoc)




In order to perform background printing I call PrintDoc() from a separate thread (is that a good idea?)

So, now I get following problems/questions:

* Printing is slow
* I don't know how to avoid the prinitng dialog
* Is there another class for printing than GDViewer?
* What is the best way to print the pdf file when no displaying of the file is required?
* The GDViewer in my separate thread seems to interfere with other GDViewers displayed in my GUI. Once I have printed, I get error messages when I continue using other GDViewers instantiated before printing. NOTE: My aplication contains a tab control that displays one GDViewer per tab page. So, several GDViewer can be displayed at the same time.


Can you answer my questions?

Best regards!

Re: Best way to print a pdf document

Posted: Wed Dec 02, 2009 7:57 pm
by Loïc
Hi,

The current version is not thread safe for PDF rendering. We will add this support ASAP.

To avoid printing dialog I suggest you ta call the PrintSetShowPrintingProgress(False) & use printing method such as PrintImage() instead of PrintImageDialog()...

If you encounter any problem related to bad PDF rendering/printing, please send your file to our support team at esupport (at) gdpicture (dot) com.

With best regards,

Loïc