2022-12-24 - Print Quest Part 2
===============================
In my earlier log entry titled "Print Quest", i described a process
to take a screenshot and print it to an emulated Epson dot-matrix
printer in FreeDOS. This was a common DOS printer in the 1980's. My
process produced PDF output that could be copied via sneakernet to
another computer and printed on a more modern printer.
Print Quest
<
gopher://tilde.pink/1/~bencollver/log/2022-06-15-print-quest/>
This time around, i plan to "upgrade" my virtual printer to achieve
better print quality. Instead of printing a screen shot, i'll print
a recipe. This process works in DOSBox-X as well as FreeDOS.
First, the toolset:
Curl (FreeDOS) <
http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/repositories/ 1.3/net/curl/7_77_0.zip>
Gawk (DJGPP) <
http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/devel/awk/gawk/ gwk500b.zip>
Ghostscript (FreeDOS) <
http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/util/unix/ ghostscript/8.71/gs871.7z>
Microsoft Word 5.5 <
gopher://tilde.pink/9/~bencollver/files/dos/office/word/Wd55_ben.exe> mmrtf.awk
<
gopher://tilde.pink/0/~bencollver/files/dos/app/mealmaster/mm2rtf/
mmrtf.awk>
PictView
<
http://pictview.com/pictview.zip>
utf8tocp (FreeDOS) <
http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/repositories/ 1.3/util/utf8tocp/0_9_2a.zip>
I unzipped all of the tools and made sure they were in my path.
Note that Wd55_ben.exe does not self-extract properly. Instead, use
FreeDOS unzip.exe to extract Microsoft Word.
C:\WORDINST>unzip Wd55_ben.exe
When running setup.exe to install Microsoft Word 5.5, make sure to
install the PostScript printer driver.
Select a recipe to print:
Sweet Potato Burritos <
gopher://tilde.pink/0/~bencollver/recipes/utf8/special-diets/ vegetarian/burritos/recipe6.txt>
Download the document:
C:\>curl -o recipe6.txt
gopher://tilde.pink/0/~bencollver/recipes/
utf8/special-diets/vegetarian/burritos/recipe6.txt
Notice the /utf8/ in the URL. Different applications have different
default character encodings and they may not automatically handle
UTF-8.
* HTML - UTF-8
* Meal-Master (US) - CP437
* RTF - Windows-1252
For RTF, convert the recipe to Windows-1252 character encoding:
C:\>copy recipe6.txt recipe6.bak
C:\>utf8tocp.com 1252 recipe6.bak >recipe6.txt
Convert the recipe to RTF:
C:\>gawk -f mmrtf.awk <recipe6.txt >recipe6.rtf
Load the resulting RTF file in Microsoft Word:
C:\>\word\word recipe6.rtf
Word prompts that the file is in RTF format.
Word asks "Do you want to display in Word format?"
* Click Yes.
Word asks "Do you want to attach a style sheet to this file?"
* Click No.
At this point, the recipe should be shown in Word.
Print recipe to a file:
* Click File
* Click Print...
* This opens a dialog titled Print
* The next line under the title should say Standard PostScript
* Under To, select File:
* At File:, type: recipe6.prn
* Click OK
Quit Word:
* Click File
* Click Exit Word
Convert the output to PostScript:
C:\>copy \word\postscrp.ini + recipe6.prn recipe6.ps
Note the plus (+) character used to concatenate files using the
FreeDOS copy command. If this plus character is omitted, then it
will fail to prepend the PostScript prologue.
Convert PostScript to PDF:
C:\>gs.exe -dSAFER -q -dNOPAUSE -dBATCH -dJOBSERVER
-dCompatibilityLevel=1.4 -sDEVICE=pdfwrite
-sOutputFile=recipe6.pdf -c .setpdfwrite -f recipe6.ps
At this point, i could copy recipe6.pdf to a thumb drive and print it
from another computer. Because the DOS PDF viewers don't work well
for me, i'll also convert to JPEG page images for preview in an image
viewer.
C:\>gs.exe -r72x72 -dGraphicsAlphaBits=4 -dTextAlphaBits=4
-sDEVICE=jpeg -dJPEGQ=90 -o page-%03d.jpg recipe6.pdf
C:\>pictview.exe page-001.jpg
Here is the resulting PDF page image:
PDF page image <
gopher://tilde.pink/I/~bencollver/log/2022-12-24-print-quest-part2/ page-001.jpg>
Here is the Epson dot-matrix output for comparison:
Epson page image <
gopher://tilde.pink/I/~bencollver/log/2022-12-24-print-quest-part2/ epson-01.jpg>
Note that in the Epson dot-matrix output, the degree symbol (°) and
the word sauté are not shown correctly. This is because escparse.exe
does not support the printer control code to print these special
characters.
Thanks to Gushi for documenting how to coerce ghostscript to convert
the postscript generated by Microsoft Word 5.
TLDR:
prepend Word postscript prologue and use gs.exe -dJOBSERVER argument.
Gushi's post about PostScript emulation under DOSBox
<
https://gushi.medium.com/
postscript-emulation-under-dosbox-810210f3aae4>
--- SBBSecho 3.20-Linux
* Origin: End Of The Line BBS - endofthelinebbs.com (1:124/5016)