The Toolkit OpenInputFile method returns (version 8.1.4 and above)


*pRetVal = object.OpenInputFile(InputFileName);




  • -3 = Unable to open input file, the owner password is invalid. (v8.1.4 +)


  • -2 = Unable to open input file, the user password is invalid. (v8.1.4+)


  • -1 = Unable to open input file, or the byte stream is invalid. (all versions)

  •  0 = Success.


OpenInputFile Returns -1


Probable Cause



  • The output file is already open

  • The input file's security settings do not allow the PDF to be copied unless passwords have been entered.


Resolution



  1. Ensure that the output file is not already open. Close the file, and then attempt the conversion.

  2. Determine if the error is due to the input file's security settings.

  3. Open the PDF using Adobe® When the file is opened in Reader, press Ctrl+D, then click the Security tab. A list of actions requiring passwords appears.

  4. If you have the necessary passwords, enter them using the SetInputPasswords method, which will allow Toolkit to process the PDF.


For Toolkit versions prior to 8.1.4, See Advanced Error Handling in ActivePDF


' Extended Error codes available for OpenInputFile and OpenOutputFile



  • varReturn = TK.OpenInputFile(varPath & "input\" & varFileName)

  • If varReturn <> 0 Then 

  • Error("OpenInputFile")

  • log("EncryptionError: " & TK.EncryptionError)

  • log("ExtendedErrorCode: " & TK.ExtendedErrorCode)

  • log("ExtendedErrorDescription: " & TK.ExtendedErrorDescription)

  • log("ExtendedErrorLocation: " & TK.ExtendedErrorLocation)

  • End If