Jump to content

GraphicsFrame and TextFrame suppression and movement


EvanF

Recommended Posts

Mac OS X 10.9.5

FusionPro VDP Creator 9.3.6

Acrobat 11.0

 

I'm trying to get some graphics frames and text frame to reposition and suppress themselves based on data input.

 

For this basic example I've outlined three rows. Each row consists of a GraphicFrame and a TextFrame. First row is A, second is B, third is C.

 

If there is no content provided for row C I'm wanting to move the y position of the two frames from the rows above down one positions.

 

If there is no content provided for both row C and row B I'm wanting to move the y position of the frame from above down two positions.

 

Do I need to bind all these actions to some kind of event?

 

Things don't seem to be working as desired. I know I can achieve a similar layout using a bottom justified textFrame and suppressing lines as they aren't needed. But ultimately the goal of this is to get successful manipulation of the suppression and x,y position based on data input. Appreciate any input.

 

////////////////////////////////////////////////////////////////////////////////
//
//          GraphicsFrame   TextFrame       DefaultPosition
// ROW A:   [__ gf_A __]    [__ tf_A __]    x:1.24 y:0.514
// ROW B:   [__ gf_B __]    [__ tf_B __]    x:1.24 y:0.833
// ROW C:   [__ gf_C __]    [__ tf_C __]    x:1.24 y:1.15
//
// Simple test data:
//
// Record[0]: [A: "One", B: "Two", C: "Three"]
// Record[1]: [A: "One", B: "Two", C: ""]
// Record[2]: [A: "One", B: "", C: ""]
//
////////////////////////////////////////////////////////////////////////////////

// Locate all the frames needed for positioning
var sectionA = [];
var sectionB = [];
var sectionC = [];

sectionA.push(FindTextFrame("tf_A"));
sectionA.push(FindGraphicFrame("gf_A"));

sectionB.push(FindTextFrame("tf_B"));
sectionB.push(FindGraphicFrame("gf_B"));

sectionC.push(FindTextFrame("tf_C"));
sectionC.push(FindGraphicFrame("gf_C"));

// Determine the layout changes based on record content
if ( !Field("C") ) {
   // Missing input data in Field C
   if ( Field("B") ) {
       // Containing input data in Field B
       // Shift A & B one space down

       sectionA[0].y = 0.833;
       sectionA[1].y = 0.833;

       sectionB[0].y = 1.15;
       sectionB[1].y = 1.15;

       sectionC[0].supress = true;
       sectionC[1].supress = true;

//         sectionA.map( function(frame) {
//             frame.y = 0.833;
//         });
//         sectionB.map( function(frame) {
//             frame.y = 0.115;
//         });
//         sectionC.map( function(frame) {
//             frame.supress = true;
//         });

       return "One Shift";

   } else if ( !Field("B") ) {
       // Missing input data in Field B
       // Shift A two spaces down

       sectionA[0].y = 1.15;
       sectionA[1].y = 1.15;

       sectionB[0].supress = true;
       sectionB[1].supress = true;

       sectionC[0].supress = true;
       sectionC[1].supress = true;

//         sectionA.map( function(frame) {
//             frame.y = 1.15;
//         });
//         sectionB.map( function(frame) {
//             frame.supress = true;
//         });
//         sectionC.map( function(frame) {
//             frame.supress = true;
//         });

       return "Two Shifts";
   }
} else {
   // Shift no spaces

   return "No Shift";
}

EvanF_SupPosTest.zip

Link to comment
Share on other sites

Do I need to bind all these actions to some kind of event?

Yes, this should be done in the OnRecordStart callback rule.

 

Also, as Thomas notes, you need to compose with FP Direct/Producer or FP Server/Producer API.

Things don't seem to be working as desired.

Please be more specific about exactly what the expected results are, and how they're different from the actual results.

I know I can achieve a similar layout using a bottom justified textFrame and suppressing lines as they aren't needed.

You could also do this with a table, or with repeatable components, or by simply modifying leading.

But ultimately the goal of this is to get successful manipulation of the suppression and x,y position based on data input. Appreciate any input.

I don't have time to debug the rule for you. I suggest adding some calls to the Print function, so that you can debug the rule by examining the log file to see what's really happening.

 

