Go Back   MarcomCentral (PTI) and FusionPro User Communities > Software-Related Talk > The JavaScript Library

Notices

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old March 30th, 2012, 04:59 PM
ThomasLewis's Avatar
ThomasLewis ThomasLewis is offline
Senior Contributor
 
Join Date: Feb 2011
Posts: 215
Default Moving frames in Javascript

Quote:
Moving frames in Javascript
In FusionPro Producer (formerly FP Direct or FP Server), the ability to move a frame’s position and size can be controlled in JavaScript using the OnRecordStart callback rule.
Can I get a pointer to where I find the documentation for this? It appears that the language reference guide that installs with FP8 hasn't been updated to include this (and still says Copyright 2011). FindTextFrame("name").x = val; is apparently not the way to do it.
Reply With Quote
  #2  
Old April 2nd, 2012, 08:26 AM
Dan Korn's Avatar
Dan Korn Dan Korn is offline
FusionPro Senior Engineer / Forum Moderator
 
Join Date: Aug 2008
Location: Chicago, IL
Posts: 4,552
Default Re: Moving frames in Javascript

Quote:
Originally Posted by ThomasLewis View Post
Can I get a pointer to where I find the documentation for this? It appears that the language reference guide that installs with FP8 hasn't been updated to include this (and still says Copyright 2011). FindTextFrame("name").x = val; is apparently not the way to do it.
That is indeed the way to do it. Although you need to have a FusionPro 8 VDP Producer (Direct or Server) license. If you have a 7.2 or earlier license, or a VDP Creator (Desktop) license, it won't work, although you can upload your job to a FusionPro 8 VDP Producer system such as MarcomCentral and compose it there to move frames.

As for the documentation, the copyright date for FusionPro 8 may still say 2011, but it's the right doc. (Look for a section about arbitrarily adjusting stacking.) I'll look into the documentation for the frame API specifically and figure out what happened to that.

Note that the Building Blocks dialog fully documents the frame API, on the Objects tab under "Frames."
__________________
Dan Korn
FusionPro Developer / JavaScript Guru / Forum Moderator
PTI Marketing Technologies | Printable | MarcomCentral
LinkedIn

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)});
Reply With Quote
  #3  
Old April 2nd, 2012, 09:32 AM
Lauren Lauren is offline
Sr. Graphics Engineer
 
Join Date: Oct 2008
Location: Chicago, IL
Posts: 22
Default Re: Moving frames in Javascript

In the v8.0 User Guide, there is a paragraph addressing this new functionality at the bottom of p.232. It states,
You can resize and move text and graphic frames by changing their properties in JavaScript in OnRecordStart. Note, however, that this will only work for the FusionPro Producer (formerly known as FP Direct and FP Server products.) If used with the Designer or Creator (aka Desktop) tool, then the moved/resized frames will be highlighted in the output, and an error message is generated to indicate that the Producer software is required to create final output of moved frames.
To use this new functionality you would use the OnRecordStart callback rule. Here is an example of code that could be used within it:
Code:
var frame = FindTextFrame("TextFrame1"); //set this value to the name of the frame
var NewHeight = 36000; //5 inches specified in hundreths of a point
var NewWidth = 21600; //3 inches specified in hundreths of a point
var NewX = 21600; //3 inches specified in hundreths of a point
var NewY = 28800; //4 inches specified in hundreths of a point

frame.height = NewHeight;
frame.width = NewWidth;
frame.x = NewX;
frame.y = NewY;
I have also attached a sample job that uses this code.
Attached Files
File Type: zip Move Frame.zip (38.0 KB, 39 views)
Reply With Quote
  #4  
Old April 2nd, 2012, 10:03 AM
ThomasLewis's Avatar
ThomasLewis ThomasLewis is offline
Senior Contributor
 
Join Date: Feb 2011
Posts: 215
Default Re: Moving frames in Javascript

I'm using Desktop but it will be composed on MarcomCentral. I guess I was under the impression that the frame itself would move in the preview. I see now that the contents do move but the frame doesn't, I just had to make the frame bigger to see it.
Reply With Quote
  #5  
Old April 2nd, 2012, 11:44 AM
Dan Korn's Avatar
Dan Korn Dan Korn is offline
FusionPro Senior Engineer / Forum Moderator
 
Join Date: Aug 2008
Location: Chicago, IL
Posts: 4,552
Default Re: Moving frames in Javascript

Quote:
Originally Posted by ThomasLewis View Post
I'm using Desktop but it will be composed on MarcomCentral. I guess I was under the impression that the frame itself would move in the preview. I see now that the contents do move but the frame doesn't, I just had to make the frame bigger to see it.
I'm not sure what you mean by, "the contents do move but the frame doesn't." The entire frame should move in Preview, although if you don't have a Producer license, the frame will have a random border and fill applied. It might help if you could post a sample job or a screenshot of what you're seeing. We do want to know about any issues with this new functionality.
__________________
Dan Korn
FusionPro Developer / JavaScript Guru / Forum Moderator
PTI Marketing Technologies | Printable | MarcomCentral
LinkedIn

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)});

