Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is available at: https://www.gnu.org/copyleft/fdl.html.
I was recently faced with the problem of taking images of a document taken on a cell phone and creating a printable document with the maximum resolution of the copied text(1). I felt that the process of processing the images was of sufficient interest to document it.
In reading this document, Familiarity with the STF Syntax Summary is assumed. (Download document PDF)
The first step was to use GIMP(2) to take each page and split it into two or three sub-images. Care was exercised to trim as much white space as possible. The result was 27 images to be stretched to fit a page to be included in the correct order.
Because each sub-image was named by document paragraph, the images appeared in sorted order.
A dos shell window was opened(3).
Next a Windows dir/b command(4) displayed the file names in the correct order.
Another Windows trick is: Right-click in the upper left corner of the shell window and select Mark. Then drag the cursor over the desired text, highlighting it. Then press enter (or right-click again.) This was used to copy the file names to the paste buffer in sorted order(5)
An STF document was created and the file names pasted into it.
The next step was to reference each file in a .Figure command. The XEmacs macro facility was used to modify the text, as described in Nuances In Computing, to change each text line containing a file name to .Figure 'Image-name',,Sec 'Image-name'. This included each image as a figure into the document and added an entry to the list of figures.
At the same time that XEmacs was used to insert the .Figure commands, it was also used to insert a paragraph command (.hl 1, Figures) after every five .Figure commands. The reason for this is LaTeX has a limitation in that if too many figures are inserted into a paragraph, it barfs and generates an error; and the desired output was a PDF document, so LaTeX was required.
The next consideration was to use landscape mode. This would provide the maximum image magnification. This was accomplished by commanding STF to insert a landscape command at the start (and end) of each paragraqph, as follows:
.PS 1,\landscape{begin}
.pe F, 1, \landscape{end}
Since it was desired to have as much document real estate devoted to images as possible, the document margins were changed to 5 mm; and the images were set to fill the page.The document source appeared as shown below:
.pc |
The .pc command means to insert the following text at the end of the preamble section. Since this is only applicable to LaTeX, it is enclosed in a conditional, limiting its applicability to LaTeX.
The .sf D command sets the image size to span the page and stop when the vertical or horizontal dimension hits a margin. See Working With Images in the STF documentation.It took longer to describe, than do; but hopefully it is instructive. As an aside, it is difficult to insert 27 images into a word processor. As involved as the above process seems, it is a sanity saver compared to trying to do it using a word processor.
(1) Someone wanted help understanding a section and this was the only way available to provide it.
(2) GNU Image Processing Program, https://www.gimp.org/
(3) One way to open a shell in Windows is to create a bat file with cmd in it, say 0dos.bat. Then double click 0Dos.bat