Jump to content

Switching Layouts


wrenchmaster

Recommended Posts

I have a 2 sided vdl project that will require 12 different front and back layouts that need to be called from the database.

I have instructions on how to manage a single sided template, but this project has two sides. How do I trigger a specific front and back template layout?

 

Thanks

Link to comment
Share on other sites

Either create 24 pages all set to "not used", then data is coded to set page to "use" accordingly (assuming pages 1-12 is fronts and 13-24 is backs).

using following code in OnRecordStart:

FusionPro.Composition.SetBodyPageUsage("yourPageName", true);

 

If VDP is the same like a postcard and just swapping artwork, create 2 page template, then image call the fronts and backs accordingly based on data.

creating 2 rules and calling images dynamically:

Pic = CreateResource("//youPath/"+yourDataCalledArtwork+".pdf", "graphic", true);
Pic.pagenumber = yourDataCalledArtworkPageNumber;
return Pic;

 

Creating the 24 pages allows more WYSIWYG feel of things, whereas 2 pages is a little more cryptic.

 

I'm sure there are tons of resources on here that have touched on this and may prove to be better. Stitching it up together is the key.

Link to comment
Share on other sites

Add all the pages as a single PDF document. Then in FusionPro, select FusionPro>>Manage Pages>>>Page Usage. Name each page and set it to unused. Then create an Onrecordstart rule, Create Rules>>>New>>Callback>>OnRecordStart.

The rule below can be simplified greatly by only activating the page you need, since all the pages are marked unused initially. So it can be reduced to this:

if (Field("Addresses") == "1")

FusionPro.Composition.SetBodyPageUsage("One", true);

FusionPro.Composition.SetBodyPageUsage("back 1", true);

if (Field("Addresses") == "2")

FusionPro.Composition.SetBodyPageUsage("Two", true);

FusionPro.Composition.SetBodyPageUsage("back 2", true);

if (Field("Addresses") == "3")

FusionPro.Composition.SetBodyPageUsage("Three", true);

FusionPro.Composition.SetBodyPageUsage("back 3", true);

if (Field("Addresses") == "4")

FusionPro.Composition.SetBodyPageUsage("Four", true);

FusionPro.Composition.SetBodyPageUsage("back 4", true);

etc......

Link to comment
Share on other sites

Add all the pages as a single PDF document. Then in FusionPro, select FusionPro>>Manage Pages>>>Page Usage. Name each page and set it to unused. Then create an Onrecordstart rule, Create Rules>>>New>>Callback>>OnRecordStart.

The rule below can be simplified greatly by only activating the page you need, since all the pages are marked unused initially. So it can be reduced to this:

if (Field("Addresses") == "1")

FusionPro.Composition.SetBodyPageUsage("One", true);

FusionPro.Composition.SetBodyPageUsage("back 1", true);

if (Field("Addresses") == "2")

FusionPro.Composition.SetBodyPageUsage("Two", true);

FusionPro.Composition.SetBodyPageUsage("back 2", true);

if (Field("Addresses") == "3")

FusionPro.Composition.SetBodyPageUsage("Three", true);

FusionPro.Composition.SetBodyPageUsage("back 3", true);

if (Field("Addresses") == "4")

FusionPro.Composition.SetBodyPageUsage("Four", true);

FusionPro.Composition.SetBodyPageUsage("back 4", true);

etc......

Actually, if you name your pages "front 1", "front 2", "back 1", "back 2", etc., and set them all be be unused initially, then the rule can be reduced to this:

 

FusionPro.Composition.SetBodyPageUsage("front " + Field("Addresses"), true);
FusionPro.Composition.SetBodyPageUsage("back " + Field("Addresses"), true);

Link to comment
Share on other sites

If anyone has a chance to look over my pdf example I can answer ant questions if you don't understand.

 

I have to use the front page (P1) of the template for each record. The various backs need to be called specifically as needed.

 

What have you got so far. Can you post on here?

 

1 front and 12 backs?

 

1 front and 1 back?

 

etc........

 

Based off of your PDF you got 1 common front and variably different backs. Lots/minimal variables on front and/or back?

 

What does your OnRecordStart rule look like now? If you are doing graphic rules, what do they look like?

 

Maybe a sample of the data (sample a sample sensitive parts - name and address) leaving the pages fields in tact can steer us in a direction?

Link to comment
Share on other sites