Last edited by Dan Korn; April 2nd, 2012 at 11:57 AM..
Reply With Quote
  #6  
Old April 2nd, 2012, 12:00 PM
ThomasLewis's Avatar
ThomasLewis ThomasLewis is offline
Senior Contributor
 
Join Date: Feb 2011
Posts: 215
Default Re: Moving frames in Javascript

Please see attached. It's not a big deal, I just didn't notice it at first so I didn't think I got the JavaScript right. I do see that 6 point border being an issue though as positioning of the text will be off when that's gone.
Attached Images
File Type: jpg Step1.jpg (38.3 KB, 54 views)
File Type: jpg Step2.jpg (37.3 KB, 48 views)
File Type: jpg Step3.jpg (46.4 KB, 46 views)
Reply With Quote
  #7  
Old April 3rd, 2012, 09:42 AM
Dan Korn's Avatar
Dan Korn Dan Korn is offline
FusionPro Senior Engineer / Forum Moderator
 
Join Date: Aug 2008
Location: Chicago, IL
Posts: 4,552
Default Re: Moving frames in Javascript

Quote:
Originally Posted by ThomasLewis View Post
Please see attached. It's not a big deal, I just didn't notice it at first so I didn't think I got the JavaScript right. I do see that 6 point border being an issue though as positioning of the text will be off when that's gone.
I see. The frames may not appear in Preview if they don't overlap other frames, as the Preview system is based on the locations of the original frames, and doesn't know that they've been moved. You pretty much need to do a regular (non-Preview) composition to see frames which have been moved significantly in JavaScript. The other option is to place an empty frame over the entire page, which will force the entire page to be redrawn in Preview.
__________________
Dan Korn
FusionPro Developer / JavaScript Guru / Forum Moderator
PTI Marketing Technologies | Printable | MarcomCentral
LinkedIn

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)});

Last edited by Dan Korn; April 3rd, 2012 at 04:20 PM..
Reply With Quote
  #8  
Old October 31st, 2012, 11:18 AM
jreynolds jreynolds is offline
Junior Community Member
 
Join Date: Feb 2011
Location: Dallas, TX
Posts: 11
Default Re: Moving frames in Javascript

So I got my text frames to move correctly thanks to this thread, but now I need to know how to move them based on a variable in a field, but to leave them "as is" otherwise.

Here's my statement now that isn't working. I need to center 3 frames when a currency field has zero cents:
Code:
if ((Right("Price-2for"),2) == "00");
return
{
FindTextFrame("K (Price n for)").x = 8776
FindTextFrame("K (Price n for)").y = 6235
FindTextFrame("J (Qty n for)").x = 3996
FindTextFrame("J (Qty n for)").y = 4053
FindTextFrame("J (For only)").x = 8374
FindTextFrame("J (For only)").x = 4025
}
__________________
Jeff Reynolds
ViaTech Publishing
Windows 7 / Acrobat 10.1.3
FP VDP Creator 8.2.7
Reply With Quote
  #9  
Old October 31st, 2012, 11:52 AM
ThomasLewis's Avatar
ThomasLewis ThomasLewis is offline
Senior Contributor
 
Join Date: Feb 2011
Posts: 215
Default Re: Moving frames in Javascript

It's hard to tell without seeing exactly what you are doing but this JavaScript might be a little closer to what you intended:

Code:
if (Right(Field("Price-2for"),2) == "00")
{
	FindTextFrame("K (Price n for)").x = 8776;
	FindTextFrame("K (Price n for)").y = 6235;
	FindTextFrame("J (Qty n for)").x = 3996;
	FindTextFrame("J (Qty n for)").y = 4053;
	FindTextFrame("J (For only)").x = 8374;
	FindTextFrame("J (For only)").x = 4025;
}
Reply With Quote
  #10  
Old October 31st, 2012, 12:04 PM
step's Avatar
step step is offline
Senior Contributor
 
Join Date: Jan 2010
Location: Charlotte, NC
Posts: 955
Default Re: Moving frames in Javascript

I'm guessing that this change needs to be made so that there isn't conflicting information for the x position of the "J (For only)" text box:
Code:
if ((Right("Price-2for"),2) == "00");
return
{
FindTextFrame("K (Price n for)").x = 8776
FindTextFrame("K (Price n for)").y = 6235
FindTextFrame("J (Qty n for)").x = 3996
FindTextFrame("J (Qty n for)").y = 4053
FindTextFrame("J (For only)").x = 8374
FindTextFrame("J (For only)").y = 4025
}
__________________
Ste Pennell
FusionPro VDP Creator 9.3.15
Adobe Acrobat X 10.1.1
Mac OS X 10.12

LinkedIn
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 03:44 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
(c) 2011, PTI Marketing Technologies™, Inc.