ImgDoc_CreateWithFile_JSN

Create an image document instance referencing an existing file.
ImgDoc_CreateWithFile_JSN(filePath;optionsJSON) ➔ imgDocRef
filePath Text The full (absolute) pathname to the image file.
optionsJSON Text Options in JSON format.
↩︎ imgDocRef Text image document reference.

Create an image document instance referencing an existing file.

The image document reference is returned in imgDocRef. The caller must release the document reference when no longer needed with a call to ImgObj_Release, otherwise there will be a memory leak.

If the method call fails for some reason, an empty string is returned and the Q2Pix error info is set accordingly.

Parameter filePath is the full (absolute) pathname to the image file. The pathname may be in either POSIX (recommended) or System format.

The optional optionsJSON parameter is a 4D object serialized in JSON format and may contain the following properties:

Property name Description
“Format” The option’s value is the format identifier (a string) of the specified image document. This option does not restrict the reading of the image to the specified format, but rather acts as a ‘hint’ to the plug-in and underlying OS imaging libraries.
“Password” The option’s value is the password (a string) for a protected PDF document.

If the specified file is a locked PDF document, Q2Pix will try to open it with the password provided in options. If that fails the error info will be set to "Q2Pix"/kQ2PixErrAuth.

Note

The ImgDoc_CreateWithFile method in Q2PixLib is build on top of this plug-in method and offers more than what’s offered by ImgDoc_CreateWithFile_JSN: a standard file selection dialog, and PDF password entry when that’s needed.