ReminderVDP Posted February 1, 2013 Share Posted February 1, 2013 Is there any way to scale a graphic in a graphic frame and tell it to not scale larger than 100%? We have several logos that need to be used in several locations in one layout at different sizes but we don't want the largest logo to be larger than 100%. Is there a tag or a rule that can make this happen? Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted February 5, 2013 Share Posted February 5, 2013 Not directly. However, you can measure the graphic, compare its dimensions to the frame's, and then change the scaling or clipping (or place the graphic in another frame) accordingly. The measurement is similar to the logic in this post: http://forums.pti.com/showpost.php?p=1367&postcount=2 So you could do something like this in OnRecordStart: var graphic = Rule("PI_Rule"); // rule that returns a graphic resource var frame = FindGraphicFrame("YourFrameName"); // name of the frame // Measure the graphic. var TM = new FusionProTextMeasure; TM.useTags = true; var err = TM.CalculateTextExtent(graphic.content); if (err) throw "Error measuring graphic resource: " + res + ": " + TM.messages; // If the graphic is bigger than the frame, scale it down. if (TM.textWidth > frame.width || TM.textHeight > frame.height) frame.scale = "Best Fit"; Quote Link to comment Share on other sites More sharing options...
dreimer Posted June 10, 2013 Share Posted June 10, 2013 I get errors trying this rule. Do I need a newer version of Fusion Pro for this rule? Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted June 11, 2013 Share Posted June 11, 2013 I get errors trying this rule. What errors exactly?Do I need a newer version of Fusion Pro for this rule? This should work with 7.2. Quote Link to comment Share on other sites More sharing options...
dreimer Posted June 11, 2013 Share Posted June 11, 2013 (edited) If I leave the rule as is with updating my rule name and frame name I get ReferenceError: res is not defined. If I take that part of the rule out, I get a Unknown graphic scaling attribute value Best Fit Edited June 11, 2013 by dreimer Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted June 11, 2013 Share Posted June 11, 2013 If I leave the rule as is with updating my rule name and frame name I get ReferenceError: res is not defined. If I take that part of the rule out, I get a Unknown graphic scaling attribute value Best Fit Sorry, I must have typed that rule up off the cuff, without trying it out. The "throw" line has the wrong variable name in it. Also, in the very last line, if you're using FusionPro 8.0 or later, you can specify "Best Fit", as shown in the Graphic Frame Properties dialog, or you can specify "Best". In older versions, you have to specify "Best". Try this: var graphic = Rule("YourGraphicRule"); // rule that returns a graphic resource var frame = FindGraphicFrame("YourFrameName"); // name of the frame // Measure the graphic. var TM = new FusionProTextMeasure; TM.useTags = true; var err = TM.CalculateTextExtent(graphic.content); if (err) throw "Error measuring graphic resource: " + graphic + ": " + TM.messages; // If the graphic is bigger than the frame, scale it down. if (TM.textWidth > frame.width || TM.textHeight > frame.height) frame.scale = "Best"; Quote Link to comment Share on other sites More sharing options...
dreimer Posted June 11, 2013 Share Posted June 11, 2013 Great, thanks!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.