Convert djvu to pdf using PDFNet / pdftron

Product: PDFNet / pdftron

Product Version: 5.9.2.0

Please give a brief summary of your issue:
My Requirement is Converting => Convert djvu to pdf using PDFNet / pdftron

Please describe your issue and provide steps to reproduce it:

My Requirement is convert djvu file to PDF .
i use below code for the same

  1. Check if virtual printer installed or not

lse if (!pdftron.PDF.Convert.Printer.IsInstalled())
{
try
{
Console.WriteLine(“Installing printer (requires Windows platform and administrator)”);
pdftron.PDF.Convert.Printer.Install();
Console.WriteLine("Installed printer " + pdftron.PDF.Convert.Printer.GetPrinterName());
// the function ConvertToXpsFromFile may require the printer so leave it installed
// uninstallPrinterWhenDone = true;
}
catch (PDFNetException e)
{
Console.WriteLine(“ERROR: Unable to install printer.”);
Console.WriteLine(e.Message);
err = true;
}
2) Convert DJVU file to PDF

using (pdftron.PDF.PDFDoc pdfdoc = new PDFDoc())
{
//Orginal Code Start

                                if (pdftron.PDF.Convert.RequiresPrinter(inputPath + file.inputFile))
                                {
                                      Console.WriteLine("Using PDFNet printer to convert file " + file.inputFile);
                                }                                   
                                pdftron.PDF.Convert.ToPdf(pdfdoc, inputPath + file.inputFile);
                                pdfdoc.Save(outputPath + file.outputFile, SDFDoc.SaveOptions.e_linearized);
                                Console.WriteLine("Converted file: " + file.inputFile);
                                Console.WriteLine("to: " + file.outputFile);                                  

                          }

Although it gives me below error
PDFNet is running in demo mode.
Installing printer (requires Windows platform and administrator)
Installed printer PDFTron PDFNet
Package: base
Using PDFNet printer to convert file Example.djvu
ERROR: on input file Example.djvu
Exception:
Message: An error occurred while converting the file.
Detailed error:
Exception:
Message: Unable to convert file, too many attempts.
Conditional expression: attemptCount < MaxAttempts
Version : 10.8.0-842bd75fad
Platform : .Net Framework
Architecture : AMD64
Filename : Convert.cpp
Function : trn::PDF::Convert::printToPrinter
Linenumber : 3217

      printing to printer D:\WORK\IV Question\ Questions QP_New\C#_D_JAN_2024_1_1\pdftron\PDFNetDotNet4\PDFNetDotNet4\Samples\TestFiles\Example.djvu
      AssocQueryString printto:
      AssocQueryString print  :
      Created new PDFNet Mutex
      WaitForSingleObject start
      WaitForSingleObject End
      printo: C:/Users/Shashank/AppData/Local/Temp/pdftron/Trn-13484-1714058778-b04f16f5-c98d-40dd-bd0d-3c077ff47ee7.xps
      Using HKCU
      PrinterManager initialized
      ShellExecuteExW using verb 'printto', printer '"PDFTron PDFNet"' on file 'D:\WORK\IV Question\ Questions QP_New\C#_D_JAN_2024_1_1\pdftron\PDFNetDotNet4\PDFNetDotNet4\Samples\TestFiles\Example.djvu'
      Skipping 'printto' since no verb association detected
      ToPdf using verb 'print', on file 'D:\WORK\IV Question\ Questions QP_New\C#_D_JAN_2024_1_1\pdftron\PDFNetDotNet4\PDFNetDotNet4\Samples\TestFiles\Example.djvu'
      ToPdf ShellExecuteEx 'print' returned error 1155: No application is associated with the specified file for this operation.

      ToPdf did not create a new process -- application already running? 0
      waiting for print job: state 3, attempts 0
      waiting for print job: state 3, attempts 1
      waiting for print job: state 3, attempts 2
      waiting for print job: state 3, attempts 3
      waiting for print job: state 3, attempts 4
      waiting for print job: state 3, attempts 5
      waiting for print job: state 3, attempts 6
      waiting for print job: state 3, attempts 7
      waiting for print job: state 3, attempts 8
      waiting for print job: state 3, attempts 9
      waiting for print job: state 3, attempts 10
      waiting for print job: state 3, attempts 11
      waiting for print job: state 3, attempts 12
      waiting for print job: state 3, attempts 13
      waiting for print job: state 3, attempts 14
      waiting for print job: state 3, attempts 15
      waiting for print job: state 3, attempts 16
      waiting for print job: state 3, attempts 17
      waiting for print job: state 3, attempts 18
      waiting for print job: state 3, attempts 19
      waiting for print job: state 3, attempts 20
      waiting for print job: state 3, attempts 21
      waiting for print job: state 3, attempts 22
      waiting for print job: state 3, attempts 23

