Skip to content

PCL print jobs mistakenly detected as "ASCII" instead of application/vnd.cups-raw if header is too long #924

@olifre

Description

@olifre

Describe the bug
PCL print jobs, e.g. by Windows systems using vendor drivers, are in some cases incorrectly not detected as mime type application/vnd.cups-raw since their LANGUAGE header may be beyond the 4096 character limit.

To Reproduce
Steps to reproduce the behavior:

  1. Install a PCLv6 driver on a Windows 10 Pro / 11 Pro system, e.g. for Xerox multifunction devices, and use CUPS for printing.
  2. Print a document with long title, and / or have a lengthy username.
  3. Document is misdetected as ASCII and converted to PDF.

Expected behavior
Document correctly detected as application/vnd.cups-raw.

Print job example

Header (> 4096 bytes)
%-12345X@PJL JOB
@PJL XCPT <?xml version="1.0" encoding="UTF-8"?>
@PJL XCPT <!DOCTYPE xpif SYSTEM "xpif-v02081.dtd">
@PJL XCPT <xpif version="1.0" cpss-version="2.07" xml:lang="en-US">
@PJL XCPT       <job-template-attributes>
@PJL XCPT               <color-adjustment-set syntax="keyword">automatic</color-adjustment-set>
@PJL XCPT               <color-effects-type syntax="keyword">color</color-effects-type>
@PJL XCPT               <copies syntax="integer">1</copies>
@PJL XCPT               <document-reading-orientation syntax="keyword">portrait</document-reading-orientation>
@PJL XCPT               <embedded-profiles syntax="keyword">automatic</embedded-profiles>
@PJL XCPT               <finishings syntax="1setOf">
@PJL XCPT                       <value syntax="enum">3</value>
@PJL XCPT               </finishings>
@PJL XCPT               <halftone-text syntax="keyword">ignore-pdl</halftone-text>
@PJL XCPT               <hold-for-authentication syntax="keyword">none</hold-for-authentication>
@PJL XCPT               <image-enhancement syntax="keyword">automatic</image-enhancement>
@PJL XCPT               <interleaved-sheets-col syntax="collection">
@PJL XCPT                       <interleaved-sheets-type syntax="keyword">none</interleaved-sheets-type>
@PJL XCPT               </interleaved-sheets-col>
@PJL XCPT               <job-offset syntax="1setOf">
@PJL XCPT                       <value syntax="keyword">offset-set</value>
@PJL XCPT               </job-offset>
@PJL XCPT               <job-save-disposition syntax="collection">
@PJL XCPT                       <save-disposition syntax="keyword">none</save-disposition>
@PJL XCPT               </job-save-disposition>
@PJL XCPT               <job-sheets syntax="keyword">job-start-sheet</job-sheets>
@PJL XCPT               <client-default-attributes-col syntax="collection">
@PJL XCPT                       <media-col syntax="collection">
@PJL XCPT                               <input-tray syntax="keyword">automatic</input-tray>
@PJL XCPT                               <media-color syntax="keyword">white</media-color>
@PJL XCPT                               <media-size syntax="collection">
@PJL XCPT                                       <x-dimension syntax="integer">21000</x-dimension>
@PJL XCPT                                       <y-dimension syntax="integer">29700</y-dimension>
@PJL XCPT                               </media-size>
@PJL XCPT                               <media-type syntax="keyword">system-default</media-type>
@PJL XCPT                       </media-col>
@PJL XCPT                       <print-quality-level syntax="keyword">standard</print-quality-level>
@PJL XCPT                       <sides syntax="keyword">two-sided-long-edge</sides>
@PJL XCPT               </client-default-attributes-col>
@PJL XCPT               <print-settings syntax="keyword">none</print-settings>
@PJL XCPT               <rendering-intent-graphics syntax="keyword">automatic</rendering-intent-graphics>
@PJL XCPT               <rendering-intent-images syntax="keyword">automatic</rendering-intent-images>
@PJL XCPT               <rendering-intent-text syntax="keyword">automatic</rendering-intent-text>
@PJL XCPT               <sheet-collate syntax="keyword">collated</sheet-collate>
@PJL XCPT               <spot-color-mapping syntax="keyword">use-local-printer-values</spot-color-mapping>
@PJL XCPT       </job-template-attributes>
@PJL XCPT       <xpif-operation-attributes>
@PJL XCPT               <creator-name-attributes syntax="keyword">windows-advanced-xcpt-filter</creator-name-attributes>
@PJL XCPT               <creator-name-pdl syntax="name" xml:space="preserve">chrome</creator-name-pdl>
@PJL XCPT               <creator-version-attributes syntax="text" xml:space="preserve">V4Driver 6.159.10.0 2015 Sep-1 20:28:09-04:00 | XeroxFilter 8.110.9.0V 2024.01.11</creator-version-attributes>
@PJL XCPT               <creator-version-pdl syntax="text" xml:space="preserve">123.0.6312.59</creator-version-pdl>
@PJL XCPT               <document-format syntax="mimeMediaType">application/vnd.hp-PCLXL</document-format>
@PJL XCPT               <job-id-from-client syntax="name" xml:space="preserve">8My Lengthy User Name                      16261809</job-id-from-client>
@PJL XCPT               <job-name syntax="name" xml:space="preserve">My Very Lengthy Document Title</job-name>
@PJL XCPT               <job-originating-user-domain syntax="name" xml:space="preserve">MyLengthyHostname</job-originating-user-domain>
@PJL XCPT               <job-originating-user-name syntax="name" xml:space="preserve">My Lengthy User Name</job-originating-user-name>
@PJL XCPT               <requesting-user-name syntax="name" xml:space="preserve">My Lengthy User Name</requesting-user-name>
@PJL XCPT       </xpif-operation-attributes>
@PJL XCPT </xpif>
@PJL ENTER LANGUAGE=PCLXL
) HP-PCL XL;2;1;Comment Copyright
 2000-2015 Xerox Corporation. All Rights Reserved.
 <media-color>white</media-color>

