/usr/share/doc/libpdf-create-perl/examples/sample-cgi.pl is in libpdf-create-perl 1.43-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | #!/usr/bin/perl
# PDF::Create usage for a Web CGI
#
# Inspired by alr with a CPAN annotation
use strict; use warnings;
use PDF::Create;
use CGI;
# CGI Header designating the pdf data
print CGI::header(
-type => 'application/x-pdf',
-attachment => 'sample.pdf'
);
# Open pdf to stdout
my $pdf = new PDF::Create(
'filename' => '-',
'Version' => 1.2,
'PageMode' => 'UseOutlines',
'Author' => 'John Doe',
'Title' => 'Sample Document',
);
# Prepare 2 fonts
my $font1 = $pdf->font(
'Subtype' => 'Type1',
'Encoding' => 'WinAnsiEncoding',
'BaseFont' => 'Helvetica'
);
my $font2 = $pdf->font(
'Subtype' => 'Type1',
'Encoding' => 'WinAnsiEncoding',
'BaseFont' => 'Helvetica-Bold'
);
# Prepare a Table of Content
my $toc = $pdf->new_outline('Title' => 'Sample Document');
# Create root page
my $page = $pdf->new_page('MediaBox' => $pdf->get_page_size('a4'));
# Add a entry to the outline
$toc->new_outline('Title' => 'Page 1', 'Destination' => $page);
# Write some text to the page
$page->stringc($font2, 40, 306, 426, 'PDF::Create');
$page->stringc($font1, 20, 306, 396, "version $PDF::Create::VERSION");
$page->stringc($font1, 20, 300, 300, 'Fabien Tassin');
$page->stringc($font1, 20, 300, 250, 'Markus Baertschi (markus@markus.org)');
$page->stringc($font1, 20, 300, 200, 'sample-cgi.pl');
# Wrap up the PDF and close the file
$pdf->close;
|