.

waiting for print job: state 3, attempts 999
Error destructing ToPdfPrinterManager

     Conditional expression: false
     Version      : 10.8.0-842bd75fad
     Platform     : .Net Framework
     Architecture : AMD64
     Filename     : Convert.cpp
     Function     : trn::PDF::Convert::ToPdf
     Linenumber   : 2353

ConvertFile failed
ConvertSpecificFormats failed

Please provide a link to a minimal sample where the issue is reproducible:

May i know if djvu to PDF file conversion is supported by PDFNet ?

Thanks in advance

Many Thanks
Shashank Kulkarni

Printing using the Windows virtual printer requires that an application be installed on the machine to send the print job to the PDFNet printer. What application do you have installed to handle the djvu files for printing? Can you also provide the file you are trying to convert as well?

Here is more information on using the Windows virtual printer:

Hi ,
Thank you for your reply,

Example.djvu file is attached with this thread for reference.

What application do you have installed to handle the djvu files for printing?
I used be PDFNet/PDFNetLoader/PresentationCore dll

below is code i use to convert djvu to pdf

May i ask , can we convert .djvu file to bitmap/png file ? If yes then does PDFnet support for this ?
using pdftron;
using pdftron.Common;
using pdftron.Filters;
using pdftron.SDF;
using pdftron.PDF;

1) Install PDF Printer


2)Print djvu file using PdfTron-pdfnet printer

3) PDFTron PDF printer was installed successfully with Step 1

Example.djvu (207.1 KB)

With above code and File attached i got error which is attached with this thread error.txt
Error.txt (49.7 KB)

Link mentioned file list does not include any djvu file conversion support.

Kindly Suggest if any alternative know, to convert this djvu file to pdf.

Many Thanks
Shashank Kulkarni

To print using the PDFNet SDK virtual printer you need to have an application installed to print your DJVU file. In your error log we see the following:

“ToPdf ShellExecuteEx ‘print’ returned error 1155: No application is associated with the specified file for this operation.”

The SDK cannot find the application associated with the file type to print to PDF. You need to install one, see the link I provided with more information on using the Windows virtual printer.

Hello ,
Thank you for your reply.

Your Comment:
To print using the PDFNet SDK virtual printer you need to have an application installed to print your DJVU file

My Query:

point 1) “virtual printer you need to have an application installed to print your DJVU file**”
–May i check ,Which Application we need to install to print DJVU file ? ?

We tried to installed all possible Virtual Printer on windows

Point 2) Another forum says .djvu file to PDF conversion is not supported by PDFNet with out 3rd party application…

PDFNet (Apryse) documentation does not include .djvu file format for conversion, as per above official documentation.

Kindly suggest your valuable opinion on Point 1 and Point 2

Many Thanks
Shashank

Kindly suggest your valuable opinion on Point 1 and Point 2
Points 1 and 2 are the same issue. When printing to the virtual printer you must have an application installed that will print your file type. This is not a Apryse software package but a third party application that you can print your DJVU files with. You will need to find an appropriate application and install it, we do not have a list of applications for printing DJVU files.

Ok Thanks for re-confirmation,
Appreciate your response multiple times.
Have a Good day.

Many Thanks
Shashank

You’re welcome Shashank, happy to help.