This code may look unusual, but I am trying three different tests at the same time. Each file type creation works the same if run individually...
Sorry, but the indentation seems to be lost when posting in this forum.
- Code: Select all
// I have already set the license at this point. This is just the code section that
// loops through an array of blobs (binary large objects) where each element contains binary data
// of a single scanned image page.
FOR ll_index = 1 TO il_blob_image_count
// Build the file names for the multi-page tiff, the single-page pdf and the single-page tiff
// Note: These name strings work fine and are created correctly
ls_TiffFileName = ls_export_path +String(al_idbatch) + ".tif"
ls_PDFFileName = ls_export_path +String(al_idbatch) + "_" + String(ll_index) + ".pdf"
ls_SingleTiffFileName = ls_export_path +String(al_idbatch) + "_" + String(ll_index) + ".tif"
// Populate the object with the binary image data
ll_image_handle = ole_1.object.CreateImageFromByteArray(lblob_tiff_image_data[ll_index])
IF ll_index = 1 THEN
// If it is the first time through the loop, then create the multi-page tif file
ll_image_handle = ole_1.object.CreateImageFromByteArray(lblob_tiff_image_data[ll_index])
ll_gdPictureStatus = ole_1.object.TiffSaveAsNativeMultiPage (ls_TiffFileName)
ELSE
// Otherwise add this image to the multi-page tiff
ll_gdPictureStatus = ole_1.object.TiffAddToNativeMultipage (ll_image_handle)
END IF
lb_retval = ole_1.object.SaveAsPDFEx(ls_PDFFileName) // This line could be commented out
ll_gdPictureStatus = ole_1.object.SaveAsTiff(ls_SingleTiffFileName) // This line could be commented out
ll_gdPictureStatus = ole_1.object.CloseImage (ll_image_handle)
NEXT
ll_gdPictureStatus = ole_1.object.TiffCloseNativeMultiPage()
Again, this code works perfectly. That is, a multi-page tiff is created for every blob in the array (which in the case of my test has 10 elements/pages). In addition, 10 individual tiff images are created and 10 individual PDF's are created. So everything appears as if it worked properly. But if you look at pages 4 thru 10 of the multi-page tiff, the pages are blank. And if you look at the individual tiff and PDF files, numbers 4 thru 10 are also blank. The only difference that I can see between the images contained in the blobs are the fact that images 1 thru 3 are in portrait orientation and the remaining images 4 thru 10 are all in landscape orientation.
And the image data (for all 10 pages) is valid because we have another application that is able to successfully extract the data and create a 10-page multi-page PDF file, and that is how I know that the last 7 pages are of landscape orientation. Any ideas?