2022-12-24 - Print Quest Part 2

In my earlier log entry Print Quest [1], 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.

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.

See below [6] for the DOS toolset.

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 [2]

Download the document:

    C:\>lynx -source gopher://tilde.pink/0/~bencollver/recipes/
     utf8/special-diets/vegetarian/burritos/recipe6.txt >recipe6.txt

Notice the /utf8/ in the URL. Different applications have different default character encodings and they may not automatically handle UTF-8.

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?"

Word asks "Do you want to attach a style sheet to this file?"

At this point, the recipe should be shown in Word.

Print recipe to a file:

Quit 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

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 [5] 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.

Footnotes

[1] Print Quest
[2] Sweet Potato Burritos
[3] PDF page image [4] Epson page image [5] Gushi's post about PostScript emulation under DOSBox

[6] DOS toolset

Gawk (DJGPP) (32-bit)
Ghostscript (FreeDOS) (32-bit)
Lynx (FreeDOS) (32-bit)
Microsoft Word 5.5
mmrtf.awk
PictView (32-bit)
utf8tocp (FreeDOS)

Tags

bencollver
retrocomputing
technical