How to add/remove a temporary PDF printer each time my application creates the PDF?

This article applies only to novaPDF. If you don't have it yet, you must download it first.

DOWNLOAD novaPDF
Feb 22, 2019

novaPDF SDK

We strive to keep our articles as accurate as possible. If you notice any inconsistencies or outdated info please let us know.

How to add/remove a temporary PDF printer each time my application creates the PDF?

Hide novaPDF printer in the list of Printers when printing via novaPDF SDK.

By default when integrating novaPDF SDK with your application, you will print via the COM to a novaPDF Printer installed and showing in the list of Printers for the user. However, we offer a way to avoid displaying to the end user any printers in the list of Printers, thus if you do not wish a novaPDF printer visible in the Printers list, you could use this approach:

When running the novapk.exe silent installer, add next command line parameter: /DoNotAddPrinter

That means that only novaPDF printer driver and the COM are installed, but no printer is added in the Printers list.

In your application code, after creating the COM object, instead of calling the Initialize method to pass the license key, call the RegisterLicenseKey method. This method should be called only once.

And when you want to use novaPDF to convert to PDF:

  • first call AddNovaPrinter to add a temporary printer
  • set the printer options using the SetOptionXYZ methods
  • print a document, or several documents to generate PDF files
  • delete the temporary printer with DeleteNovaPrinter

You may call the AddNovaPrinter and DeleteNovaPrinter several times, the only restriction is to call it in pair so you do not leave unused printers in the printers list.

When deleting a printer it might occur for jobs that are not all processed to remain in the printer queue. If you wish to have those PDF files generated, it is better to wait for the PDF to be finished before deleting the printer. We recommended to use the event methods we provide (see help file on How to use events).

Network printing

If you wish to install novaPDF printer on a server and share it in the network, then a printer has to be added at installation time on the server. This solution works on client computers by adding a printer connection to the printer on server instead of adding a local printer.

So in this situation these are the changes:

  • the silent installer must be run on the server normally, installing a printer there (do not use the /DoNotAddPrinter parameter in this case)
  • the application code is the same, only the printer name must contain the server path, like this: \\

Restrictions

On some operating systems you need administrative rights to add/delete a printer. Below you can see a list of operating systems supported by novaPDF, and what type of user accounts are working:

Windows 2000  
Administrator - working  
Power user - working  
User - working

Windows 2003 X64
Administrator - working  
Power user - Not working  
User - Not working

Windows XP X64  
Administrator - Working  
Power user - Now working  
User - Not working

Windows 2008 X64  
Administrator - Working  
Power User - Not working  
User - Not working

Windows Vista X64  
Administrator - Working  
Power user - Working  
User - Working

Windows 7 X64  
Administrator - Working  
Power user - Working  
User - Working

Windows XP 32 bit  
Administrator - Working  
Power user - Not working  
User - Not working

Windows 2003 32 bit  
Administrator - working  
Power user - Not working  
User - Not working

Windows 2008 32 bit  
Administrator - Working  
Power user - Not working  
User - Not working

Windows Vista 32 bit  
Administrator - Working  
Power user - Working  
User - Working

Windows 7 32 bit  
Administrator - Working  
Power user - Working  
User - Working