Hi, I wrote an app that updates the Windows Registry (RegEdit) on key HKEY_CURRENT_USER\Software\PDFCreator\Program\ (using Windows API), that changes values of:
AutosaveDirectory=c:\mydir\
AutosaveFilename=myjobX
UseAutosave=1
UseAutosaveDirectory=1
For each printer job, I open the registry key and I change the “X” in “myjob” file name to 1,2,3 (myjob1, myjob2…) and I close it but PDFCreator has a delay to read this registry when have many printer jobs, that happens on the fifth or seventh printer job. For example, PDFCreator print the Description of Product number 6 in the file myjob5.pdf, with data that should be printed in the file myjob6.pdf. I verify Windows Registry after every update and before every printer job, and the Windows Registry is just updated, but PDF delay to read. When I make step over(step-by-step) in source code of my project, this works. How can I make the PDFCreator read the Windows Registry to see the changes that I made in every printer job, with no delay ?
Hi,
are you sure it is a delay and not maybe a timing issue?
Have you tried using a “action after saving” to ensure the next filename changes after the current pdf was successfully created?
regards,
Robin
Hi Robin,
I don’t know very well which one is happening, but I “solved” temporally this problem making a loop that waits some milliseconds (using “Sleep” Windows API) if the file that I was waiting doesn’t exist still, and so I increase this time wait for every loop if the file is not found, because is not a exact time, sometimes is needed to wait less than one second, sometimes is needed to wait more than a second. Lookin the Windows Registry, the filename is saved there, but the PDF Creator doesn’t read this key in the moment that I send the document to printer. This happens in a number variable of documents, sometimes when I send eight printer jobs, sometimes when I send twelve…
Solution that I used:
Do
PDFTempExists = fso.FileExists(PathPDFTemp)
If Not PDFTempExists Then
Sleep Count
End If
DoEvents
Cont = Cont + 1
Loop Until PDFTempExists Or Count = 100
Is possible to change the PDF Creator to read AutosaveFilename key for each printer job start ?