Jump to content

Padding blank space


Sevi

Recommended Posts

Hi, sorry for my bad English, it's my fisrt post.

 

Into a VDP job I find text frames in some records with a blank space at the end of this frame. I wolud padding this blank space with an any resource like a graphic. How I can calculate the space used to prevent this blank space and add a image at the end.

 

I can find a great blank space, a medium space, a little sapce or no one.

 

A am using overflow settings to expand o reduce the text in the frame, but in some records a need padding with a variable resource.

 

Best regards

 

Sevi

Link to comment
Share on other sites

This is called adding a "slug graphic," and yes, it is possible. Here's what you need to do:

 

  • Select the frame you want to add the graphic to.
  • In the Frame Properties palette, where it says, "Untitled," type a name for the frame and then Enter.
  • Still in the Frame Properties palette, click "Overflow," and then select "Adjust text to fit" and click OK.
  • Open the Rules dialog (from the menu, FusionPro -> Edit Rules, or click on the little "right turn arrow" button on the FusionPro toolbar or Steps palette). Select the "OnCopyfit" rule and click "Edit."
  • Paste the following at the beginning of the rule expressions, before any other text:

// Change these first two lines
var SlugFlowName = "Story";
var SlugGraphic = "assets/italy.jpg";

var cf = FusionPro.Composition.CurrentFlow;
if (cf.name == SlugFlowName)
{
   cf.expandToFill = false;
   Copyfit(new MagnifyAttributes("text", 100, 100, 1, 1000)); // "dummy" Copyfit to get lead available
   Print("Lead available for slug graphic: " + cf.leadAvailable);
   if (cf.leadAvailable > 1000)
   {
       cf.content += '<para quad=C leadbefore=0 leadafter=0><leading newsize=0>';
       cf.content += '<graphic file="' + SlugGraphic + '" height="' + (cf.leadAvailable * 0.8) + '">';
       cf.content += '</para>';
   }
   return;
}

  • Change the name of the flow on the second line to match the name you gave to your frame.
  • Change the name of the graphic to your graphic. You may need to specify the full path if it's not in the same folder as your PDF template.
  • Click OK until you've exited all the dialogs.

Link to comment
Share on other sites

Sorry, there was a typo in my rule. Line 5 should be:

if (cf.name == SlugFlowName)

Also, you'll need to turn on Legacy Leading in your job. To do this, open up the Variable Text Editor for any text frame, then click "Paragraph" and "Global Settings" and check the "Use legacy line leading" box.

 

With these changes, the graphic will show up. However, if you're really going to have that much empty space in the frame, there might be a better approach to this.

 

Also, I made some changes to your rules which are returning tagged text to call the TaggedTextFromRaw function on the data field values.

 

See the attached PDF template with my changes.

A4 blanco-dan.pdf

Link to comment
Share on other sites

Hi Dan

 

Now to get the excellence :D, I would:

 

1.- The content of the frame are variable, therefore if the space blank is little (one or two text lines only) the image may not shows.

2.- To use another resource like a text file or show a hidden frame ready to use for it.

 

Best regards

 

Sevi

Link to comment
Share on other sites

1.- The content of the frame are variable, therefore if the space blank is little (one or two text lines only) the image may not shows.

You can try changing the number on this line to something smaller:

if (cf.leadAvailable > 1000)

But it's already set to 10 points, which is like .13 inches, so I'm not sure that a smaller graphic is going to do you much good.

2.- To use another resource like a text file or show a hidden frame ready to use for it.

This is getting more complicated. It might help to post an example of what kind of output you're trying to achieve.

 

I think it's generally possible to do something like this, but this kind of advanced template-building is a bit beyond the scope of what I can do in the context of this User Forum. Of course, anyone else is free to chime in. :) But you may need to inquire about custom consulting work.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...