Jump to content

Creating, Positioning, and Sizing of Text Frames with JavaScript


REM_Ray

Recommended Posts

Forgive me if this question has been asked or if the answer has been documented in the FusionPro literature. I'm having trouble coming up with anything useful through google searches.

 

I'm wondering if it is possible to use javascript to create, position, size, format, etc the text frames used by FusionPro.

Let me explain:

The company I currently work for uses FusionPro Creator to apply and format variable data on hundreds of mailers each month. The designs are created in CorelDraw where generic placeholder names and text are used to show the customer where the variable text will be. Once the design is approved, the variable boxes are removed for the print PDF and a Word Document is created which contains each variable box with the necessary text, formatted to match the CorelDraw text attributes. This text is then copied from Word into Acrobat/Fusion Pro.

We use this process of Corel to Word to PDF/FusionPro because the text loses it's format if copied directly from Corel to FusionPro. Using VBA (Visual Basic) I've managed to create a macro that generates the Word doc, inserts the text, and formats it. This has made the job of the designer's relatively easy but now management is wondering if something similar can be created for the prepress department. Something that is automated, saving time and reducing errors.

 

I'm wondering if there is a way to bypass the Word document all together and generate a file of instructions that FusionPro can implement without much human interaction.

Any answer is greatly appreciated. Even if the answer is a definitive "NO" it will help narrow down my options.

Link to comment
Share on other sites

Well, honestly I have no experience with CorelDraw nor VisualBasic programming. I'm also making some assumptions:

  • You're running Windows
  • You're running FusionPro Creator 9.3.21
  • You do not own a license for FusionPro Server (which would allow you to variably edit the layout by editing the DIF file prior to compositions)

 

That being said:

I'm wondering if it is possible to use javascript to create, position, size, format, etc the text frames used by FusionPro.

With FusionPro Creator 9.3.21, it is not possible to create variable frames but you can create several frames in a template (suppress the ones you don't want to use) and adjust their width and height as well as their x/y coordinates. The caveat being: the output will have a randomly colored border/fill applied to the moved frames unless you're running the composition with FusionPro Producer.

 

The company I currently work for uses FusionPro Creator to apply and format variable data on hundreds of mailers each month. The designs are created in CorelDraw where generic placeholder names and text are used to show the customer where the variable text will be. Once the design is approved, the variable boxes are removed for the print PDF and a Word Document is created which contains each variable box with the necessary text, formatted to match the CorelDraw text attributes. This text is then copied from Word into Acrobat/Fusion Pro.

Wow that is quite a workflow and the Word document step does seem excessive but it really seems like you're trying to automate a process that shouldn't/can't be automated. Setting up the template in FusionPro is just as important as setting up the art file in CorelDraw. To me, it seems like the easiest solution would be to:

  • Create the art file in CorelDraw (excluding any variable text/graphics)
  • Export a PDF of the above mentioned static art
  • Create the FP template with FPO text for the variables (pulling in the PDF as a variable graphic)

 

If you do it that way you eliminate the need for VB or Word. If there are static elements that need revising, you revise them, make a new PDF, and the template pulls in the changes. This way the frames are created and positioned correctly, the text is formatted correctly, and the client's proof is an accurate representation of what the output file will look like. Then it's just a matter of swapping out the FPO data file with your live data and recomposing the job for production.

 

Alternatively, if you're set on using VB to pull out the text and formatting, it would be helpful if you'd post that on the forum between CODE tags:

[code] 
// Your code
[/code]

 

If your script is pulling out the formatting, you might just be able to write that to a text file that you can pull in as a (tagged) text resource like this:

<f name="Helvetica"><z newsize="12.0"><color name="Black">Paragraph 1 in Helvetica with a <variable name="YOUR VARIABLE NAME">

Link to comment
Share on other sites

The designs are created in CorelDraw where generic placeholder names and text are used to show the customer where the variable text will be. Once the design is approved, the variable boxes are removed for the print PDF and a Word Document is created which contains each variable box with the necessary text, formatted to match the CorelDraw text attributes. This text is then copied from Word into Acrobat/Fusion Pro.

We use this process of Corel to Word to PDF/FusionPro because the text loses it's format if copied directly from Corel to FusionPro.

If you can go from CorelDraw to InDesign, or better yet, just do the initial design in InDesign, then you can use the FusionPro plug-in to InDesign to mark variable frames and then export to a FusionPro template, with all (or most of) the formatting carried over. We don't have the same kind of plug-in for CorelDraw or MS Word as for InDesign, though. (We used to have a similar export plug-in for QuarkXPress, but their market share dropped so much that it wasn't worth maintaining.)

 

