#!/usr/bin/perl -T use CGI::Carp qw(fatalsToBrowser); use FindBin qw($RealBin); my $safepath; BEGIN { if ($RealBin =~ m!^(/home/...path.to.site.../(test|uk)/www)!) { $safepath = "$1/../lib"; } else { die "Insecure access!"; } } use lib "$safepath"; use cPanelUserConfig; use PDF::API2; use strict; use warnings; my $pdf = PDF::API2->open("$ENV{'DOCUMENT_ROOT'}/../data/xmas/GiftSubscription.pdf"); my $font = $pdf->font("$ENV{'DOCUMENT_ROOT'}/../data/xmas/Merriweather.ttf"); my $page = $pdf->open_page(1); my $text = $page->text; $text->font($font, 36); $text->position(656, 403); $text->text('ABC-123'); $pdf->save("$ENV{'DOCUMENT_ROOT'}/test.pdf"); print "Content-type: text/plain\n\n"; print "$ENV{'HTTP_HOST'}/test.pdf\n"; #### Insecure dependency in open while running with -T switch at /usr/lib64/perl5/IO/File.pm line 187