Search code examples
c#.netpdfpdftron

PdfTron printing multiple copies not work correctly


When printing multiple copies with pdftron sdk with following circumstances,

  • document having odd number of pages
  • printing 2 copies
  • double sided printing

The documents not separate correctly. That is, 1st page of 2nd document printed on other side of the sheet of 1st document.

Print mode is set as follows,

public static PrinterMode GetPdfPrint(PrinterInformation printerInformation, PrintQueue printQueue, int numberofCopies)
        {
            PrinterMode printerMode = new PrinterMode();

            printerMode.SetDuplexing(PrinterMode.DuplexMode.e_Duplex_Auto);

            printerMode.SetCollation(true);

            printerMode.SetAutoRotate(true);

            printerMode.SetCopyCount(numberofCopies);

            printerMode.SetScaleType(PrinterMode.ScaleType.e_ScaleType_FitToOutputPage);

            printerMode.SetAutoCenter(true);

            return printerMode;
        }        

can someone help me to get the second copy starts from new sheet?


Solution

  • I was not able find a solution by pdftron side to the question so, went with a manual logic to address the question.

     if(pdfdoc.GetPageCount()%2 != 0 && numberofCopies > 1 && printDuplex != Duplex.Simplex)
    {
      Page blankPage = pdfdoc.PageCreate();
      pdfdoc.PagePushBack(blankPage);
    }
                                    
    pdfdoc.InitSecurityHandler();
                                    
    Print.StartPrintJob(pdfdoc, printQueue.FullName, documentName,string.Empty, new PageSet(1, pdfdoc.GetPageCount(), PageSet.Filter.e_all), printerMode, null);