Hylafax Mailing List Archives

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

Re: postscript attachments show up at 5% size



On Fri, Oct 31, 1997 at 06:30:10PM +0000, Phil Watkinson wrote:
> Good news. We seem to be on the trail of this common bug.
I think so. Have a look at facmail.c++:

[...snip...]
    beginFile();

    formatHeaders(*this);               // format top-level headers

    const fxStr* version = findHeader("MIME-Version");
    if (version && *version == "1.0")
        formatMIME(stdin, mime, *this); // parse MIME format
    else
        formatText(stdin, mime);        // treat body as text/plain

    endFile();
    endFormatting();
[...snip...]

With the help of a C++ speaking colleague, I found that the "last 5 lines"

  showpage                                                                 
  end restore                                                            
  %%Trailer                                                              
  %%Pages: 1                                                                
  %%EOF

which I described in my last mail, get generated in the endFile() routine.
That is AFTER the inclusion of any PS that got
generated by an external converter-script which happens inside
formatMIME(). The code above is OK if the mail to be faxed is only text
or a MIME-message with a single text/plain part.

As soon as you have a MIME multi-part, f.ex. where the first part is
text/plain and the second part has to go through a converter-script,
let's say text/html, these "5 lines" should end the postscript 
generated from the first part, the text/plain in this example. Then
should follow the postscript for the text/html.

In other words, the postscript-code for the first page (the page with
To:, From:, etc. header lines) is not "finished" (the "5 lines" are
still missing) when the postscript code for other MIME parts gets
generated. Then these "5 lines" get added at the end of the postscript
code when all MIME-parts have been converted.

>From the facts at hand, I conclude that these "5 lines" get generated
at the wrong moment.

> And then fiddling about with the faxmail generated postscript file to 
> call the 'userheader' macro - after where the prologue file is inserted,
> but *before* the infamous '0.5 dup scale' line : 
> 
> [snip, snip, start of ps file ]
>                         <-----this is where prologue file is inserted
> %%EndProlog
> %%Page: "1" 1
> userheader              <-----this is where user defined macro is called
> save $printdict begin
> .05 dup scale
> [snip, snip, rest of ps file]
> 
> Then the result is a rather nice heading on the top right of the fax. So,
> while someone is hacking faxmail or textfmt, could this facility be added
> as well??
> 
> In my enthusiasm, I started looking through TextFmt.c++, but all I could
> see was data structures, definitions and whatnot  -  couldn't find any
> code that actually *did* anything. Clever stuff this c++, and well
> beyond me.

Good idea, I'll have to try that...
You were looking at the right place, I think.
This is from TextFmt.c++:

[...snip...]
void
TextFmt::beginCol(void)
{
    if (column == 1) {                          // new page
        if (reverse)  {
            int k = pageNum-firstPageNum;
            off_t off = (off_t) ftell(tf);
            if (k < pageOff->length())
                (*pageOff)[k] = off;
            else
                pageOff->append(off);
        }
        fprintf(tf,"%%%%Page: \"%d\" %d\n", pageNum-firstPageNum+1, pageNum);
        fputs("save $printdict begin\n", tf);
        fprintf(tf, ".05 dup scale\n");
        curFont->setfont(tf);
        if (landscape)
            fputs("LandScape\n", tf);
[...snip...]

It is the place where the "infamous" `.05 dup scale' gets generated.
There should be no problem to add a line to insert your `userheader'.
But there is a catch here: TextFmt::beginCol(void) is called for
the begin of a column, which is not identical with the begin of a
page. As you know, a few of the HylaFax utils, a.o. faxmail, can be
started with `-1' or `-2' in the command-line optins to set text in
one or two columns. As long a the default (1  column) is used, begin
of column and begin of page is "the same". I have not yet played
with text set multi-column. All my fiddling in the code was done
with text set single-column.

Hope this helps,
Have a nice weekend.

Louis
-- 
   Louis REINARD - LX 1 QA
   At work: lrei@ictlux.com , PGP KeyID: 1024/0xEB16815D
   At home: lou@ictlux.com  , PGP KeyID: 1024/0x1F5F4EFD
   To get PGP public keys, email with Subject: SENDPGPKEY

   Misfortune: (n), a fortune that never misses.
                -- Ambrose Bierce, The devil's dictionary

Attachment Converted: "C:\PROGRAM FILES\EUDORA\Attach\Re flexfax postscript attachm2"



Home
Report any problems to webmaster@hylafax.org

HylaFAX is a trademark of Silicon Graphics Corporation.
Internet connectivity for hylafax.org is provided by:
VirtuALL Private Host Services