System Information:

  • OS and its version: Seen both with old CUPS 1.6.3 on CentOS 7 and modern CUPS 2.4.7-r2 on Gentoo Linux.

Additional context
This issue seems to have become more common after Windows updates in the last weeks, likely more information is embedded into the XML before the "Enter Language" part.
I am currently using the following .types dropin as a workaround:

application/postscript          ai eps ps string(0,%!) string(0,<04>%!) \
                                contains(0,128,<1B>%-12345X) + \
                                (contains(0,4096,"LANGUAGE=POSTSCRIPT") \
                                 contains(0,4096,"LANGUAGE = Postscript") \
                                 contains(0,4096,"LANGUAGE = PostScript") \
                                 contains(0,4096,"LANGUAGE = POSTSCRIPT") \
                                 (contains(0,4096,<0a>%!) + \
                                  !contains(0,4096,"ENTER LANGUAGE"))) \
                                contains(0,128,<1B>%-12345X) + \
                                (contains(4050,8000,"LANGUAGE=POSTSCRIPT") \
                                 contains(4050,8000,"LANGUAGE = Postscript") \
                                 contains(4050,8000,"LANGUAGE = PostScript") \
                                 contains(4050,8000,"LANGUAGE = POSTSCRIPT") \
                                 (contains(4050,8000,<0a>%!) + \
                                  !contains(4050,8000,"ENTER LANGUAGE")))

application/vnd.cups-raw        (string(0,<1B>E) + !string(2,<1B>%0B)) \
                                string(0,<1B>@) \
                                (contains(0,128,<1B>%-12345X) + \
                                 (contains(0,4096,"LANGUAGE=PCL") \
                                  contains(0,4096,"LANGUAGE = PCL"))) \
                                (contains(0,128,<1B>%-12345X) + \
                                 (contains(4050,8000,"LANGUAGE=PCL") \
                                  contains(4050,8000,"LANGUAGE = PCL")))

Issue can be reproduced by running cupsfilters on the (truncated) sample job file provided above.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingplatform issueIssue is specific to an OS or desktoppriority-low

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions