use CAM::PDF; my $pdf = CAM::PDF->new('Test1.pdf'); # existing document my $page = $pdf->getPageContent(1); # $page now holds the uncompressed page content as a string # replace the text part $page =~ s/some placeholder text/my new text/; $pdf->setPageContent(1, $page); $pdf->cleanoutput('Test2.pdf');