Vitual Printer Installation

Hello,

In my ASP .Net application, I am using 'PDFTron 6.0.1.0'.
Prior converting my docx files to xod(using pdftron.PDF.Convert.ToXod method), we are checking the presence of virtual printer, and install it if not present. For this we are using following code:
-----------------------------
        private void CheckIfVirtualPrinterRequired(string inputFilePath, out bool uninstallVirtualPrinter)
        {
            uninstallVirtualPrinter = false;
            if (pdftron.PDF.Convert.RequiresPrinter(inputFilePath))
            {
                if (pdftron.PDF.Convert.Printer.IsInstalled("PDFTron Creator"))
                {
                    pdftron.PDF.Convert.Printer.SetPrinterName("PDFTron Creator");
                }
                else if (!pdftron.PDF.Convert.Printer.IsInstalled())
                {
                    pdftron.PDF.Convert.Printer.Install();
                    uninstallVirtualPrinter = true;
                }
            }
        }
-----------------------------

However, at 'pdftron.PDF.Convert.Printer.Install();' code, I am getting SEHException:
External component has thrown an exception.
Stack Trace:
   at trn.PDF.Convert.Printer.Install(UString* )
   at pdftron.PDF.Convert.Printer.Install()
   at *****.PDFTronService.CheckIfVirtualPrinterRequired(String inputFilePath, Boolean& uninstallVirtualPrinter) in c:\***\PDFTronService.cs:line 126

I have tried after manually installing 64-bit versions of 'PDFTron Creator' and 'PDFTron PDFNet' printers, but the conversion still fails with error:
Unable to convert file, too many attempts.
Conditional expression: false, Filename : Convert.cpp, Function : trn::PDF::Convert::ToPdf, Linenumber : 1742 at pdftron.PDF.Convert.ToXod(inputFilePath, outFileName);

Please help with this issue.

Regards,
Shubham

First, the virtual printer is not actually required for Office conversion, if you have MS Office installed. If MS Office is installed, PDFNet will use Interop to communicate. RequiresPrinter returns true for office documents, though it is really optional for office documents.

The virtual printer is typically used for other file types, e.g. AutoCad DWG.

If you don’t have MS office installed, and want to convert office documents using something like LibreOffice, then yes you would need the virtual printer.

Also, you only need to install the printer once. Not every time you want to convert.

To install the virtual printer, you need to be running with elevated rights, and PDFNet 32bit|64bit needs to match your OS 32bit|64bit.

A post was merged into an existing topic: Virtual printer installation