#!/usr/bin/perl -s our($h,$f, $o,$d); $h ||= "4cm"; $f ||= "4cm"; $h =~ s/\s*$/cm/ unless $h =~ /\w/; $f =~ s/\s*$/cm/ unless $f =~ /\w/; my $file=shift or die; my $out=$file; $out =~ s/\.pdf$/-b.pdf/; $out = $o if $o; open(F,"|-","pdflatex"); print F data({file=>$file,header=>$h,footer=>$f}); close F; rename ("texput.pdf",$out); sub data{ my $arg=shift; my $t=join("",); my $t1 = $t; $t1 =~ s/.*__v2__//is; if (not $d){ $t =~ s{\[\%\s*(\w+)\s*\%\]}{$arg->{$1}}g; return $t } else { $t1 =~ s{\[\%\s*(\w+)\s*\%\]}{$arg->{$1}}g; return $t1; } } __DATA__ \documentclass[portuges,a4paper]{article} %%% template for header and footer remov. \usepackage{color} \usepackage{pdfpages} \RequirePackage[a4paper,top=0mm,left=0mm,right=0mm,bottom=0mm,nohead,nofoot]{geometry} \begin{document} \includepdf[pagecommand={\pagestyle{empty}\thispagestyle{empty} {\color{white}\rule{\textwidth}{[%header%]}} \vfill {\color{white}\rule{\textwidth}{[%footer%]}} },pages=-]{[% file %]} \end{document} __v2__ \documentclass[portuges,a4paper]{article} %%% template for debug \usepackage{color} \usepackage{pdfpages} \RequirePackage[a4paper,top=0mm,left=0mm,right=0mm,bottom=0mm,nohead,nofoot]{geometry} \begin{document} \includepdf[pagecommand={\pagestyle{empty}\thispagestyle{empty} {\_\_\_\_\_\_\_\_\color{white}\rule{0.45\textwidth}{[%header%]}} \vfill {\_\_\_\_\_\_\_\_\\\color{white}\rule{0.5\textwidth}{[%footer%]}} },pages=-]{[% file %]} \end{document} __END__ =head1 NAME clearheadfoot - remove (make it white) the top and bottom of PDF file =head1 SYNOPSIS clearheadfoot -h=4cm -f=1cm f.pdf --> creates a f-b.pdf output file -h=... (default = 4cm) -f=... (default = 4cm) -d debug: show put points -o=fout.pdf (def f-b.pfg) =head1 DESCRIPTION =head1 AUTHOR J.Joao Almeida, jj@di.uminho.pt =head1 SEE ALSO perl(1). =cut