[SOLVED] Printing from Flash does not work

[SOLVED] Printing from Flash does not work

Postby djennings » Nov 7th, '12, 20:43

Today one of my users complained she could not print a document from a flash application. The job fails in Cups.
The page she was printing from is http://www.senteacher.org/Worksheet/8/Scanning.xhtml
Press the 'Print' button and you will see what I mean.


After some research I discovered that it is a flaw in the Adobe Flash plugin creating a non compliant PostScript document
https://bugzilla.redhat.com/show_bug.cgi?id=773765

I tried gnash instead, but it would not print at all.

I think if I could intercept the print command from the browser I could use sed to edit the file to make it compliant before it went into the cups print queue.
So far I have not been able to work out how to intercept the file. None of the commands in Firefox about:config seem to make any difference to how the job is printed. Any suggestions?
Last edited by djennings on Nov 8th, '12, 16:21, edited 1 time in total.
User avatar
djennings
 
Posts: 613
Joined: Jun 2nd, '11, 23:51
Location: Wokingham, UK

Re: Printing from Flash does not work

Postby doktor5000 » Nov 7th, '12, 23:23

Can't you just send the document to a virtual PDF printer instead of a real one?
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18042
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: Printing from Flash does not work

Postby djennings » Nov 8th, '12, 00:29

doktor5000 wrote:Can't you just send the document to a virtual PDF printer instead of a real one?


No. Normally when I print from Firefox I get to choose the printer, or to print to file (pdf or postscript), but when printing from flash I am only offered the physical printers.
User avatar
djennings
 
Posts: 613
Joined: Jun 2nd, '11, 23:51
Location: Wokingham, UK

Re: Printing from Flash does not work

Postby Ken-Bergen » Nov 8th, '12, 02:48

djennings wrote:Today one of my users complained she could not print a document from a flash application. The job fails in Cups.
The page she was printing from is http://www.senteacher.org/Worksheet/8/Scanning.xhtml
Press the 'Print' button and you will see what I mean.
What version of Mageia?
What version of Flash?
What printer and how is it connected?

FWIW: I just tried in Magiea 1 and Cauldron, and both printed several different pages perfectly.
Ken
Ken-Bergen
 
Posts: 1019
Joined: Mar 30th, '11, 02:45
Location: Chilliwack, BC, Canada

Re: Printing from Flash does not work

Postby djennings » Nov 8th, '12, 03:23

What version of Mageia?
What version of Flash?
What printer and how is it connected?

Mageia 2
flash-player-plugin-11.2.202.251-1.mga2.nonfree.x86_64.rpm
HP Officejet-Pro-L7400 using hpcups

If I run cupstestdsc on the job in the print queue I get
Code: Select all
# cupstestdsc d00093-001
d00093-001: 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.


If I then edit the print document to add
%%Pages: 1
%%EndComments
%%Page: 1 1

after %%BoundingBox then it prints OK
User avatar
djennings
 
Posts: 613
Joined: Jun 2nd, '11, 23:51
Location: Wokingham, UK

Re: Printing from Flash does not work

Postby djennings » Nov 8th, '12, 11:19

Here is the same problem described way back in 2009

http://www.cups.org/str.php?L3281

I tried it out in mageia 3, and the problem is still there. If you are not seeing it Ken, then it may be because you are using a different chain of filters in cups.

Clearly it is a fault in the Adobe flash plugin, and clearly Adobe cannot be bothered to fix it. The good news is that the same post shows how to work around the problem by creating a custom Cups filter. I will have a go at making a custom filter today.
User avatar
djennings
 
Posts: 613
Joined: Jun 2nd, '11, 23:51
Location: Wokingham, UK

Re: Printing from Flash does not work

Postby djennings » Nov 8th, '12, 16:20

Yep. A custom cups filter fixes it.

For the record this is what to do
Create a file /etc/cups/mime.types
Code: Select all
#Custom CUPS mime types
#    broken-postcript mime type is to allow cups to identify postscript generated by Adobe Flash plugin with bad DSC
application/broken-postscript string(0,"%!PS-Adobe-3.0") + !contains(0,4096,"%%Pages:")


Create a file /etc/cups/mime.convs
Code: Select all
# convert broken postscript to good postscript using the filter psfix
application/broken-postscript  application/postscript 10     psfix


Create a file /usr/lib/cups/filter/psfix
Code: Select all
#!/bin/sh
# This is a custom CUPS filter to repair broken postscript documents
# created by Adobe Flash plugin
echo '%!'; exec tail -n +2  "${6-"-"}"

Do not forget to make this file executable
Code: Select all
chmod +x /usr/lib/cups/filter/psfix


Now it is possible to print from within Adobe Flash such as this site
http://www.senteacher.org/Worksheet/8/Scanning.xhtml


If you right click on a completed job in the print job viewer and select 'Attributes' you will see the 'Document type' is shown as application/broken-postscript.

I will raise a bug on it. Since Adobe clearly has no intention of fixing this bug maybe mageia could include this workaround.
User avatar
djennings
 
Posts: 613
Joined: Jun 2nd, '11, 23:51
Location: Wokingham, UK

Re: [SOLVED] Printing from Flash does not work

Postby doktor5000 » Nov 8th, '12, 20:29

FWIW, here's the link to that bug for reference: https://bugs.mageia.org/show_bug.cgi?id=8017
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18042
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany


Return to Printers and Scanners

Who is online

Users browsing this forum: No registered users and 0 guests

cron