#1
|
||||
|
||||
![]()
================
UPDATE: 1/29/2016 Listing as solved and leaving code for future people if they need help. ================ I am working on creating several rules based on the page number of a document. First rule is a barcode for our inserter. We need to include:
I am having difficulty calling the page numbers in the empty rules though. Second rule is making it so that the barcode only displays on odd number pages and the first page is a different setup than all the other pages. Page 1 has a special check digit that signifies start of a document. Page 2-N have a different check digit to signify that it continues to pull. How would I call up page numbers in these situations? Will they work in empty rules or do I need a callback?
__________________
Audra Landis Computer Systems Admin VDP Producer v10.0.3 Windows 7 / Windows 10 Acrobat Pro DC (2015.010.20056) Last edited by Landisa; January 29th, 2016 at 10:06 AM.. Reason: Solved |
#2
|
||||
|
||||
![]() Quote:
So the "total pages" are the "total pages of a particular record," is the "current page" the "current page of a particular record" or the "current page of the output file?" There are methods to handle both but for the sake of example, I'm going to assume you're just talking about the current page in the record. Quote:
Quote:
Quote:
Code:
var id = 'CN61341'; // Your Client ID field would go here var pg = FusionPro.Composition.currentPageNumber; var pgs = FusionPro.Composition.totalPages; var check = pg == 1 ? 1 : 0; // Format pg, pgs, & check to 2 digits and join the string. var digits = [pg,pgs,check].map(function(s){ return Str(FormatNumber('00',s));}).join(''); // If the current page is odd, return the barcode return pg%2 ? Make39Barcode(id + digits) : '';
__________________
Ste Pennell FusionPro VDP Creator 9.3.15 Adobe Acrobat X 10.1.1 Mac OS X 10.12 |
#3
|
||||
|
||||
![]()
Step your code helped me figure out my mistake!
Looks like I just needed to set my code to re-evaluate for every text flow so that it would actually call the page number rather than always using page 1 as the result. Could this theory be applied to a set of OMR marks (essentially a table with borders that change from 3-fin marks on page 1 and 2-fin marks on pages 2-N)? I am using this code to apply the marks: Code:
//Create 3-Fin OMR Mark using tables and borders new FPTable; var OMR = new FPTable; OMR.AddColumns(7200); OMR.AddRows(3); OMR.Rows[0].minHeight = 1800; //specified in hundredths of a point OMR.Rows[0].Cells[0].SetBorders("Medium", "Black", "Top"); OMR.Rows[0].Cells[0].Content = ""; OMR.Rows[1].minHeight = 1800; //specified in hundredths of a point OMR.Rows[1].Cells[0].SetBorders("Medium", "Black", "Top"); OMR.Rows[1].Cells[0].Content = ""; OMR.Rows[2].minHeight = 1800; //specified in hundredths of a point OMR.Rows[2].Cells[0].SetBorders("Medium", "Black", "Top"); OMR.Rows[2].Cells[0].Content = ""; return OMR.MakeTags();
__________________
Audra Landis Computer Systems Admin VDP Producer v10.0.3 Windows 7 / Windows 10 Acrobat Pro DC (2015.010.20056) Last edited by Landisa; January 29th, 2016 at 09:43 AM.. |
#4
|
||||
|
||||
![]()
Nevermind! I just needed to think it through a little bit. Made each table unique and set an easy if else statement.
I got these to work with the following code: Code:
// If the current page is odd, return the barcode if (pg == 1){ return pg %2 ? OMR3.MakeTags() : ''; } else { return pg %2 ? OMR2.MakeTags() : ''; }
__________________
Audra Landis Computer Systems Admin VDP Producer v10.0.3 Windows 7 / Windows 10 Acrobat Pro DC (2015.010.20056) |
#5
|
||||
|
||||
![]() Quote:
Code:
var pg = FusionPro.Composition.currentPageNumber; var rows = !--pg+2; var OMR = new FPTable(); OMR.AddColumns(7200); for (var i=0; i<rows; i++) { var row = OMR.AddRow(); row.minHeight = 1800; //specified in hundredths of a point row.Cells[0].SetBorders('Medium', 'Black', 'Top'); } return pg%2 ? OMR.MakeTags() : '';
__________________
Ste Pennell FusionPro VDP Creator 9.3.15 Adobe Acrobat X 10.1.1 Mac OS X 10.12 |
#6
|
||||
|
||||
![]()
Nice! I really need to start wrapping my brain around the slimmer code style. My code always feels so barbaric compared to yours XD
__________________
Audra Landis Computer Systems Admin VDP Producer v10.0.3 Windows 7 / Windows 10 Acrobat Pro DC (2015.010.20056) |
#7
|
||||
|
||||
![]()
By the way, just as a little explanation about the 'rows' variable since I know it looks kind of weird:
Code:
--pg Code:
!--pg Code:
!--pg+2 It by no means has to be written that way. I was just saving a few keystrokes but it could certainly be written in a more easy-to-read format: Code:
var rows = pg==1 ? 3 : 2;
__________________
Ste Pennell FusionPro VDP Creator 9.3.15 Adobe Acrobat X 10.1.1 Mac OS X 10.12 |
![]() |
Tags |
barcode, number, numbering, odd, page |
Thread Tools | Search this Thread |
Display Modes | |
|
|