[cups.bugs] [MOD] STR #3281: CUPS Fails to handle poscrtipt generated by Adobe Flash Player

Ian Dall ian at beware.dropbear.id.au
Thu Aug 6 08:37:20 PDT 2009


DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Printing from flash plugins fails. This appears to be because cups doesn't
like the Document Structure Convention comments:

 $ cupstestdsc adobe-flash.ps
adobe-flash.ps: FAIL
    Missing or bad %%Pages: comment!
        REF: Page 43, %%Pages:
    Missing or bad %%Page: comments!
        REF: Page 53, %%Page:
    Warning: no %%EndComments comment in file!

 $ grep '^%' adobe-flash.ps
%!PS-Adobe-3.0
%%BoundingBox: 0 0 612 792
%%PageTrailer
%%Trailer
%%EOF

If I replace the first line with just %! it prints OK. The problem seems
to be in ps2ps.

 $ cupsfilter -m application/vnd.cups-postscript adobe-flash.ps >
abobe-flash-1.ps
DEBUG: argv[0]="cupsfilter"
DEBUG: argv[1]="1"
DEBUG: argv[2]="user"
DEBUG: argv[3]="adobe-flash.ps"
DEBUG: argv[4]="1"
DEBUG: argv[5]=""
DEBUG: argv[6]="adobe-flash.ps"
DEBUG: envp[0]="<CFProcessPath>"
DEBUG: envp[1]="CUPS_DATADIR=/usr/share/cups"
DEBUG: envp[2]="CUPS_FONTPATH=/usr/share/cups/fonts"
DEBUG: envp[3]="CUPS_SERVERBIN=/usr/lib/cups"
DEBUG: envp[4]="CUPS_SERVERROOT=/etc/cups"
DEBUG: envp[5]="LANG=en_US.UTF8"
DEBUG:
envp[6]="PATH=/usr/lib/cups/filter:/usr/bin:/usr/sbin:/bin:/usr/bin"
DEBUG: envp[7]="PPD=/usr/share/cups/model/laserjet.ppd"
DEBUG: envp[8]="RIP_CACHE=8m"
DEBUG: envp[9]="USER=user"
INFO: pstops (PID 16257) started.
DEBUG: slow_collate=0, slow_duplex=0, slow_order=0
DEBUG: Before copy_comments - %!PS-Adobe-3.0
DEBUG: %!PS-Adobe-3.0
DEBUG: %%BoundingBox: 0 0 612 792
ERROR: No %%Pages: comment in header!
DEBUG: Before copy_prolog - 0 792 translate
DEBUG: Before copy_setup - DEBUG: Before page loop - DEBUG: Wrote 0
pages...
INFO: pstops (PID 16257) exited with no errors.


And now:

 $ grep '^%' adobe-flash-1.ps 
%!PS-Adobe-3.0
%%For: (dalli)
%%Title: (adobe-flash.ps)
%RBINumCopies: 1
%%Pages: (atend)
%%BoundingBox: (atend)
%%EndComments
%%PageTrailer
%%Trailer
%%EOF
%%BeginProlog
%%EndProlog
%%BeginSetup
% Disable CTRL-D as an end-of-file marker...
% x y w h ESPrc - Clip to a rectangle.
% x y w h ESPrf - Fill a rectangle.
% x y w h ESPrs - Stroke a rectangle.
%%EndSetup
%%Trailer
%%Pages: 0
%%BoundingBox: 2147483647 2147483647 -2147483648 -2147483648
%%EOF

Note that despite pstops printing reporting "ERROR: No %%Pages: comment in
header!" it exits with no errors! It also does output a postscript file,
albeit one with DSC comments indicating zero pages. What happens then
probably depends on the backend or subsequent filters. The pipslite filter
goes into an infinite loop. Behaviour of various postscript printers will
depend on their implementation and I don't know what pstoraster does.

The thing is, according to the Adobe Document Structure Convention 3,
there are NO required comments and it seems to me that the Flash Plugin's
output is correct if unhelpful.

I can get reasonable behaviour by making a custom filter to change the
first comment as follows:

/etc/local.types:
application/local.dodgy-postscript string(0,"%!PS-Adobe-3.0") +
!contains(0,4096,"%%Pages:")

/etc/local.convs:
application/local.dodgy-postscript  application/postscript 10     psfix

/usr/lib/cups/filter/psfix:
echo '%!'; exec tail -n +2  "${6-"-"}"

With the '%!' magic, pstops constructs '%%Pages: n' and '%%Page: n m'
comments sensibly (with a warning that it could be wrong).
I think it would be helpful if pstops incorporated this behaviour,
essentially handling the combination of '%!PS-Adobe-3.0' magic and lack of
%%Pages: comments  the same way as it would if there were only '%!' magic.

Link: http://www.cups.org/str.php?L3281
Version: 1.3.10





More information about the cups mailing list