Perl
Chilkat2 Perl
Load Entire File into BinData
Demonstrates how to load an entire file into a BinData object.Chilkat Perl Downloads
use strict;
use warnings;
use Chilkat2;
my $fac = Chilkat2::FileAccess->new;
my $success = $fac->OpenForRead('qa_data/pdf/sample.pdf');
if (!$success) {
print $fac->LastErrorText, "\n";
exit;
}
my $bd = Chilkat2::BinData->new;
my $maxBytesToRead = 99999999;
$success = $fac->FileReadBd($maxBytesToRead, $bd);
if (!$success) {
print $fac->LastErrorText, "\n";
exit;
}
$fac->FileClose();
# The bd object contains the file data...
$success = $bd->WriteFile('qa_output/sample.pdf');