lock function

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
sabbadin
Posts: 3
Joined: Fri Mar 13 2009

lock function

Post by sabbadin »

this funztion behaviour is not clear to me.
documentation says "The CDIntf library uses the registry to interact with the printer drivers.
This can cause conflicts when multiple applications use CDIntf to access the printer drivers." .. however on another part is written "szLockName
[in] Lock identifier, this should be the document title as it appears in the print spooler when printing any
document."

Are the registry settings to be protected global ? if so why one have to specify a "job specific" name to the lock ?

thank you
best regards
e. sabbadin
David
Amyuni Team
Posts: 89
Joined: Mon Dec 18 2006

Re: lock function

Post by David »

Hello

Here is a brief explanation of the locking function.

Since the settings of the PDF printer are global in the registry, we need to synchronize access to it when dealing with multithreads printing. The Lock Unlock methods accomplish that by instructing the spooler to get the settings per job, by its job name/id.

What Lock does actually is reserve a private area where the settings for that specific job would go and SetDocFileProps() would set the preferences for the job. When the job is being printed, the spooler gets the settings for that job and then deletes that private place. What Unlock does is simply delete that private area in case the print job / spooler failed. The Unlock timeout value therefore should be very large, to give enough time for the job to finish printing. Even if unlock was not called, the print spooler unlocks the reserved area as soon as it retrieves the needed settings from it.

In case of 2 print jobs having the same job/document name (ex: Crystal reports), they are serialized and print one after the other.

Other than that, print jobs can ran simultaneously, each taking their settings from his private reserved area.

Hope that helps?

David
Amyuni Custom Development
Do you need a specific PDF solution? Are you looking for expertise that will enable you to start or complete a PDF integration project?
http://www.amyuni.com/en/company/services.php
Post Reply