PDFNET 6.7.1

Our application has been using PDFNET for many years now. One of the primary functions is to call Convert.ToPDF() to generate PDF’s for TEXT and OFFICE (DOC, DOCX) documents. Looking at the existing code it looks like we were required to manage the default printer on the system to ensure that during conversion the PDFNET Printer was the default printer. Is this still the case or can we, now we are upgrading PDFNET to 6.7.1, simply tell PDFNET which printer to print to. Swapping the default printer during conversion isn’t ideal as users may be multi-tasking and printing from email/word etc which if done at the wrong time can cause problems. By default, the default printer on the user machines is a physical printer, not the PDFNET Printer.

I believe you are talking about the Convert.Printer.SetPrinterName method?

PDFNet does not require the virtual printer to be the default.

What happens with the Virtual Printer, is PDFNet asks the OS to print “file.ext” to temp location “temp” using printer “X”. Where “X” is what you pass into Convert.Printer.SetPrinterName.

By default the virtual printer is called “PDFTron PDFNet”, but if you wanted to use a different name, then you would do the following.

  1. Installation
    Install the printer using your custom name. Convert.Printer.Install(“My Virtual Printer”)
    This only needs to be done once, ever, but requires elevated permission to install the printer on the OS.

  2. Tell PDFNet what printer to use
    Now every time your process runs, you would statically call Convert.Printer.SetPrinterName(“My Virtual Printer”);

PDFNet does not change the users default printer, so perhaps something else is happening.