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