Open zdohnal opened 1 year ago
To clarify, printing a text file to brl format works in Fedora 37, before braille-printer-app was made a separate application and uses pstotiff from hplip. It does not currently work in Fedora rawhide if pstotiff from hplip is installed.
? I don't understand the relation between printing a text file and pstotiff. Does the cups chain happen to convert text to ps then to tiff then to ubrl? That won't be good at all :)
To make things simpler, we can add a zero-cost brf2ubrl conversion that just translates from brf to unicode braille (basically what iconv -f brf -t utf-8
does)
A low cost conversion would be helpful. Conversion is text to pdf, ps to tiff then image to ubrl. Sample log below:
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] Applying default options...
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] Adding start banner page "none".
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] Queued on "ubrl" by "fedora".
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] Auto-typing file...
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] Request file type is text/plain.
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] File of type text/plain queued by "fedora".
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] Adding end banner page "none".
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] time-at-processing=1676837066
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] 4 filters for job:
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] texttopdf (text/plain to application/pdf, cost 32)
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] pstotiff (application/pdf to image/tiff, cost 80)
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] imagetoubrl (image/tiff to image/vnd.cups-ubrl, cost 70)
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] - (image/vnd.cups-ubrl to printer/ubrl, cost 0)
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] job-sheets=none,none
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] argv[0]="ubrl"
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] argv[1]="11"
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] argv[2]="fedora"
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] argv[3]="test.txt"
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] argv[4]="1"
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] argv[5]="finishings=3 number-up=1 print-color-mode=monochrome job-uuid=urn:uuid:cf725edc-4cc4-3732-6fbe-93664b4e4543 job-originating-host-name=localhost date-time-at-creation= date-time-at-processing= time-at-creation=1676837066 time-at-processing=1676837066 document-name-supplied=test.txt"
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] argv[6]="/var/spool/cups/d00011-001"
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] envp[0]="CUPS_CACHEDIR=/var/cache/cups"
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] envp[1]="CUPS_DATADIR=/usr/share/cups"
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] envp[2]="CUPS_DOCROOT=/usr/share/cups/www"
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] envp[3]="CUPS_REQUESTROOT=/var/spool/cups"
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] envp[4]="CUPS_SERVERBIN=/usr/lib/cups"
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] envp[5]="CUPS_SERVERROOT=/etc/cups"
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] envp[6]="CUPS_STATEDIR=/run/cups"
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] envp[7]="HOME=/var/spool/cups/tmp"
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] envp[8]="PATH=/usr/lib/cups/filter:/usr/bin:/usr/sbin:/bin:/usr/bin"
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] envp[9]="SERVER_ADMIN=root"
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] envp[10]="SOFTWARE=CUPS/2.4.2"
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] envp[11]="TMPDIR=/var/spool/cups/tmp"
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] envp[12]="USER=root"
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] envp[13]="CUPS_MAX_MESSAGE=2047"
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] envp[14]="CUPS_SERVER=/run/cups/cups.sock"
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] envp[15]="CUPS_ENCRYPTION=IfRequested"
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] envp[16]="IPP_PORT=631"
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] envp[17]="CHARSET=utf-8"
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] envp[18]="LANG=en_US.UTF-8"
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] envp[19]="PPD=/etc/cups/ppd/ubrl.ppd"
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] envp[20]="CONTENT_TYPE=text/plain"
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] envp[21]="DEVICE_URI=cups-brf:/"
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] envp[22]="PRINTER_INFO=ubrl"
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] envp[23]="PRINTER_LOCATION="
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] envp[24]="PRINTER=ubrl"
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] envp[25]="PRINTER_STATE_REASONS=none"
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] envp[26]="CUPS_FILETYPE=document"
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] envp[27]="FINAL_CONTENT_TYPE=image/vnd.cups-ubrl"
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] envp[28]="AUTH_I****"
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] Started filter /usr/lib/cups/filter/texttopdf (PID 869272)
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] Started filter /usr/lib/cups/filter/pstotiff (PID 869273)
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] Started filter /usr/lib/cups/filter/imagetoubrl (PID 869274)
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] Started backend /usr/lib/cups/backend/cups-brf (PID 869275)
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] creating directory \"/home/fedora/BRF
Feb 19 23:04:26 localhost.localdomain cupsd[869240]: [Job 11] creating file \"/home/fedora/BRF/test.txt.XXXXXX.brf
Feb 19 23:04:27 localhost.localdomain cupsd[869240]: [Job 11] Attribute Defaultpage-ranges is \'\'
Feb 19 23:04:27 localhost.localdomain cupsd[869240]: [Job 11] Default page-ranges is \'\'
Feb 19 23:04:27 localhost.localdomain cupsd[869240]: [Job 11] Attribute DefaultPageSize is \'A4TF\'
Feb 19 23:04:27 localhost.localdomain cupsd[869240]: [Job 11] Default PageSize is \'A4TF\'
Feb 19 23:04:27 localhost.localdomain cupsd[869240]: [Job 11] Attribute HWMargins is \'28.34645652771 28.34645652771 28.34645652771 28.34645652771\'
Feb 19 23:04:27 localhost.localdomain cupsd[869240]: [Job 11] HW margins are 28.34645652771 28.34645652771 28.34645652771 28.34645652771
Feb 19 23:04:27 localhost.localdomain cupsd[869240]: [Job 11] Attribute Defaultpage-left is \'15\'
Feb 19 23:04:27 localhost.localdomain cupsd[869240]: [Job 11] Default page-left is \'15\'
Feb 19 23:04:27 localhost.localdomain cupsd[869240]: [Job 11] Attribute Defaultpage-right is \'15\'
Feb 19 23:04:27 localhost.localdomain cupsd[869240]: [Job 11] Default page-right is \'15\'
Feb 19 23:04:27 localhost.localdomain cupsd[869240]: [Job 11] Attribute Defaultpage-top is \'15\'
Feb 19 23:04:27 localhost.localdomain cupsd[869240]: [Job 11] Default page-top is \'15\'
Feb 19 23:04:27 localhost.localdomain cupsd[869240]: [Job 11] Attribute Defaultpage-bottom is \'15\'
Feb 19 23:04:27 localhost.localdomain cupsd[869240]: [Job 11] Default page-bottom is \'15\'
Feb 19 23:04:27 localhost.localdomain cupsd[869240]: [Job 11] hard margins are left 1000 right 1000 top 1000 bottom 1000
Feb 19 23:04:27 localhost.localdomain cupsd[869240]: [Job 11] graphical margins are left 1000 right 1000 top 1000 bottom 1000
Feb 19 23:04:27 localhost.localdomain cupsd[869240]: [Job 11] printable area is 19000x28480
Feb 19 23:04:27 localhost.localdomain cupsd[869240]: [Job 11] Attribute DefaultTextDotDistance is \'250\'
Feb 19 23:04:27 localhost.localdomain cupsd[869240]: [Job 11] Default TextDotDistance is \'250\'
Feb 19 23:04:27 localhost.localdomain cupsd[869240]: [Job 11] Attribute DefaultTextDots is \'6\'
Feb 19 23:04:27 localhost.localdomain cupsd[869240]: [Job 11] Default TextDots is \'6\'
Feb 19 23:04:27 localhost.localdomain cupsd[869240]: [Job 11] Attribute DefaultLineSpacing is \'500\'
Feb 19 23:04:27 localhost.localdomain cupsd[869240]: [Job 11] Default LineSpacing is \'500\'
Feb 19 23:04:27 localhost.localdomain cupsd[869240]: [Job 11] Attribute DefaultTopMargin is \'2\'
Feb 19 23:04:27 localhost.localdomain cupsd[869240]: [Job 11] Default TopMargin is \'2\'
Feb 19 23:04:27 localhost.localdomain cupsd[869240]: [Job 11] Attribute DefaultTopMargin is \'2\'
Feb 19 23:04:27 localhost.localdomain cupsd[869240]: [Job 11] Default TopMargin is \'2\'
Feb 19 23:04:27 localhost.localdomain cupsd[869240]: [Job 11] Attribute DefaultBottomMargin is \'2\'
Feb 19 23:04:27 localhost.localdomain cupsd[869240]: [Job 11] Default BottomMargin is \'2\'
Feb 19 23:04:27 localhost.localdomain cupsd[869240]: [Job 11] Attribute DefaultLeftMargin is \'2\'
Feb 19 23:04:27 localhost.localdomain cupsd[869240]: [Job 11] Default LeftMargin is \'2\'
Feb 19 23:04:27 localhost.localdomain cupsd[869240]: [Job 11] Attribute DefaultRightMargin is \'2\'
Feb 19 23:04:27 localhost.localdomain cupsd[869240]: [Job 11] Default RightMargin is \'2\'
Feb 19 23:04:27 localhost.localdomain cupsd[869240]: [Job 11] Attribute DefaultGraphicDotDistance is \'200\'
Feb 19 23:04:27 localhost.localdomain cupsd[869240]: [Job 11] Default GraphicDotDistance is \'200\'
Feb 19 23:04:27 localhost.localdomain cupsd[869240]: [Job 11] total graphical: 94x140
Feb 19 23:04:27 localhost.localdomain cupsd[869240]: [Job 11] graphical offset: 0x0
Feb 19 23:04:27 localhost.localdomain cupsd[869240]: [Job 11] rounded graphical top-left corner margin: 1000x1000
Feb 19 23:04:27 localhost.localdomain cupsd[869240]: [Job 11] resulting graphical area: 94x141
Feb 19 23:04:27 localhost.localdomain cupsd[869240]: [Job 11] Liblouis table directory is /usr/share/liblouis/tables
Feb 19 23:04:27 localhost.localdomain cupsd[869240]: [Job 11] Attribute DefaultLibLouis is \'Locale\'
Feb 19 23:04:27 localhost.localdomain cupsd[869240]: [Job 11] Default LibLouis is \'Locale\'
Feb 19 23:04:27 localhost.localdomain cupsd[869240]: [Job 11] looking for locale \'en_US\' and grade \'\'
Feb 19 23:04:27 localhost.localdomain cupsd[869240]: [Job 11] Page = 594x864; 0,0 to 594,864
Feb 19 23:04:29 localhost.localdomain cupsd[869240]: [Job 11] PID 869272 (/usr/lib/cups/filter/texttopdf) exited with no errors.
Feb 19 23:04:30 localhost.localdomain cupsd[869240]: [Job 11] GPL Ghostscript 9.56.1 (2022-04-04)
Feb 19 23:04:30 localhost.localdomain cupsd[869240]: [Job 11] Copyright (C) 2022 Artifex Software, Inc. All rights reserved.
Feb 19 23:04:30 localhost.localdomain cupsd[869240]: [Job 11] This software is supplied under the GNU AGPLv3 and comes with NO WARRANTY:
Feb 19 23:04:30 localhost.localdomain cupsd[869240]: [Job 11] see the file COPYING for details.
Feb 19 23:04:32 localhost.localdomain cupsd[869240]: [Job 11] *** WARNING - you have selected SAFER, indicating you want Ghostscript
Feb 19 23:04:32 localhost.localdomain cupsd[869240]: [Job 11] to execute in a safer environment, but at the same time
Feb 19 23:04:32 localhost.localdomain cupsd[869240]: [Job 11] have selected WRITESYSTEMDICT. Unless you use this option with
Feb 19 23:04:32 localhost.localdomain cupsd[869240]: [Job 11] care and specifically, remember to execute code like:
Feb 19 23:04:32 localhost.localdomain cupsd[869240]: [Job 11] \"systemdict readonly pop\"
Feb 19 23:04:32 localhost.localdomain cupsd[869240]: [Job 11] it is possible that malicious code may be able to evade the
Feb 19 23:04:32 localhost.localdomain cupsd[869240]: [Job 11] limited security offered by the SAFER option.
Feb 19 23:04:32 localhost.localdomain cupsd[869240]: [Job 11] Processing pages 1 through 2.
Feb 19 23:04:32 localhost.localdomain cupsd[869240]: [Job 11] Page 1
Feb 19 23:04:32 localhost.localdomain cupsd[869240]: [Job 11] Page 2
Feb 19 23:04:32 localhost.localdomain cupsd[869240]: [Job 11] The following errors were encountered at least once while processing this file:
Feb 19 23:04:32 localhost.localdomain cupsd[869240]: [Job 11] circular reference to indirect object
Feb 19 23:04:32 localhost.localdomain cupsd[869240]: [Job 11] **** This file had errors that were repaired or ignored.
Feb 19 23:04:32 localhost.localdomain cupsd[869240]: [Job 11] **** Please notify the author of the software that produced this
Feb 19 23:04:32 localhost.localdomain cupsd[869240]: [Job 11] **** file that it does not conform to Adobe\'s published PDF
Feb 19 23:04:32 localhost.localdomain cupsd[869240]: [Job 11] **** specification.
Feb 19 23:04:34 localhost.localdomain cupsd[869240]: [Job 11] Attribute DefaultLibLouis2 is \'HyphLocale\'
Feb 19 23:04:34 localhost.localdomain cupsd[869240]: [Job 11] Default LibLouis2 is \'HyphLocale\'
Feb 19 23:04:34 localhost.localdomain cupsd[869240]: [Job 11] Attribute DefaultLibLouis3 is \'None\'
Feb 19 23:04:34 localhost.localdomain cupsd[869240]: [Job 11] Default LibLouis3 is \'None\'
Feb 19 23:04:34 localhost.localdomain cupsd[869240]: [Job 11] Attribute DefaultLibLouis4 is \'None\'
Feb 19 23:04:34 localhost.localdomain cupsd[869240]: [Job 11] Default LibLouis4 is \'None\'
Feb 19 23:04:34 localhost.localdomain cupsd[869240]: [Job 11] Table1 en_US.tbl
Feb 19 23:04:34 localhost.localdomain cupsd[869240]: [Job 11] Table2 hyph_en_US.dic
Feb 19 23:04:34 localhost.localdomain cupsd[869240]: [Job 11] Table3 None
Feb 19 23:04:34 localhost.localdomain cupsd[869240]: [Job 11] Table4 None
Feb 19 23:04:34 localhost.localdomain cupsd[869240]: [Job 11] Attribute DefaultNegate is \'False\'
Feb 19 23:04:34 localhost.localdomain cupsd[869240]: [Job 11] Default Negate is \'False\'
Feb 19 23:04:34 localhost.localdomain cupsd[869240]: [Job 11] Attribute DefaultRotate is \'90>\'
Feb 19 23:04:34 localhost.localdomain cupsd[869240]: [Job 11] Default Rotate is \'90>\'
Feb 19 23:04:34 localhost.localdomain cupsd[869240]: [Job 11] Attribute Defaultmirror is \'False\'
Feb 19 23:04:34 localhost.localdomain cupsd[869240]: [Job 11] Default mirror is \'False\'
Feb 19 23:04:35 localhost.localdomain cupsd[869240]: [Job 11] Attribute Defaultfitplot is \'True\'
Feb 19 23:04:35 localhost.localdomain cupsd[869240]: [Job 11] Default fitplot is \'True\'
Feb 19 23:04:35 localhost.localdomain cupsd[869240]: [Job 11] Attribute DefaultEdge is \'Canny\'
Feb 19 23:04:35 localhost.localdomain cupsd[869240]: [Job 11] Default Edge is \'Canny\'
Feb 19 23:04:35 localhost.localdomain cupsd[869240]: [Job 11] Attribute DefaultEdgeFactor is \'1\'
Feb 19 23:04:35 localhost.localdomain cupsd[869240]: [Job 11] Default EdgeFactor is \'1\'
Feb 19 23:04:35 localhost.localdomain cupsd[869240]: [Job 11] Attribute DefaultCannyRadius is \'0\'
Feb 19 23:04:35 localhost.localdomain cupsd[869240]: [Job 11] Default CannyRadius is \'0\'
Feb 19 23:04:35 localhost.localdomain cupsd[869240]: [Job 11] Attribute DefaultCannySigma is \'1\'
Feb 19 23:04:35 localhost.localdomain cupsd[869240]: [Job 11] Default CannySigma is \'1\'
Feb 19 23:04:35 localhost.localdomain cupsd[869240]: [Job 11] Attribute DefaultCannyLower is \'10\'
Feb 19 23:04:35 localhost.localdomain cupsd[869240]: [Job 11] Default CannyLower is \'10\'
Feb 19 23:04:35 localhost.localdomain cupsd[869240]: [Job 11] Attribute DefaultCannyUpper is \'30\'
Feb 19 23:04:35 localhost.localdomain cupsd[869240]: [Job 11] Default CannyUpper is \'30\'
Feb 19 23:04:35 localhost.localdomain cupsd[869240]: [Job 11] Converting image
Feb 19 23:04:35 localhost.localdomain cupsd[869240]: [Job 11] Set job-printer-state-message to "Converting image", current level=INFO
Feb 19 23:04:35 localhost.localdomain cupsd[869240]: [Job 11] Calling convert -canny 0x1+10%+30% -negate -rotate 90> -page 94x140+0+0 -size 94x141 -resize 94x141 -flatten - ubrl:- from stdin
Feb 19 23:04:36 localhost.localdomain cupsd[869240]: [Job 11] PID 869273 (/usr/lib/cups/filter/pstotiff) exited with no errors.
Feb 19 23:04:46 localhost.localdomain cupsd[869240]: [Job 11] Ready
Feb 19 23:04:46 localhost.localdomain cupsd[869240]: [Job 11] Set job-printer-state-message to "Ready", current level=INFO
Feb 19 23:04:46 localhost.localdomain cupsd[869240]: [Job 11] PID 869274 (/usr/lib/cups/filter/imagetoubrl) exited with no errors.
Feb 19 23:04:46 localhost.localdomain cupsd[869240]: [Job 11] PID 869275 (/usr/lib/cups/backend/cups-brf) exited with no errors.
Feb 19 23:04:46 localhost.localdomain cupsd[869240]: ubrl benson 11 [19/Feb/2023:23:04:46 +0300] total 0 - localhost test.txt - -
Feb 19 23:04:46 localhost.localdomain cupsd[869240]: [Job 11] time-at-completed=1676837086
Feb 19 23:04:46 localhost.localdomain cupsd[869240]: [Job 11] Job completed.
Feb 19 23:04:47 localhost.localdomain cupsd[869240]: [Job 11] Unloading...
To clarify, printing a text file to brl format works in Fedora 37, before braille-printer-app was made a separate application and uses pstotiff from hplip. It does not currently work in Fedora rawhide if pstotiff from hplip is installed.
But it works when pstotiff from hplip and braille-printer-app is installed... have you restarted cups after hplip installation? cupsd picks up available filters at the start of daemon.
? I don't understand the relation between printing a text file and pstotiff. Does the cups chain happen to convert text to ps then to tiff then to ubrl? That won't be good at all :)
Yes, because there is no text/plain -> image/vnd.cups-ubrl rule in braille.convs :)
To make things simpler, we can add a zero-cost brf2ubrl conversion that just translates from brf to unicode braille (basically what
iconv -f brf -t utf-8
does)
That sounds good - IIUC text/plain files will be converted to application/vnd.cups-brf and then to image/vnd.cups-ubrl. It should work, but we have to test it as well.
Make absolutely sure that text gets directly converted do Braille, not rasterized and then the Raster image getting embossed in the low resolution of a Braille embosser, then the text is completely lost. Filter paths doing that need to get avoided under all circumstances.
@tillkamppeter is there a way how to forbid it? I mean if cupsd is able construct a filter chain based on known rules, it will automatically construct the chain, which can convert text into ubrl via tiff. Or is there a way how to disable it without editing rules/removing filter?
The cost of the chains will be enough to avoid the rasterization (which is already given a large cost)
Hi,
reviewer during Fedora review found out that there is no conversion rule for text/plain document format to image/vnd.cups-ubrl format, but the printing works for the format if pstotiff from hplip is installed.
Should there be a direct conversion support in braille-printer-app as it is for text/plain -> application/vnd.cups-brf, or libcupsfilters+cups-filters will provide necessary conversions to an image document format?