CkPython
CkPython
Load Entire File into BinData
Demonstrates how to load an entire file into a BinData object.Chilkat CkPython Downloads
import sys
import chilkat
success = False
fac = chilkat.CkFileAccess()
success = fac.OpenForRead("qa_data/pdf/sample.pdf")
if (success == False):
print(fac.lastErrorText())
sys.exit()
bd = chilkat.CkBinData()
maxBytesToRead = 99999999
success = fac.FileReadBd(maxBytesToRead,bd)
if (success == False):
print(fac.lastErrorText())
sys.exit()
fac.FileClose()
# The bd object contains the file data...
success = bd.WriteFile("qa_output/sample.pdf")