| View source | |
| # 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 | |
| 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) (32-bit) | |
| Gawk (DJGPP) (32-bit) | |
| Ghostscript (FreeDOS) (32-bit) | |
| Microsoft Word 5.5 | |
| mmrtf.awk | |
| PictView (32-bit) | |
| utf8tocp (FreeDOS) | |
| 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 | |
| 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 | |
| Here is the Epson dot-matrix output for comparison: | |
| Epson page image | |
| 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 | |
| tags: bencollver,retrocomputing,technical | |
| # Tags | |
| bencollver | |
| retrocomputing | |
| technical |