EZTwain Pro - Append to a File

Overview  Download  Licensing  Features  Code Wizard  Stories  User GuidePDF file

With EZTwain Pro 3.05b18 we added the ability to append pages to an existing TIFF file.
In 3.09b11 we extended this feature to PDF files. Note that appending to PDF files should work with any valid PDF, but we only test it on PDFs generated by EZTwain Pro.

The basic code to append File1 to File2 looks like this, in no particular language:

if TWAIN_BeginMultipageFile(file1Name) = 0 then
integer N = DIB_FilePageCount(file2Name)
for integer i = 0 to N-1 do
32-bit integer hdib = DIB_LoadPage(file2Name, i)
if hdib <> 0 then ' append page to file1
TWAIN_DibWritePage(hdib) ' free that memory, or it stays allocated ' until the process terminates:
end if ' If reading or writing errored, stop the loop:
if TWAIN_LastErrorCode <> 0 then
exit loop
end if
next i ' Clean up and close the output file:
end if ' If an error was detected, report it to the user:
if TWAIN_LastErrorCode() <> 0 then
TWAIN_ReportLastError("while appending to file")
end if ' Turn off file-append mode, if you do not normally ' want EZTwain to append to existing files:

Please contact Technical Support if you encounter any problems using EZTwain Pro 3. We are committed to resolving such problems promptly.