cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

We are happy to announce the new Windchill Customization board! Learn more.

*****SPAM***** Watermarking pdf's

daniel.garcia
1-Newbie

*****SPAM***** Watermarking pdf's

Here is the code I use:

add_DRAFT($psfilename)


sub add_DRAFT {
my $linea;
my $sFinal;

my $flag = 0;
my $x = 0;
my $y = 0;
my $fontsize = 0;

my $ps = shift;

open BOM, $ps;
while($linea=<bom>) {
if ($linea =~ /<<\/PageSize\[(\d+) +(\d+)]>> setpagedevice/) {
$x = int($1 / 2);
$y = int($2 / 2) - 10;
$fontsize = $1 > $2 ? int($1 / 10) : int($2 / 10);
$sFinal .= $linea;
} elsif ($linea =~ /^%%EndPageSetup/) {
if ($flag) {
$sFinal .= "grestore\n";
}
# $flag = 1;
$sFinal .= $linea;
$sFinal .= "gsave\n";
$sFinal .= "1 0.75 0.75 setrgbcolor\n";
$sFinal .= $x . " " . $y . " moveto\n";
$sFinal .= "20 rotate\n";
$sFinal .= "/Helvetica-Bold findfont " . $fontsize . " scalefont setfont\n";
$sFinal .= "(DRAFT) dup stringwidth pop 2 div neg 0 rmoveto show\n";
$sFinal .= "grestore\n";
} else {
$sFinal .= $linea;
}
}
close BOM;

open BOM, ">$ps";
print BOM $sFinal;
close BOM;
}

Best regards

Daniel Garcia

Enviado desde mi iPhone

> El 07/04/2014, a las 09:49, "Brand, David" <dbrand@linx.co.uk> escribió:
>
> Hi Daniel
>
> Would you mind sharing the files you use for this?
>
> Regards
>
> David Brand
>
0 REPLIES 0
Top Tags