I have to use the front page (P1) of the template for each record. The various backs need to be called specifically as needed.

 

If that is the case, the front page (P1) should not be set to unused. Only the back pages should be set to unused. Then you can use Dan's code minus the first line. Thus:

FusionPro.Composition.SetBodyPageUsage("back " + Field("Addresses"), true);

Link to comment
Share on other sites

I uploaded the document.

The first two pages of the pdf are front and back.

The remaining pages are the layouts that have to combine with the back,

which has vd on it also.

So, page 2 has to merge with the appropriate layout.

 

I'm not a FP master, but I'd pasted the common BACK to the Layouts and created an OnRecordStart rule:

FusionPro.Composition.SetBodyPageUsage(Field("BackLayout"), true);

 

I also noticed that Layout4 was missing the "t" before the 4 so had to edit the data. Set all Back Pages to "unused" and data driven value will set pages to use when called.

TestUpdated.zip

Link to comment
Share on other sites

OK that appears to work, the only thing I'm missing is the common variable text boxes that were on the common back.

 

Thanks, I can make sense of this, I'll just have to duplicate the common variables to every layout. I just thought there was a way to merge different layouts with the back.

 

Thanks, this will get it done.

Link to comment
Share on other sites

OK that appears to work, the only thing I'm missing is the common variable text boxes that were on the common back.

 

Thanks, I can make sense of this, I'll just have to duplicate the common variables to every layout. I just thought there was a way to merge different layouts with the back.

 

Thanks, this will get it done.

 

Whoops sorry about that. I remember reading something about reusable resources, but I'm not sure how to do that.

 

Good luck and I'm sure there will be better suggestions soon. :p

Link to comment
Share on other sites

OK that appears to work, the only thing I'm missing is the common variable text boxes that were on the common back.

 

Thanks, I can make sense of this, I'll just have to duplicate the common variables to every layout. I just thought there was a way to merge different layouts with the back.

There is, but it requires a different approach. You're changing requirements midstream. The requirement of "merge some statically positioned content on the back page with some dynamically positioned content" is different than the originally stated requirement of "require 12 different front and back layouts."

Whoops sorry about that. I remember reading something about reusable resources, but I'm not sure how to do that.

It's not that complicated. You just create Template (repeatable component) pages instead of Body pages, then use a simple rule to call out the desired template into a text frame on the body page you want it to appear on. I actually modified your job to demonstrate this; it's attached (Test-template-pages.pdf). All I did was do an Insert Page for each Template page, duplicating the corresponding Body page, then deleted those "Layout" body pages, then added a text frame to your second Body page calling out a rule to pull in a Template page.

 

Although, seeing what you're trying to do with these variable layouts, it seems to me that this can be done in even simpler way, with a FusionPro template PDF with only two pages, and a table for the offers, using a bit of math to calculate the number of table cells needed for the number of offers. This took a little longer to build from scratch, but I'll bet it was less time overall than it took you to manually lay out all those offer pages for different numbers of offers. That's attached as well (Test-offer-table.pdf).

Test-template-pages.pdf

Test-offer-table.pdf

Edited by Dan Korn
Link to comment
Share on other sites

Dan,

 

Yes I did change course, I'm a bit overwelmed by this project and at the same time trying to get a grip on the application. To make it worse, I do not have any coding experience. But I will tell you, with the help of your detailed feedback things will start to make some sense.

I am looking over very closely your offer table script, very impressive.

I was quickly excited but I have 3 fields of info that have to go into each box. Where will I be able to adjust font, attributes and spacing etc..?

Also how can I change the lines to dotted lines? cell.SetBorders?

 

I'm going to spend the weekend trying to dig into this script, maybe with google I can get a better handle on it.

 

TO ALL Sincerely Thanks for your help

Link to comment
Share on other sites

Where will I be able to adjust font, and spacing etc..?

You can set all of those attributes with properties of the FPTableCell object, as described in the FusionPro User Guide and in this post:

http://forums.pti.com/showthread.php?t=2087

 

Or, you can set the font, color, etc. of the entire table in the Text Editor, where you call out the rule that returns the table. Or you can use markup tags such as <f name="***"> or color name="***" to modify individual words or letters in the cell contents, like with any other text.

Also how can I change the lines to dotted lines? cell.SetBorders?

Currently, FusionPro does not support dotted or dashed table cell borders.

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