ImgDoc_CreateWithPicture

Create an image document instance referencing image data provided in a 4D picture.
ImgDoc_CreateWithPicture(pictPtr{; options}) ➔ imgDocRef
pictPtr Pointer A pointer to a picture.
options Object Options.
imgDocRef Text The reference to the created image document instance.

Create an image document instance referencing image data provided in a 4D picture. The image document reference is returned in imgDocRef.

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

Parameter pictPtr is a pointer to a 4D picture.

A 4D picture may contain multiple representations of the same image. This method finds the first representation in a supported format with the help of the PictUtil_GetImageFormats plug-in method, extracts the representation’s image data with a call to the PictUtil_GetImageData plug-in method, and finally passes the image data to ImgDoc_CreateWithBLOB.

The optional options object parameter may contain the following key/value pairs:

Key Description
“Password” The option’s value is the password (a string) for a protected PDF document.
“AllowUserInteraction” The option’s value is a boolean denoting whether user interaction is allowed. Default value is True.

If the selected image representation contains a locked PDF document and opening it fails with an authorization error ("Q2Pix"/kQ2PixErrAuth), a password entry dialog is presented to the user. If the user enters the correct password, the PDF document is opened and the document reference is returned. If the user cancels the dialog, the Q2Pix error info is set to "Q2Pix"/kQ2PixErrAuth and the method returns an empty string. If the user enters an invalid password, the method keeps running the password request dialog until the user either enters the correct dialog, or cancels.

The AllowUserInteraction property defaults to True, which allows this command to present the PDF password dialog, if necessary. When calling this method in a batch or unattended process, you may consider setting this to False so as the process is not halted by the dialog waiting for user input.