HylaFAX The world's most advanced open source fax server

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

[hylafax-users] Last Page Blank When Case Is Multiple Attachments & One Attachment Has Only One Page



I'm using Hylafax version 4.3.4 . The below script is based on panman's script (Thanks Panman) works for me with some minor changes.

When I tried the original script, I kept getting "Error: /invalidrestore in /restore" errors and figured this was caused by faxmail adding its own trailer/eof to the resulting postscript. , I just modified the script to delete not only the last "showpage" operator, but also "the trailer/eof".

It works fine except when:

   1. There are multiple pdf attachments.
   2. One of those pdf attachments, not the last, has only 1 page.

What happens then is even though the blank page is not printed, the one page pdf is also not printed.

Below is the modified script based on the one Panman posted earlier:

#!/usr/bin/perl
#Read from standard input

@text=<STDIN>;

$size=@text;

# Count the number of "showpage"
$count=0;

for($i=0; $i<=$size; $i++) { if($text[$i] =~ /showpage/) { $count++; }

}

$num=1;

for($i=0; $i<=$size; $i++)
{

if($text[$i] =~ /showpage/)
{
if($count == $num) {
$text[$i] =~ s/showpage//i;
for($j=$i+1; $j<$i+20; $j++)
{
$text[$j] =~ s/%%PageTrailer*//g;
$text[$j] =~ s/%%Trailer*//g;
$text[$j] =~ s/%%Pages:\s\d*//g;
$text[$j] =~ s/%%EOF//g;
}
}
$num++; }


}

print @text;




Does anybody have a better solution or any suggestions?


Thanks,

--

Davie Lynn



____________________ HylaFAX(tm) Users Mailing List _______________________
 To subscribe/unsubscribe, click http://lists.hylafax.org/cgi-bin/lsg2.cgi
On UNIX: mail -s unsubscribe hylafax-users-request@xxxxxxxxxxx < /dev/null
 *To learn about commercial HylaFAX(tm) support, mail sales@xxxxxxxxx*




Project hosted by iFAX Solutions