Do you mean adding a border around each page?
The following uses PDF::API2 directly to draw a 1 pt border 10pt (~3.5mm) in from the edge of the page
#!/usr/bin/perl
use warnings; use strict;
use PDF::API2;
my $pdf = PDF::API2->open('/tmp/test.pdf');
foreach my $pagenum (1 .. $pdf->pages) {
my $page = $pdf->openpage($pagenum);
#
# Get the page size
#
my @mbox = $page->get_mediabox;
my $gfx = $page->gfx;
#
# Draw a box 10pt in from the edges of the page
#
$gfx->linewidth(1);
$gfx->strokecolor('#000000');
$gfx->rect($mbox[0]+10, $mbox[1]+10, $mbox[2]-20, $mbox[3]-20);
$gfx->stroke;
}
$pdf->savas('/tmp/test1.pdf');