Image handling in a Unix/Linux-based filePro site
Bob Rasmussen
ras at anzio.com
Wed Oct 28 11:07:00 PDT 2009
Hi all,
A prospect and I recently worked through some possible procedures and
approaches to managing images, primarily scanned documents received by his
office. He wanted to control the whole process - scan, upload, index,
view, and print - from his Unix-based filePro.
He had been advised against storing the images in blobs within filePro (I
don't know the pros and cons of that), so he is interested in storing
separate image files on Unix, but tracking them all in filePro.
Many necessary functions are provided by AnzioWin, our higher-function
terminal emulator. It has an image viewer, scanner control, printing, file
format conversion, and file transfer (several kinds).
Below my signature is a document I prepared for him. I designed it to be
generic (not filePro specific) so I can use it elsewhere.
Please feel free to comment.
Regards,
....Bob Rasmussen, President, Rasmussen Software, Inc.
personal e-mail: ras at anzio.com
company e-mail: rsi at anzio.com
voice: (US) 503-624-0360 (9:00-6:00 Pacific Time)
fax: (US) 503-624-0760
web: http://www.anzio.com
street address: Rasmussen Software, Inc.
10240 SW Nimbus, Suite L9
Portland, OR 97223 USA
===============================================================
Commands for Image Enabling in AnzioWin
AnzioWin has components to scan, store, transfer, view, and print various
image files. Together, these make up the building blocks of an imaging
system, to be controlled by the host.
=================
Key Capabilities:
* Manipulate and convert many image file formats, including TIF, JPG, PNG,
BMP, and more.
* Create PDF files, without additional software.
* Read and understand some kinds of PDF files (more thorough coverage is
under construction).
* Create PCL files.
* View image files, PDF, PCL files, and more, including multi-page
formats.
* Transfer via HTTP, FTP, SFTP, Zmodem, and other protocols between PC and
various hosts.
* Print a wide variety of file formats.
* Email files, with attachments.
* Fax documents.
* Scan documents in various formats, interactively or under program
control.
* Do all operations above under control of host-based programs.
=================================
Control of AnzioWin from the Host
AnzioWin has a control language with over 300 commands, providing a great
deal of control over file operations, scanning, file transfer, printing,
etc. Commands can be a) entered by the user, b) programmed into macros in
AnzioWin, or c) issued from the host. This document will focus on the last.
Commands can be issued by various programs or shells on the host, through
normal screen output commands. All that is required is an ability to issue
control characters. Specifically, a character hex-1C (decimal 28, octal
034) indicates the beginning of an AnzioWin command, and a character
hex-1D (decimal 29, octal 035) terminates it. Anything between these two
control characters is interpreted as an AnzioWin command (assuming
security settings in AnzioWin allow this).
For instance, in most Unix/Linux shells, the command
printf "\034SOMETHING\035"
would be received by AnzioWin as the command "SOMETHING". The \034 is
converted to an octal 034 character, and the \035 is converted to an octal
035.
But not all shells treat "printf" the same. We have found that the
following works predictably across Unix and Linux platforms and shells:
/usr/bin/printf "\034%s\035" SOMETHING
Then, depending on the circumstances, SOMETHING might be wrapped in single
or double quotes.
Of course SOMETHING is not an actual AnzioWin command. Commands and their
options are described in the Anzio manual.
>From within a programming language environment (such as filePro, Pick,
COBOL, etc.) instead of in a shell, there may be other methods of issuing
these commands. What is important to AnzioWin is the exact sequence of
bytes received.
===================
Elements of Imaging
The components of an imaging application are those highlighted as
abilities above: scanning, viewing, printing, conversion, and file
transfer. AnzioWin has all these capabilities, without requiring
additional software components other than the drivers for any printers and
scanners to be used. And, of course, Windows itself.
================
Command Examples
The following command examples illustrate some of the ways AnzioWin can be
controlled. These assume a standard Unix or Linux sytem, communicating
with AnzioWin via telnet or SSH.
Other assumptions:
* The PC has a directory "C:\temp", readable and writeable
* AnzioWin, in the area of Communicate menu, Login submenu, has the username
and password entered, for use with FTP.
* The host system has an FTP daemon running.
* Although not required, it is helpful if AnzioWin has View menu's Track Window
Position checkmarked.
* A TWAIN driver is intalled for any scanner to be used.
* Images will be manipulated in TIFF format (or see PDF, below).
* In the following example, the PC-side filename used is
"c:\temp\work file.tif"
(with embedded space, to make sure we're thorough).
* The file to be stored on the host is "work file.tif", in the FTP
system user's directory.
* AnzioWin version 16.2p or higher is running.
With those things in place, let us proceed:
1) To scan a document, and save to the PC:
pcfn='c:\temp\work file.tif'
/usr/bin/printf "\034%s\035" "copy scan:// \"$pcfn\""
This will scan interactively, letting the user choose scanner settings.
The document will be as long as the number of images returned by the
scanner interface.
2) To automatically scan a document and save it:
pcfn='c:\temp\work file.tif'
/usr/bin/printf "\034%s\035" "copy
scan://?pages=9999?duplex=auto?show=false \"$pcfn\""
(with last two lines combined as one). This shows some variations on the
"scan://" superfile designator, to set parameters to control the scanning.
Here, the scanner's interface will not show (although a progress indicator
might). If the scanner can scan duplex (both sides), it will. We're also
telling AnzioWin that we want lots of pages. When the scanner runs out of
pages, a dialog will allow the user to "scan more" or indicate that
they're finished.
Other possible parameters would set which scanner to use, whether to scan
in color, gray, or monochrome, density, etc.
3) To view the scanned image:
pcfn='c:\temp\work file.tif'
/usr/bin/printf "\034%s\035" "IMAGEBOX \"$pcfn\" FLOAT"
The floating viewer window can be moved around, stretched, or zoomed by
the user. If the document has multiple pages, the user can page through
it.
4) To close the image viewer:
/usr/bin/printf "\034%s\035" 'IMAGEBOX'
5) To upload the image file to the host via FTP:
pcfn='c:\temp\work file.tif'
hfn='work file.tif'
/usr/bin/printf "\034%s\035" "ftpput passive \"$hfn\" \"$pcfn\""
Alternative methods would include SFTP and Zmodem.
6) To download the image to any PC:
pcfn='c:\temp\work file.tif'
hfn='work file.tif'
/usr/bin/printf "\034%s\035" "ftpget passive \"$hfn\" \"$pcfn\""
7) To view the image outside of AnzioWin, in whatever viewer Windows has
configured:
pcfn='c:\temp\work file.tif'
/usr/bin/printf "\034%s\035" "winstart \"$pcfn\""
8) To print the image using AnzioWin, however AnzioWin's Printer Setup is
configured:
pcfn='c:\temp\work file.tif'
/usr/bin/printf "\034%s\035" "printfile \"$pcfn\""
9) To print the image outside of AnzioWin, depending on how Windows is
configured:
pcfn='c:\temp\work file.tif'
/usr/bin/printf "\034%s\035" "winprint \"$pcfn\""
====================
PDFs instead of TIFFs
In most cases, a PDF can be used instead. Simply change the ".tif" to
".pdf" above. However, there are some exceptions, corresponding to the
items above:
1) To scan and create a PDF, the second command line should be
/usr/bin/printf "\034%s\035" "copy scan:// \"pdf://$pcfn\""
Note the addition of "pdf://".
2) For complex scanner control, a similar change should be made.
3) As of version 16.2p, AnzioWin can view only certain image-based PDFs.
However, much broader PDF support is being constructed.
8) AnzioWin's ability to print existing PDFs has similar restrictions.
=============
Other Options
This is only a beginning. Many other options are available. Here are just
some:
* Scanning: specify the part of the page to scan.
* Scan an exact number of pages.
* Serialize the file names.
* Replace parts of filenames with elements of the date and/or time.
* Replace parts of filename with the Windows username or other Windows
variables.
* Transfer files via SFTP or Zmodem.
* Store files on a different server.
* Download-and-print in one operation, with no residual file.
* Scan-and-upload.
* Control compression methods on TIFF files.
* Specify author, document name, etc. in PDFs.
* Password-protect PDFs.
* Digitally certify PDFs.
* Email PDFs, possibly with attachments.
* Send faxes.
================
More Information
More information is available from the following sources:
* The Anzio manual, available online.
* The Print Wizard manual, available online.
* AnzioWin's "README.TXT" and "HOWTO.TXT" files, included with
distributions.
* The website has many articles under "knowledgebase" and "whitepapers" in the
Support area.
The website is http://www.anzio.com
Also, we will respond to emailed questions at
support at anzio.com
If possible, include relevant files, and plenty of details!
Please also communicate with us whatever you need that we have not
covered.
More information about the Filepro-list
mailing list