HylaFAX The world's most advanced open source fax server

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

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



I see you did post it, ok, this line seems troubling in what you posted
       if($count == $num)
since I dont have a copy of the email i posted with the origional script
here it is again:

-------------------------------------------script-----------------------------------------
#!/usr/bin/perl
# Read from the standard input
@text=<STDIN>;
$size=@text;

# Count the number of "showpage"
$count=0;
for($i=0;$i<=$size;$i++){if($text[$i] =~ /showpage/){$count++;}}

# Discard the last line that contain "showpage"
$num=1;
for($i=0;$i<=$size;$i++){
       if($text[$i] =~ /showpage/){
               if($num!=$count){$num++;}
               else{$text[$i]=~s/showpage//g;}
       }

               print $text[$i];
}
-------------------------------------end
script-----------------------------------------
and I'm using pdftops not pdf2ps, seems to work better.

-------------------------mimetype/application/pdf-------------------------------
/usr/bin/pdftops $1 - | /var/spool/hylafax/mimetype/showpageremoval.pl
-------------------end
mimetype/application/pdf------------------------------
this script is still working on hylafax 4.4, and was installed on 4.3
however this is only a testing box. I have hylafax+ on the running
server box, mainly due to the fact that Lee is providing actual support
for hylafax+


On Aug 30, 2007 09:59 AM, Davie Lynn
<davielynn@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

>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*
>
>

Attachment: showpageremoval.pl
Description: Perl program




Project hosted by iFAX Solutions