Also, be mindful of your units. According to both the FusionPro Rules Guide and the Building Blocks dialog, the x and y properties specify the position in hundredths of points, of which there are 7200 per inch (72 points per inch times 100). So if you want to position a frame, say, two inches from the top of the page, you would set the y property to 14400. You might consider placing some "dummy" frames, with no content, on the page to act as markers, so that you can align the target frame with the dummy frame, so that you don't need to do math in the rule.

Link to comment
Share on other sites

Your code looks like it should theoretically work assuming you're composing this on a server like has been previously mentioned. You did, however, misspell "suppress" so that's probably why your frames aren't suppressing.
Link to comment
Share on other sites

Before you get too far into this, you need to make sure you are composing the output on Producer or Producer API for x and y movement.

 

Thanks for the direction!

 

I talked with my BRM, I see that the Creator doesn't have the ability to preview the x and y properly. It was explained to me that the FusionPro Creator/Expression were to allow MarcomCentral customers to preview their work before uploading to the site, but this certainly doesn't seem to be the case. Pretty disappointed I'll have to upload these before I can truly preview them. (Cumbersome workflow...)

 

Yes, this should be done in the OnRecordStart callback rule.

 

Also, as Thomas notes, you need to compose with FP Direct/Producer or FP Server/Producer API.

 

Please be more specific about exactly what the expected results are, and how they're different from the actual results.

 

You could also do this with a table, or with repeatable components, or by simply modifying leading.

 

I don't have time to debug the rule for you. I suggest adding some calls to the Print function, so that you can debug the rule by examining the log file to see what's really happening.

 

Also, be mindful of your units. According to both the FusionPro Rules Guide and the Building Blocks dialog, the x and y properties specify the position in hundredths of points, of which there are 7200 per inch (72 points per inch times 100). So if you want to position a frame, say, two inches from the top of the page, you would set the y property to 14400. You might consider placing some "dummy" frames, with no content, on the page to act as markers, so that you can align the target frame with the dummy frame, so that you don't need to do math in the rule.

 

Thanks Dan for the input, I'll try to be a bit more explicit with explaining the issues. Main issue was the units, I now remember this from the FusionProTextMeasure.

 

Your code looks like it should theoretically work assuming you're composing this on a server like has been previously mentioned. You did, however, misspell "suppress" so that's probably why your frames aren't suppressing.

 

Good catch, that fixed that part of the issue.

 

 

Fixing the spelling, point values, and uploading the template to MarcomCentral I've got it working. Just a little disappointed I'll be forced to upload before I can preview the layout using this format.

 

It was suggested I build the card in "layers" and just hide things, but depending on how many groups of items I need to suppress or "move" this sounds like it'll be even more work to edit/maintain.

Link to comment
Share on other sites

It was suggested I build the card in "layers" and just hide things, but depending on how many groups of items I need to suppress or "move" this sounds like it'll be even more work to edit/maintain.

 

That's definitely one way to do it. Another way would be to have separate pages in the template for each layout that you want and select the correct page based on the fields populated in the OnRecordStart rule. For example, having page 1 contain just 1 text/graphic frame, page 2 having 2 text/graphic frames, etc and setting them all to unused. Then your OnRecordStart rule would look something like:

var fields = [Field("A"),Field("B"),Field("C")].filter(String).length;
FusionPro.Composition.SetBodyPageUsage(fields, true);

 

On one hand, that would enable you to preview the layouts locally without having to upload to MarcomCentral, but as you said, it could also prove challenging to maintain/edit. For that reason, my personal preference would be to have a single layout with one text frame that either returns a table or text with leading and inline graphics (as was previously mentioned). For example:

var fields = [Field("A"),Field("B"),Field("C")].filter(String);
var rowHeight = 7200; // 1"
var graphicWidth = 7200; // 1" graphic column
var textWidth = 14400; // 2" text column
var graphic = '<graphic file="/path/to/myGraphic.pdf">';

var myTable = new FPTable;
myTable.AddColumns(graphicWidth, textWidth);
for (var i=0; i<fields.length; i++){
   myTable.AddRow();
   myTable.Rows[i].minHeight = rowHeight;
   myTable.Rows[i].SetContents(graphic, fields[i]);
}
return myTable.MakeTags();

