HylaFAX The world's most advanced open source fax server

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Using MS Word to generate coversheet templates, more info



Yesterday I send some notes on generating fax cover sheets using MS Word and
printing them to a file using a postscript driver.

Having looked at this issue some more in trying to answer a question from
someone out there, I have discovered that what I said was specific to
Postscript generated by PSCRIPT.DRV V3.5x from Windows for Workgroups, and
that PSCRIPT.DRV V4.0 from Windows 95 generates very different code.

In addition, it should be noted that I used FTP to transfer the file from
Windows to UNIX (which automagically converts CRLF to LF). Once on UNIX, I
could use vi or emacs to hand modify the postscript.

At 05:35 PM 5/01/97 +0900, Richard Sharpe wrote:
>When I first saw the SGI logo that is part of the standard FAX cover sheet
>generated by HylaFAX 4.0pl0, I got a shock (I spent 8.5 years with Digital
>just prior to installing HylaFAX on an ULTRIX machine).
>

[Deletia]

>Now, it turns out that with tables, the MS postscript driver (at least for
>WfWg 3.11) generates the following for each row of the table:
>
>        gs 435 94 19 306 CB
>        46 333 86 (To:) 86 SB
>        gr
>        gs 1068 94 454 306 CB
>        477 333 nnnn (replace-with-to-field) nnnn SB
>        gr
>
>Where nnnn is the length that the text occupies in points.
>
>That is, it generates two groups of postscrip, with a graphics save, a print
>sequence and a graphics restore. Unfortunately the SB requires the lenght in
>points of the text before and after the text or it does strange things, like
>squish the text, or print like t      h      i     s.
>
>So what I did was to change the postscript to this:
>
>        gs 435 94 19 306 CB
>        346 333 86 (To:) 86 SB
>        gr
>        gs 1068 94 454 306 CB
>        477 333 to MAKEREAL FIXLEN SB
>        gr
>
>That is, for each block of 6 ps statements, I ignored the first part, and
>changes the replace-with-xxx-field with the name of that field as specified
>in the dictionary that gets plugged on the front. I also added those two ps
>functions MAKEREAL and FIXLEN.
>
>Here are all the definitions that I stick at the front of the coverpage.ps
file:
>
>/covpaglen 1 def
>/nullstring () def
>/MAKEREAL {
>dup nullstring eq { (   ) exch pop } if
>} def
>/FIXLEN {
>dup stringwidth pop exch dup stringwidth pop
>} def
>/ADDCPL {
>dup length 1 add /cptemp exch string def cvi covpaglen add cptemp cvs
>} def
>
>The first two just define some constants. MAKEREAL checks to see if the
>variable has a null value, and if so, sticks a few spaces on the stack so
>that SB wont barf. FIXLEN computes the length in points of the string on the
>top of the stack (using the currently defined font) and sticks that value on
>the stack before and after the string so SB will work OK.
>
>ADDCPL makes the page count correct in those cases where you want the page
>count to include the coverpage. Of course, page count is estimated by
>ghostscript using the comments passed to it, but what the hell.
>
>The block of ps that specifies the page count looks like this:
>
>gs 435 94 19 776 CB
>270 803 162 (Pages:) 162 SB
>gr
>gs 435 94 19 870 CB
>62 897 370 (\(including this\)) 370 SB
>gr
>gs 1068 94 454 776 CB
>477 803 page-count MAKEREAL ADDCPL FIXLEN SB
>gr
>
>I also did some extra work to get the comments field printed out split up
>the way faxcover generates it, but it should be obvious how to do that by now.
>

As stated above this is relevant to postscript generated by the postscript
driver on Windows for WorkGroups 3.11. 

Windows 95 generates the following sort of postscript:

        Ji 
        729 618 M 
        -0.051 0 (Date:)A 
        ; : 0 0 2362 3383 rc 0 0 0 sco F0_58
        Ji 
        909 618 M 
        -0.120 0 (replace-with-date-field)A 
        ; : 0 0 2362 3383 rc 0 0 0 sco F0_58

Which appears to be much easier to deal with, but I will have to figure out
what the two numbers before the text mean ...

However, since I will be doing the same again soon for another site that has
Windows 95, I will probably look at this issue again. So, at another time I
will post notes on how to convert Win95 generated postscript to pick up the
info added by faxcover.

Regards
-------
Richard Sharpe, sharpe@ns.aus.com
NS Computer Software and Services P/L, 
Ph: +61-8-8281-0063, FAX: +61-8-8250-2080, WWW: http://www.ns.aus.com
NS is an OS-neutral, equal-HTTP-server opportunity employer!




Project hosted by iFAX Solutions