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

Notices

Reply
 
Thread Tools Search this Thread Display Modes
  #11  
Old March 3rd, 2017, 10:38 AM
ricky10ss ricky10ss is offline
Junior Community Member
 
Join Date: Mar 2009
Posts: 35
Default Re: Multiple PDF's with variable text boxes on different pages

Sorry Step I am definitely confused. Sorry.
So I should I still use this code for the onRecordStart ?

Code:
var [ver, state] = Field("version").split(' ');
var pdf = CreateResource('/path/to' + Field("version") + '.pdf', 'graphic', true);
var pages = pdf.countPages;
var form = 20;

switch(state) {
  case 'CO': form = 21; break;
  case 'LA': form = 24; break;
  case 'NC': form = 26; break;
  case 'NV': form = 23; break;
  case 'SD': form = 22; break;
}

FusionPro.Composition.repeatRecordCount = pages;
var isForm = FusionPro.Composition.repeatRecordNumber == form;
FusionPro.Composition.SetBodyPageUsage('page', !isForm);
FusionPro.Composition.SetBodyPageUsage('form', isForm);
Or this one as the OnRecordStart?

Code:
var state = Field("State");
var pdf = '/path/to/LN-3001';
var form = 20;
switch(state) {
  case 'CO': form = 21; break;
  case 'LA': form = 24; break;
  case 'NC': form = 26; break;
  case 'NV': form = 23; break;
  case 'SD': form = 22; break;
}
if (form > 20)
  pdf += ' ' + state;
pdf = CreateResource(pdf + '.pdf', 'graphic', true);
Do all the "form" and "page" pages get the same graphic variable assigned to them? I used this below. Right now only the first page comes in when I compose.

Code:
if (Field("State") == "CO") {
  var pdf = "LN-3001 CO.pdf";
}
else if (Field("State") == "LA") {
  var pdf = "LN-3001 LA.pdf";
}
else if (Field("State") == "NC") {
  var pdf = "LN-3001 NC.pdf";
}
else if (Field("State") == "NV") {
  var pdf = "LN-3001 NV.pdf";
}
else if (Field("State") == "SD") {
  var pdf = "LN-3001 SD.pdf";
}
// ...
else {
  var pdf = "LN-3001.pdf";
}
var pdf = CreateResource('G:\\BTS\\Variable Elements\\LifeShield STM UltraCare\\' + pdf );
pdf.pagenumber = FusionPro.Composition.repeatRecordNumber;
return pdf;
Reply With Quote
  #12  
Old March 3rd, 2017, 12:15 PM
step's Avatar
step step is offline
Senior Contributor
 
Join Date: Jan 2010
Location: Charlotte, NC
Posts: 957
Default Re: Multiple PDF's with variable text boxes on different pages

Quote:
Originally Posted by ricky10ss View Post
Do all the "form" and "page" pages get the same graphic variable assigned to them? I used this below. Right now only the first page comes in when I compose.
Yes, you should have the same graphic variable assigned to the graphic frame on every page. You should only have 1 "page" body page. In addition to that, you should have the following body pages (all set to "unused"):
  • form
  • form-CO
  • form-LA
  • form-NC
  • form-NV
  • form-SD
Each of those "form*" body pages should have the variable frames required by that version's form in the positions required by that version's form.

Your OnRecordStart should have this (and only this) in it:
Code:
var state = Field("State");
var file = 'LN-3001';
var form = 20;
switch(state) {
  case 'CO': form = 21; break;
  case 'LA': form = 24; break;
  case 'NC': form = 26; break;
  case 'NV': form = 23; break;
  case 'SD': form = 22; break;
}
if (form > 20) file += ' ' + state;
pdf = CreateResource('G:\\BTS\\Variable Elements\\LifeShield STM UltraCare\\' + file + '.pdf', 'graphic', true);
var pages = pdf.countPages;
FusionPro.Composition.repeatRecordCount = pages;
var isForm = FusionPro.Composition.repeatRecordNumber == form;
FusionPro.Composition.SetBodyPageUsage('page', !isForm);
FusionPro.Composition.SetBodyPageUsage(['form', file.split(' ')[1]].filter(Boolean).join('-'), isForm);
You can name the graphic rule whatever you want to but in an effort to minimize the room for error, name it "background" and paste this into it:
Code:
pdf.pagenumber = FusionPro.Composition.repeatRecordNumber;
return pdf;
Apply the "background" rule to every graphic frame in the template – there should be seven in total.
__________________
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 11:26 PM.


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