Jump to content

Simple question for when a graphic file does not exist


Recommended Posts

I'm using the following code to return an inline graphic:


return CreateResource(Field("name") + ".pdf", "graphic");


It works fine. However, the customer did not supply every file necessary. When the file does not exist, I instead want to simply return the name field using an appropriate font.


So my question is pretty simple, how do you check that the graphic file indeed exists and if not, run a different set of code?



Link to comment
Share on other sites

I would do this by creating a text frame set on top of a graphic frame and use this:


Pic = CreateResource(Field("name") + ".pdf", "graphic", true);
if (Pic.exists){
FindTextFrame("Text").suppress = true;
return Pic;
FindGraphicFrame("Image").suppress = true;
return CreateResource("");

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...