Other than that, I'll second everything that Step said. To clarify a bit, if you have a license for FP VDP Producer or Server, or if you compose via Producer or Server, even if it's through some online web-to-print system such as MarcomCentral or EFI DSF, then you can indeed move and resize text and graphic frames with JavaScript rules. You can't conjure up new frames this way, but if you start with a generic template with, say, 10 frames, you can move the ones you want to show and hide/suppress the rest.

 

If you have a full FusionPro Server workflow, you can use the DIF API to write code to create and modify DIF (template/layout) files. With the DIF API, you can indeed conjure up new pages and frames, and even a whole new DIF file from scratch if you want.

 

However, even if you come up with some kind of system to convert your existing design templates to FusionPro VDP templates, it will be hard to automate completely. Some kind of manual human intervention is almost always required to prepare a template for variable data printing. The original designer of a static document rarely accounts for, or even provides design intent for, variable data, and for how various elements are going to flow and possibly resize in a VDP workflow. So someone is going to need to go through and try to anticipate edge cases, such as using really long names, and even then, it's hard to anticipate every possible scenario. This isn't to say that VDP is impossible, just that transforming a static design to accommodate variable data is often another design process in and of itself.

Link to comment
Share on other sites

Similar question. Customer has FP Creator, not Producer. They want to bring in up to 5 images in a template. Depending on the number of images pulled in per record, they have to be placed appropriately. For example, if a record only gets one image, it is centered. If it is 2-5 images, they get spread out uniformly across the page. They have InDesign. Would they have to use JS to get this to work?
Link to comment
Share on other sites

Similar question. Customer has FP Creator, not Producer. They want to bring in up to 5 images in a template. Depending on the number of images pulled in per record, they have to be placed appropriately. For example, if a record only gets one image, it is centered. If it is 2-5 images, they get spread out uniformly across the page. They have InDesign. Would they have to use JS to get this to work?

Well, yes, you would have to write some kind of rule for that. Although instead of moving frames around, I think you can use inline graphics in a text frame to accomplish this in a much simpler way, which will work in FP VDP Creator. A table with inline graphics might be your best bet.

 

Do you have a data file already? Are the images in there as separate fields, like "Image 1", "Image 2", etc.? Or is it some other format?

 

Also, when you say, "they get spread out uniformly across the page," do you mean horizontally or vertically?

Link to comment
Share on other sites

Thanks for the replies. I really appreciate them.

 

step,

 

  • Yes, Windows 7 and 8
  • Creator 9.1.0 and Creator 8.0.20
  • No FusionPro Server license

 

