#1
|
|||
|
|||
![]()
I was wondering if there is a way to dynamically set the x coordinates of a text frame based on the dimensions of an uploaded graphic.
I have a graphic frame that the user uploads a logo to. To the left of said frame I have a text frame that holds the company's slogan. I'm looking for a way to move the text frame so that it always butt's up against the left of the uploaded logo. My original thought was to use FusionProTextMeasure to get the width of the uploaded graphic, using: Code:
var graphic = Field("Logo"); function getGraphicWidth(input){ var tm = new FusionProTextMeasure; tm.useTags = true; tm.CalculateTextExtent(input); return tm.textWidth; } return getGraphicWidth(graphic); In closing, is there a way to get the width of an uploaded image after it's been inserted into a graphic frame? Or, if anyone knows of a simpler/better/more accurate way of doing this, I'm all ears. TIA.
__________________
Ryan Boever FusionPro VDP Designer 9.3.36 Adobe Acrobat XI 11.0.07 Windows 10 |
#2
|
||||
|
||||
![]()
You're really asking two questions:
Frames can be moved and resized like so: Code:
FindTextFrame("YourFrameName").x = 7200; // <- value in hundredths of points As for finding the final scaling applied to a graphic, FusionPro won't tell you that exactly, but you can figure it out. Depending on what scaling factor you have applied to the graphic frame, you can do some math to basically duplicate what FusionPro is doing to the graphic, based on the initial width and height of the graphic itself, which you already know how to get using FusionProTextMeasure, and the dimensions of the frame, which you can get by calling FindGraphicFrame and accessing properties such as width and height from the returned object. (You can also interrogate the scaling and positioning set for the graphic frame. Note that you do NOT need a Producer or Server license to get this frame information, only to modify a frame's position or size.) However, depending on how the job is set up, you might just want to use an inline graphic, with a hard-coded height in the <graphic> tag, which will automatically scale the graphic proportionally and line the text up with it. I might be able to offer more specific suggestions if I could see what you're trying to do, even just a picture of the desired output for a couple different variations.
__________________
Dan Korn FusionPro Developer / JavaScript Guru / Forum Moderator PTI Marketing Technologies | Printable | MarcomCentral I am a not a Support engineer, and this forum is not a substitute for Support. My participation on this forum is primarily as a fellow user (and a forum moderator). I am happy to provide help and answers to questions when I can; however, there is no guarantee that I, or anyone else on this forum, will be able to answer all questions or fix any problems. If I ask for files to clarify an issue, I might not be able to look at them personally. I am not able to answer private messages, emails, or phone calls unless they go through proper Support channels. Please direct any sales or pricing questions to your salesperson or inquiries@marcom.com. Complex template-building questions, as well as all installation and font questions or problems, should be directed to FusionProSupport@marcom.com. Paid consulting work may be required to fulfill your template-building needs. This is a publicly viewable forum. Please DO NOT post fonts, or other proprietary content, to this forum. Also, please DO NOT post any "live" data with real names, addresses, or any other personal, private, or confidential data. Please include the specific versions of FusionPro, Acrobat, and your operating system in any problem reports or help requests. I recommend putting this information in your forum signature. Please also check your composition log (.msg) file for relevant error or warning messages. Please post questions specific to the MarcomCentral Enterprise and Web-to-Print applications in the MarcomCentral forum. Click here to request access. Or contact your Business Relationship Manager (BRM/CPM) for assistance. Please direct any questions specific to EFI's Digital StoreFront (DSF) to EFI support. How To Ask Questions The Smart Way The correct spellings are JavaScript, FusionPro, and MarcomCentral (each with two capital letters and no spaces). Acceptable abbreviations are JS, FP, and MC (or MCC). There is no "S" at the end of "Expression" or "Printable"! The name of the product is FusionPro, not "Fusion". "Java" is not is not the same as JavaScript. Check out the JavaScript Guide and JavaScript Reference! FusionPro 8.0 and newer use JavaScript 1.7. Older versions use JavaScript 1.5. return "KbwbTdsjqu!spdlt\"".replace(/./g,function(w){return String.fromCharCode(w.charCodeAt()-1)}); ![]() |
![]() |
Thread Tools | Search this Thread |
Display Modes | |
|
|