Go Back   MarcomCentral (PTI) and FusionPro User Communities > Software-Related Talk > FusionPro® VDP Producer (formerly FusionPro® Direct)

Notices

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old March 7th, 2017, 08:50 AM
mjlongo mjlongo is offline
Junior Community Member
 
Join Date: Jul 2013
Location: Rochester NY
Posts: 37
Default Setting pages to unused

Hello, our customer will be providing a document to use that may contain 100's or 1000's of pages. The job will require that only select pages as well as a separate variable page will be used for each record. Is there a way to quickly set all of the pages to unused? I certainly will not want to go mark every page as unused manually. Thanks!
Reply With Quote
  #2  
Old March 7th, 2017, 09:31 AM
step's Avatar
step step is offline
Senior Contributor
 
Join Date: Jan 2010
Location: Charlotte, NC
Posts: 955
Default Re: Setting pages to unused

One way to do that is to add this to your OnRecordStart callback rule:
Code:
// List of pages that should be enabled in your template
var enabledPages = [
  4,
  10,
  11,
];
var totalPages = 1000; // Total number of pages in your template
for (var page = 1; page <= totalPages; page++) {
  FusionPro.Composition.SetBodyPageUsage(page, enabledPages.indexOf(page) > -1);
}
You can also get away with not defining the total number of pages in your document by using this code instead:
Code:
// List of pages that should be enabled in your template
var enabledPages = [
  4,
  10,
  11,
];

var page = 0;
while (++page && !FusionPro.inValidation) {
  try {
    FusionPro.Composition.SetBodyPageUsage(page, enabledPages.indexOf(page) > -1);
  } catch(e) { break; }
}
__________________
Ste Pennell
FusionPro VDP Creator 9.3.15
Adobe Acrobat X 10.1.1
Mac OS X 10.12

LinkedIn

Last edited by step; March 7th, 2017 at 09:31 AM.. Reason: Forgot to define a variable
Reply With Quote
  #3  
Old March 7th, 2017, 10:05 AM
mjlongo mjlongo is offline
Junior Community Member
 
Join Date: Jul 2013
Location: Rochester NY
Posts: 37
Default Re: Setting pages to unused

Step, thank you for that response. That sets me off in the right direction. I did run into one problem however.

The enabledPages variable that is being set at the beginning does not seem to want to take in the field. for example, I was looking to do something like this:

enabledPages = [field("record number"), 101]

So that page "record number" (maybe equals 1) would be the valid page for that record as well as page 101. The next record in the document might end up calling out page 5 and so on.

I hope that makes sense.
Reply With Quote
  #4  
Old March 7th, 2017, 10:49 AM
step's Avatar
step step is offline
Senior Contributor
 
Join Date: Jan 2010
Location: Charlotte, NC
Posts: 955
Default Re: Setting pages to unused

Quote:
Originally Posted by mjlongo View Post
The enabledPages variable that is being set at the beginning does not seem to want to take in the field.
Not sure what you mean by that. Are you getting an error that gives you that impression? Could you share it?
Quote:
Originally Posted by mjlongo View Post
for example, I was looking to do something like this:

Code:
enabledPages = [field("record number"), 101]
Are you entering it exactly like that? If so, you need to capitalize the "field" function so that it pulls in your field value correctly. The only other thing I could think that you might want to try is ensuring that all of your variables are of the same type. In my example, all of the numbers in the array were integers being compared to integers. This might help:
Code:
// List of pages that should be enabled in your template
var enabledPages = [Field("record number"), 101].map(Int);

var page = 0;
while (++page && !FusionPro.inValidation) {
  try {
    FusionPro.Composition.SetBodyPageUsage(page, enabledPages.indexOf(page) > -1);
  } catch(e) { break; }
}
__________________
Ste Pennell
FusionPro VDP Creator 9.3.15
Adobe Acrobat X 10.1.1
Mac OS X 10.12

LinkedIn
Reply With Quote
  #5  
Old March 7th, 2017, 11:46 AM
mjlongo mjlongo is offline
Junior Community Member
 
Join Date: Jul 2013
Location: Rochester NY
Posts: 37
Default Re: Setting pages to unused

Step, the .map(Int) part is all that I needed. The job works now. Thanks!!
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 02:15 PM.


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