With FusionPro Creator 9.3.21, it is not possible to create variable frames but you can create several frames in a template (suppress the ones you don't want to use) and adjust their width and height as well as their x/y coordinates. The caveat being: the output will have a randomly colored border/fill applied to the moved frames unless you're running the composition with FusionPro Producer.

 

Can something similar be done in Creator 9.1.0? I'll check to see if we can upgrade to the newest Creator (I'm not one of the FP users, I'm a designer).

 

The randomly colored border/fill ends up on the final print? Why does it do that?

 

Wow that is quite a workflow

 

Yes, when I first started I was baffled as to why they had set things up like this. As for the workflow you mentioned, the issue is that there are 15 designers who send out about 300-400 proofs (not counting revisions) each month. The company only owns 3 licenses of FP and only a few more licensed Acrobat Pros, but the real problem would be the amount of extra time that would add to the proofing process. Yes, the proofs we send aren't completely accurate but they are pretty close. Also keep in mind that 90 percent of the VD is simply a variable recipient's name followed by a line break and a static message. The placeholder name used in the design is something long like "Jonathan and Angela-Marie Williamson" or "Friends and Future Neighbors." I do not think, though I am not sure, that the setup guys are dealing with a lot of overflowed text frames. (see attached files for some idea of what we are doing. The file ending in VD.pdf is what the word doc looks like. The forum doesn't support attaching word docs.)

 

As for the VBA code, I'm somewhat reluctant to post this as it's quite a bit of code and without the interface pieces (which get saved internally through VBA), much of it won't make sense.

 

Going directly to a tagged text resource file is partly what I'm hoping to accomplish. I'm realizing that just to further this conversation, I need to learn a few of the FusionPro basics. Mainly, how do these text resource files attach to the template? Would these text files also contain the x/y and width/height properties of the text frame themselves?

 

Dan,

We are married to CorelDraw. We use a lot of Excel data in our designs and CorelDraw plays nicer with Excel than InDesign does. Also, we have so much art already setup in Corel, switching now would be a lot of work. I would fully support doing away with Corel but currently it is an unmovable object.

 

As for automating this being a difficult undertaking, I fully appreciate this fact. Take a look at the attachments for a better idea of the kind of VD I am working with. It's pretty simple (I explain a little more in my response to Step, above).

 

 

As for now, I will educate myself with some of the links in Dan's signature and I'll talk to the prepress guys a little more. Knowing that this may be possible is a big step and you've both given me some things I can share with management. THANKS.

Vicki Westapher Cordera Sept 2015 VD.pdf

Vicki Westapher Cordera Sept 2015 No Data.pdf

Vicki Westapher Cordera Sept 2015 For Show.pdf

Link to comment
Share on other sites

  • Yes, Windows 7 and 8
  • Creator 9.1.0 and Creator 8.0.20
  • No FusionPro Server license

That would be excellent information to add to your forum signature.

Can something similar be done in Creator 9.1.0?

Yes. The ability to move frames was added in FusionPro 8.0.

The randomly colored border/fill ends up on the final print? Why does it do that?

Because you are composing without an FP Server or FP Direct (Producer) license. If you look at the composition log (.msg) file, it will have messages like this in it: Frame property "x" cannot be set without a FusionPro Server or Direct license.

 

The random border and fill is so you can see the frame moving and resizing working when you're designing the template in FP Creator, but it's still a Server-only feature. If you compose the job through Producer, or through Server (either your own FP Server or through an app using Server such as MarcomCentral), then the frames will be moved or resized without the random border and fill.

Yes, when I first started I was baffled as to why they had set things up like this. As for the workflow you mentioned, the issue is that there are 15 designers who send out about 300-400 proofs (not counting revisions) each month. The company only owns 3 licenses of FP and only a few more licensed Acrobat Pros, but the real problem would be the amount of extra time that would add to the proofing process.

It sounds like you need to get your designers working in FusionPro, designing VDP templates instead of static layouts.

(see attached files for some idea of what we are doing. The file ending in VD.pdf is what the word doc looks like. The forum doesn't support attaching word docs.)

That's what Zip files are for.

As for the VBA code, I'm somewhat reluctant to post this as it's quite a bit of code and without the interface pieces (which get saved internally through VBA), much of it won't make sense.

FP Server comes with a DIF Control OCX, which you can use directly in a VBA script to create a FusionPro VDP template/layout (DIF) file, which could then be composed via an automated call to FusionPro Server. This could be a truly "hands off" process if you can get it working right.

Going directly to a tagged text resource file is partly what I'm hoping to accomplish. I'm realizing that just to further this conversation, I need to learn a few of the FusionPro basics. Mainly, how do these text resource files attach to the template?

Every resource is listed in the Data Definition (DEF) file. In an FP Creator workflow, you would go into the Resources dialog and add each one.

Would these text files also contain the x/y and width/height properties of the text frame themselves?

No. A text resource file is just text. Usually, for a job like this, the frame position and sizing properties are in data fields in the main data file for the composition.

Dan,

We are married to CorelDraw. We use a lot of Excel data in our designs and CorelDraw plays nicer with Excel than InDesign does. Also, we have so much art already setup in Corel, switching now would be a lot of work. I would fully support doing away with Corel but currently it is an unmovable object.

Perhaps you could get some custom engineering help. You would need to contact Sales about that.

As for automating this being a difficult undertaking, I fully appreciate this fact. Take a look at the attachments for a better idea of the kind of VD I am working with. It's pretty simple (I explain a little more in my response to Step, above).

Yes, that seems fairly straightforward. But you're running into the classic programmer's dilemma of how much time you should invest in building an automated process versus how much time it will save in the long run by eliminating manual processes.

Link to comment
Share on other sites

Can something similar be done in Creator 9.1.0? I'll check to see if we can upgrade to the newest Creator (I'm not one of the FP users, I'm a designer).

Yes, it can. I believe that feature extends back to FP8 and while you may want to upgrade your versions of FP to the latest version for other reasons (you can check the release notes and decide for yourself) that particular feature is already available to your FP users.

The randomly colored border/fill ends up on the final print? Why does it do that?

Yes. I assume to promote the purchase of FP Server or FP Producer.

 

As for the workflow you mentioned, the issue is that there are 15 designers who send out about 300-400 proofs (not counting revisions) each month. The company only owns 3 licenses of FP and only a few more licensed Acrobat Pros, but the real problem would be the amount of extra time that would add to the proofing process. Yes, the proofs we send aren't completely accurate but they are pretty close. Also keep in mind that 90 percent of the VD is simply a variable recipient's name followed by a line break and a static message. The placeholder name used in the design is something long like "Jonathan and Angela-Marie Williamson" or "Friends and Future Neighbors." I do not think, though I am not sure, that the setup guys are dealing with a lot of overflowed text frames. (see attached files for some idea of what we are doing. The file ending in VD.pdf is what the word doc looks like. The forum doesn't support attaching word docs.)

Okay, so are you suggesting that 15 designers are creating 300-400 proofs for variable data jobs each? Meaning that (on the lowest end of the scale) they are creating 4,500 jobs that need to be processed by 3 versions of FusionPro Creator? Not only is that 1,500 jobs/FP user a month (~75 jobs a day), but with FusionPro Creator, each composition is run locally on the machine FP is installed on. I would hope that my math is incorrect because that seems like a tremendous bottle neck in the process or at the very least a reason to purchase 15 licenses for the designers or FusionPro Producer so that the composition load could be offset to a server. (The latter option allowing you to variably move frames without a border and fill).

As for the VBA code, I'm somewhat reluctant to post this as it's quite a bit of code and without the interface pieces (which get saved internally through VBA), much of it won't make sense.

I understand your reluctance but unfortunately without seeing how you're creating the Word files from the script, I can't really offer you any suggestions.

 

Going directly to a tagged text resource file is partly what I'm hoping to accomplish. I'm realizing that just to further this conversation, I need to learn a few of the FusionPro basics. Mainly, how do these text resource files attach to the template? Would these text files also contain the x/y and width/height properties of the text frame themselves?

You can create text resources within the GUI of FusionPro itself (I won't go into the specifics here because it's pretty well documented in the FusionPro documentation) or you can use the "CreateResource" function that allows you to specify a specific text file you'd like to import. As far as the x/y and width/height goes, I wouldn't include it in the text resource files. Keeping in mind that variably adjusting the text frame attributes (x,y,width,height,columns,etc) is not something you're going to be able to utilize with your current setup, this is essentially what I would do (examples below):

  • Write your tagged text strings to individual .txt files
  • For each tagged text file (.txt) create a record in an external data file that pulls in the content for each frame (as well as attributes if you're running on Server or Producer)

 

Sample Tagged .txt file (Tagged1.txt):

<span color="White" font="GoudyOldStyle" pointsize="11">Prepared Especially For</span>
<p><span color="White" font="GoudyOldStyle" pointsize="19"><variable name="Full"></span>

 

Sample External Data File (data.csv):

Frame,width,height,x,y,content
"Frame1","28800","43200","1800","900","/path/to/Tagged1.txt"
"Frame2","43200","43200","900","21600","/path/to/Tagged2.txt"

 

And then you'd call the external data file in an OnRecordStart rule to populate each text frame with the correct content and variables:

data = new ExternalDataFileEx('/path/to/data.csv',',');
for (var i=1; i<=data.recordCount; i++) {
   var frame = FindTextFrame(data.GetFieldValue(i, 'Frame'));
   var att = ['width','height','x','y'];
   for (var n in att)
       if (a = data.GetFieldValue(i, att[n])) 
           frame[att[n]] = a;
   frame.content = RawTextFromTagged(CreateResource(data.GetFieldValue(i, 'content')).content);
}

I've attached an example template from the samples you supplied so that you can get an idea of how everything I've mentioned above would work.

FP_example.zip

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