Page 1 of 1

DeleteNovaPrinter does not delete NVL-file

Posted: Mon Jul 02, 2012 11:54 am
by lawit
Hi there,

we are using novaPDF with temporary printers for the print jobs. We call AddNovaPrinter with dynamically created printer names. Then we add and adjust profiles to let novaPDF silently create the desired PDF file.
After waiting for NOVAPDF_EVENT_FILE_SAVED we call SetActiveProfile with the original default profile, DeleteProfile with the temporary profile and DeleteNovaPrinter to finally remove the printer itself.

But how can we get novaPDF to not only remove the printer object from the system but also the created settings file in c:\Users\<user>\AppData\Roaming\Softland\novaPDF\ ?

Regards,
Lars Wittenburg

PS: How come that SetActiveProfile for the original active profile name does not work properly in this scenario? We got the error "unknown profile" if we used it like in the example for "Temporary printer". By trial and error we found out that we have to call it directly after GetActiveProfile (and before SetActiveProfile for the new temporary profile). Only then we could set the original active profile back at the end and after that successfully remove our temporary profile.

Re: DeleteNovaPrinter does not delete NVL-file

Posted: Tue Jul 03, 2012 7:46 am
by Claudiu (Softland)
Hello, the settings file from the Application data folder is not deleted indeed when deleting the printer. We considered that this file may be used later on when the same printer is re-added and do not loose the profiles. But if you use ramdom printer names, this can end up indeed with many setting files left in this folder. For the moment we do not have a solution, you have to delete the file from your code. As you probably noticed, the file name is always <printer name>.nvl and is located in the AppData for current user.

I checked the Temporary printer sample, and it does not give this error here. I did not understand when exactly is this exception thrown, but it might be related to the fact that when a printer is first created there is no profile for it. The default profile (and the settings file) is created when the printer is first used, or when profiles are first saved from the code (when calling EndUpdateProfiles).

Thank you.