I wrote an addon for my software that will allow the end user to append documents from a TWAIN source to an existing document. The code works fine on my development machine, but I get the following error on every other machine I try it on.
The problem appears to be occuring when I execute the following code:
Code: Select all
PROCEDURE Merge2PDF
LPARAMETERS cInPDFPath1, cInPDFPath2, cOutPDFpath
oImaging.PdfNewPdf (cOutPDFpath)
oGdViewer.LockControl = .T.
nImageCount = 0
oGdViewer.DisplayFromPdfFile (cInPDFPath1)
FOR nCpt = 1 TO oGdViewer.NumPages
oGdViewer.DisplayFrame (nCpt)
IF oImaging.PdfAddImageFromImageID(oGdViewer.GetNativeImage) <> 0
nImageCount = nImageCount + 1
ENDIF
ENDFOR
oGdViewer.CloseImage
oGdViewer.DisplayFromPdfFile (cInPDFPath2)
FOR nCpt = 1 TO oGdViewer.NumPages
oGdViewer.DisplayFrame (nCpt)
IF oImaging.PdfAddImageFromImageID(oGdViewer.GetNativeImage) <> 0
nImageCount = nImageCount + 1
ENDIF
ENDFOR
oGdViewer.CloseImage
FOR nCpt = 1 TO nImageCount
oImaging.PdfSetPageDimensions(oImaging.PdfGetImageWidth(nCpt), oImaging.PdfGetImageHeight(nCpt))
oImaging.PdfNewPage
oImaging.PdfDrawImage(nCpt, 1, 1, oImaging.PdfGetImageWidth(nCpt), oImaging.PdfGetImageHeight(nCpt))
oImaging.PdfEndPage
ENDFOR
oImaging.PdfSavePdf
ENDPROC