DeleteNovaPrinter does not delete NVL-file
DeleteNovaPrinter does not delete NVL-file
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.
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.
-
- Posts: 286
- Joined: Wed Dec 16, 2009 12:46 pm
Re: DeleteNovaPrinter does not delete NVL-file
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.
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.
Follow us to stay updated:
- Newsletter (get a discount for subscribing): https://www.novapdf.com/newsletter.html
- Facebook: https://www.facebook.com/novapdf
- Twitter: https://twitter.com/novapdf
- Linkedin: https://www.linkedin.com/showcase/novapdf