mergDoc

mergDoc is an iOS external that adds functions and commands related to document interaction. This currently includes presenting a modal preview, open in app menu, document options menu and requesting the document icons in PNG form. Printing is also available via the preview.

mergDoc Syntax

command mergDocShowPreview pFilePath

Syntax example:

mergDocShowPreview specialFolderPath("engine")& "/pdfs/help.pdf"

Presents the document in a full screen modal interface. An send to menu button is shown on the modal which also includes Print

Parameters:

  • pFilePath - the full path of the document.

Sets the result to one of:

  • mergDoc: preview shown
  • mergDoc:Error: unable to show preview

command mergDocShowOpenInMenu pFilePath,[pRect]

Syntax example:

mergDocShowOpenInMenu specialFolderPath("engine")& "/pdfs/help.pdf"
mergDocShowOpenInMenu specialFolderPath("engine")& "/pdfs/help.pdf",the rect of grc "popoverfromhere"

Presents an action sheet on iPhone and popover on iPad showing the apps that the document type can be sent to.

Parameters:

  • pFilePath - the full path of the document.
  • pRect - the rect that the iPad popover should show from, this will default to the target's rect so in most cases won't need to be set.

Sets the result to one of:

  • mergDoc: menu shown
  • mergDoc:Error: unable to show menu

command mergDocShowOptionsMenu pFilePath,[pRect]

Syntax example:

mergDocShowOptionsMenu specialFolderPath("engine")&"/pdfs/help.pdf"
mergDocShowOptionsMenu specialFolderPath("engine")&"/pdfs/help.pdf",the rect of grc "popoverfromhere"

Presents an action sheet on iPhone and popover on iPad showing the options for the document type.

Parameters:

  • pFilePath - the full path of the document.
  • pRect - the rect that the iPad popover should show from, this will default to the target's rect so in most cases won't need to be set.

Sets the result to one of:

  • mergDoc: menu shown
  • mergDoc:Error: unable to show menu

Note: there is a known issue with this command on iPad. Because of the order of delegate calls this command will not block after if the user chooses the Open In... menu item from the popover. This means the user may still be interacting with the open in menu when the command returns.

function mergDocCanOpen pFilePath

Syntax example:

set the enabled of btn "open in" to mergDocCanOpen( specialFolderPath("engine")&"/pdfs/help.pdf")

Returns true if there is an app that can open the document type.

Parameters:

  • pFilePath - the full path of the document.

Note: there is a known issue with this command on iPad where it will cause the app to crash if it is called before the stack is open.

function mergDocIconSizes pFilePath

Syntax example:

put mergDocIcon(specialFolderPath("engine")&"/pdfs/help.pdf",line 1 of mergDocIconSizes( specialFolderPath("engine")&"/pdfs/help.pdf")) into image "icon"

Returns a return separated list of available icon sizes.

Parameters:

  • pFilePath - the full path of the document.

function mergDocIcon pFilePath,pIconSize

Syntax example:

put mergDocIcon(specialFolderPath("engine")&"/pdfs/help.pdf",line 1 of mergDocIconSizes( specialFolderPath("engine")&"/pdfs/help.pdf")) into image "icon"

Returns the PNG format of the icon.

Parameters:

  • pFilePath - the full path of the document.
  • pIconSize - the width,height as returned from mergDocIconSizes.