Link to comment
Share on other sites

It was explained to me that the FusionPro Creator/Expression were to allow MarcomCentral customers to preview their work before uploading to the site, but this certainly doesn't seem to be the case. Pretty disappointed I'll have to upload these before I can truly preview them. (Cumbersome workflow...)

You should be able to compose locally on your Desktop Mac, and see the frames moved in the output. The catch is that any frames you move via JavaScript will have a random border and fill applied to them. But you can still verify that the positioning is correct. You just won't be able to make production-ready output on your Mac; that still has to be done through MarcomCentral.

 

Preview is a bit trickier, but it can be made to work too. Preview doesn't work exactly right when frames are moved, because only content in the original positions of the frames is shown (except for un-clipped graphics). But you can get around this by simply placing a variable frame covering the entire page (underneath all your other frames). Then you will see the entirety of the Preview, even if frames are moved. (Although the moved frames will still have random borders and fills.)

 

The idea here is that the ability to move frames is an upgrade feature, which requires an FP Direct/Producer or FP Server/Producer API license. (The ability to move frames has always been available to FP Server users, even before the JavaScript frame properties were added, as such users can modify the layout/format in the DIF file before composing. We added the ability to do move frames via JavaScript for convenience, but full variable layout, as opposed to just variable data, is really still a feature unique to Server.)

 

However, even though you don't have your own FP Server license, because you are a MarcomCentral user, you have do full access to this frame moving feature via MarcomCentral (which uses FP Server), when you compose online.

 

Sorry if the workflow where you see random borders and fills when composing locally seems cumbersome, but it's the best we could think of to allow users to see the frame positioning working locally, while still keeping the ability to compose production output limited to users with the higher level licenses.

It was suggested I build the card in "layers" and just hide things, but depending on how many groups of items I need to suppress or "move" this sounds like it'll be even more work to edit/maintain.

I assume you mean by calling FusionPro.Composition.SetBodyPageUsage to turn pages on and off. Yes, that will likely be more work, and will also compose more slowly, because each page still has to be composed, even if some are being hidden for particular output records.

 

As I noted in my previous post, there are other ways to accomplish what you want, such as adjusting leading or using tables or repeatable components. Although moving the frames is probably the simplest.

Link to comment
Share on other sites

Sorry if the workflow where you see random borders and fills when composing locally seems cumbersome, but it's the best we could think of to allow users to see the frame positioning working locally, while still keeping the ability to compose production output limited to users with the higher level licenses.

 

The problem with those borders is it screws up the ability to see copyfitting properly or anything at all in frames smaller than 12pt. If there were one thing I could change about FusionPro out of everything it would be the removal of those 6pt preview borders.

 

Evan, check the attached PDF. I made some adjustments to your code and moved it into onRecordStart. One major part was changing the values for y to hundredths of points. Also, I expanded the text frames larger than 12pt to accommodate the 6pt border so when you turn on preview you can actually see content.

2015_supTest.pdf

Link to comment
Share on other sites

Thanks for the clarification and help. I believe a have a much better grasp on this now.

 

@ThomasLewis: It's a tough one... lately I've been working on lots of business cards and the type sizes are almost always a fraction of 12pt.

 

Appreciate it!

Link to comment
Share on other sites

The problem with those borders is it screws up the ability to see copyfitting properly or anything at all in frames smaller than 12pt. If there were one thing I could change about FusionPro out of everything it would be the removal of those 6pt preview borders.

The way to remove those borders is to purchase a FusionPro VDP Producer (FP Direct) license for your design computer. I'm biased, of course, but I happen to think that two grand or so for Producer is still a really good deal for a product like FusionPro, especially with that added ability to vary the layout. (And the $800 price for Creator/Desktop is an absolute steal, even without that one feature.)

 

That said, it might not be a bad idea for us to change FusionPro to vary the maximum size of that random border based on the size of the frame itself. But it is meant to very intentionally render the output unsuitable for production. We have very few features like this that are restricted based on the license, but variable layout is something that we think is worth a higher level of investment.

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