Bug Report T694788
Visible to All Users

Printing - The 'Collate' option doesn't work if a specific printer driver does not support collating

created 6 years ago

When you open a pdf in the pdf viewer and increase the number of copies to 2, then check the collate checkbox, then click Print, the output is not collated.

This occurs in your demo app version 18.2.3.

The collate functionality works in demo version 18.1. 7.

This is a major issue for us.

Also, It seems when you increase the number of copies from 1 to a larger number the collate checkbox should automatically check itself like it does in adobe reader.

Please advise.

Thanks, Pat

Show previous comments (2)
DevExpress Support Team 6 years ago

    Thank you for the update. I have tried to print to a network printer, and the Collate settings operate as expected.

    Would you please check if the issue is reproducible with another printer? If not, please clarify which printer and its driver you are using.

    As you know, we introduced DirectX rendering and XPS printing API for our PdfViewerControl in version 18.2. Disable the CompatibilitySettings.RenderPDFPageContentWithDirectX option to revert to the previous rendering engine. Please let us know if the issue occurs with this option.

      I know this happens on multiple printers.

      Here are 2 printers it happens on.  I'm pretty sure the issue occurs on our other HP Printers which use the same driver.

      HP LaserJet M4555 MFP
      HP LaserJet 500 color M551

      Both are using print driver HP Universal Printing PS(v6.0.0) (61.175.1.18849)

      The local printers it works on do not use that driver.

      To get around this issue I set the

      e.PrinterSettings.EnableLegacyPrinting = true;

      PageSetupDialogShowing event and that seems to have fixed this issue.  But I'm not sure if that will create any other issues.
      Can you explain what the EnableLegacyPrinting property is for?

      I can't set the  CompatibilitySettings.RenderPDFPageContentWithDirectX  today but will try tomorrow to see if that has any affect.

      DevExpress Support Team 6 years ago

        I've reproduced the issue with the HP Universal Printing PostScript printer driver. It appears that this issue is printer driver specific. According to our test, this printer driver does not support the Collate option.

        I have discussed this subject with our developers. They will research the possibility of generating printing output (preparing pages in the required order) at the level of our controls for such printer drivers. However, this solution may increase print job significantly. We will get back to you once we have any results.

        In the meantime, we recommend you test other printer drivers for your printer, for instance, HP Universal Print Driver for Windows PCL6.

        >>Can you explain what the EnableLegacyPrinting property is for?<<
        The PdfPrinterSettings.EnableLegacyPrinting property turns on the PdfViewer's legacy (previous) printing mode. When the EnableLegacyPrinting option is enabled, we manually generate and rasterize images and send them to a printer. This operation is slower than the new printing mechanism, however, with the old mechanism there is no direct dependency from a printer driver.

        Answers approved by DevExpress Support

        created 6 years ago

        We have fixed the issue described in this ticket and will include the fix in our next maintenance update. To apply this solution before the official update, request a hotfix by clicking the corresponding link for product versions you require.

        Note: Hotfixes may be unavailable for beta versions and updates that are about to be released.

          Show previous comments (19)
          DevExpress Support Team 6 years ago

            Please accept my sincere apologies. I missed the fact that you pointed the WPF PdfViewerControl product initially. I have created a sample for  WPF PdfViewerControl as well. You can find the project in the attachment.

            I have also attached a file with the PdfViewerControl descendant implementation for your reference.

            As for the screenshot you provided, as far as I see, you tested the application running on your machine (since the DevExpress assemblies are loaded from GAC in your screenshot) Just in case, please check the deployed application on the server. Are the corrected assemblies loaded there?

              I was able to use pieces of the code you provided to get my collating working…Thank you!

              However, the collate functionality that was supposed to be in the Hot fix still does not work.

              We were able to bring up a test printing environment where we installed HP Universal Printing PS (v6.6.5) (61.220.1.23510) on the print server, we used a PC which has NOT had DevExpress installed (so it would not have any devexpress dll in the GAC) and ran the Devexpress PdfViewer Demo with devexpress dll's with file version 18.2.3.18341.  Collating multiple copies did not work.  It printed pages 1,1,2,2,3,3.

              Is it possible that the code for fixing the collate is not in the Hot fix version you sent us?

              Also, the collate logic you provided in the code above (and potentially in the hot fix) is not correct if you choose to print 2 copies of a 3 page document and you want them duplexed.  The first page of the second copy got printed on the back page of the first copy.

              DevExpress Support Team 6 years ago

                I also installed the 18.2.3.18341 hotfix and the HP Universal Printing PS (v6.6.5) printer driver on my machine (see the attached video). However, the hotfix operates properly on my side.
                Check to see if there are any handled exceptions while printing documents. If so, please send us the full error call stack and exception message (follow instructions from the How to obtain the exception's call stack article to collect them).

                Otherwise, debug a demo project locally (see the How can I debug DevExpress .NET source code using PDB files article to get started). Particularly, check if the "Collate" condition is satisfied in the DevExpress.Pdf.Drawing.Printing.DocumentPrinter.Create method.

                C#
                public static DocumentPrinter Create(PdfDocumentState documentState, PdfPrinterSettings printerSettings, int currentPageNumber, IPdfPrintingCallbackProvider callbackProvider) { int pageCount = documentState.Document.Pages.Count; IEnumerable<int> pageNumbers = printerSettings.GetPageNumbers(currentPageNumber, documentState.Document.Pages.Count, null); if (pageNumbers == null) return null; pageNumbers = pageNumbers.Where(pageNumber => pageNumber > 0 && pageNumber <= pageCount).Select(number => number - 1); if (!pageNumbers.Any()) return null; PdfCachedPrinterSettings settings = printerSettings.CachedSettings; short copyCount = settings.Copies; int maxCopies = settings.MaximumCopies; List<int> pageIndices; if (copyCount > maxCopies || (settings.Collate && copyCount > 1 && !settings.SupportCollate)) { settings.Copies = 1; pageIndices = new List<int>(); if (settings.Collate) { List<int> indices = pageNumbers.ToList(); for (int copy = 0; copy < copyCount; copy++) pageIndices.AddRange(indices); } else foreach (int pageNumber in pageNumbers) pageIndices.AddRange(Enumerable.Repeat(pageNumber, copyCount)); } else pageIndices = pageNumbers.ToList(); return new DocumentPrinter(pageIndices, documentState, printerSettings, callbackProvider); }

                >> the collate logic you provided in the code above (and potentially in the hot fix) is not correct if you choose to print 2 copies of a 3 page document and you want them duplexed.  The first page of the second copy got printed on the back page of the first copy.<<
                This behavior is expected since the page order is specified directly instead of copying the document with the NumCopies  settings. The only possible way to overcome this side effect is to print the document several times (according to the NumCopies  settings) without duplicating pages.

                Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

                Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.