0

EDIT:

I changed my question again:

I am using this library to manipulate PDF files.

I am using this code to serve the output to the browser:

#!perl
use strict;
use warnings;

use lib "..\\mymodules\\CAM-PDF-1.57\\lib";

use CAM::PDF;
my $pdf = CAM::PDF->new('doc1.pdf');

# append the other file
my $anotherpdf = CAM::PDF->new('doc2.pdf');

$pdf->appendPDF($anotherpdf);

print "Content-Type: application/pdf\n";
print "Content-Disposition: inline\n\n";

print "Content-Transfer-Encoding: binary\n";
print "Accept-Ranges: bytes\n\n";

$pdf->output();

The result:

I get only the first pdf file loaded in the browser.

Problem solved:

I had to add $pdf->clean(); before the $pdf->output(); command, and it works perfect. :)

martin clayton
  • 76,436
  • 32
  • 213
  • 198
Yaron
  • 1,540
  • 3
  • 19
  • 33

1 Answers1

0

You said there is no TEMP variable, but your code using it:

$pdf->cleanoutput($ENV{"TEMP"} . '\\out1.pdf');

Try to set it to some value (I assuming that you are using windows)

$ENV{'TEMP'}='c:\tmp';
mkdir($ENV{'TEMP'});
die "$ENV{'TEMP'} not exists" if ! -d $ENV{'TEMP'};
$pdf->cleanoutput($ENV{"TEMP"} . '\\out1.pdf');

Why are you using // in some path? Like: use lib "..\mymodules\CAM-PDF-1.57\lib"; In use lib statement always use full path.

user1126070
  • 5,059
  • 1
  • 16
  • 15
  • Hi. Thanks. This code is supposed to run from a CD, and the requirement is to not write to the local computer. So, I want to find a way to use %TEMP% folder of windows, or another solutions. I cannot decide to create a folder myself. Thank you – Yaron Mar 13 '12 at 20:09