Sample code for 30+ languages & platforms
PowerShell

Load Entire File into BinData

Demonstrates how to load an entire file into a BinData object.

Chilkat PowerShell Downloads

PowerShell
Add-Type -Path "C:\chilkat\ChilkatDotNet47-x64\ChilkatDotNet47.dll"

$success = $false

$fac = New-Object Chilkat.FileAccess

$success = $fac.OpenForRead("qa_data/pdf/sample.pdf")
if ($success -eq $false) {
    $($fac.LastErrorText)
    exit
}

$bd = New-Object Chilkat.BinData
$maxBytesToRead = 99999999
$success = $fac.FileReadBd($maxBytesToRead,$bd)
if ($success -eq $false) {
    $($fac.LastErrorText)
    exit
}

$fac.FileClose()

# The bd object contains the file data...
$success = $bd.WriteFile("qa_output/sample.pdf")