Jump to content

Reference Materials for Rules in FusionPro


Recommended Posts

Other than the UserGuide.pdf, TagsRefGuide.pdf, and RulesSystemGuide.pdf that are links in FusionPro, are there other references I can use to learn more about the scripting environment (other than this portal)?

 

I am trying to create an OnRecordStart script and I am looking for more information than the above guides provide on the PDFBoundingBox.

 

Thanks

Link to comment
Share on other sites

Dan,

 

I have a template where the User can upload vector art. Some of the uploads have been PDFs, which default to the crop box. But their art is smaller (logos and such), so we get a lot of extra space around the logos when they "Fill" the graphic frame.

 

I am hoping that the PDFBoundingBox will allow me to change that default to ArtBox so the logos will come in and size to fill the graphic frame without all of the extra space.

 

What I keep getting wrong is the format of the code. I am not a programming expert. I have the code from FusionPro:

 

<FusionProGraphicFrame>.PDFBoundingBox

 

So where do I put the "ArtBox" instruction? I am guessing that "FusionProGraphicFrame" needs to be changed to the name of my graphic frame in FusionPro.

 

Should this also be in a "OnRecordStart" rule? I am guessing it should be.

 

I was hoping to find an example that gave me a basic understanding of how to format the code so I could learn how to set it up and format mine.

Link to comment
Share on other sites

I see. Yes, you could use the PDFBoundingBox of a FusionProGraphicFrame object, returned from a FindGraphicFrame call, in OnRecordStart, like so:

FindGraphicFrame("YourFrameName").PDFBoundingBox = "ArtBox";

But that assumes that you're also setting down a graphic with the FusionProGraphicFrame.SetGraphic function, like so:

FindGraphicFrame("YourFrameName").SetGraphic("someFileName.pdf");

Or, to combine these calls:

var myFrame = FindGraphicFrame("YourFrameName");
myFrame.SetGraphic("someFileName.pdf");
myFrame.PDFBoundingBox = "ArtBox";

However, that's not the only way you can do this. There's also the pdfbbox property of the FusionProResource object. Assuming you already have a regular Graphic rule of some kind (not a callback such as OnRecordStart), which does something like this:

return CreateResource(Field("SomeFieldName"));

You can modify that rule to do this:

var myResource = CreateResource(Field("SomeFieldName"));
myResource.pdfbbox = "ArtBox";
return myResource;

Or, if you have a different rule, you can either post it here and I can suggest how to apply the same change to it, or you can just leave that rule alone and create a new Graphic rule to call the old one and apply the bounding box to the resource it returns, like so:

var myResource = Rule("OldRuleName"); // Presumably the other rule returns a graphic resource.
myResource.pdfbbox = "ArtBox";
return myResource;

Then use the new rule in your Graphic frame instead of the old one.

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.

Guest
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...