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

Notices

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old October 25th, 2018, 06:08 AM
mclisa81 mclisa81 is offline
Regular Contributor
 
Join Date: Oct 2008
Location: Manchester CT
Posts: 97
Default Pulling in PDF pages

Good morning,

I have a rule that I need a little help on.

The client is sending us one very large pdf file and I need to split it into single record pdfs by the page count in their data.

Record 1 would be pdf pgs 1-6
Record 2 would be pdf pgs 7-10
Record 3 would be pdf pgs 11-12
Record 4 would be pdf pgs 13-16
Record 5 wuold be pdf pgs 17-22
etc.

Only using the "Count" column in the data, I have Record 1 working using the "graphicRuleNeedsHelp" rule. I just can't figure out how to add the previous record page Counts to the current record page Counts to get the start and ending numbers on the subsequent records.

NOTE: I have a rule, "graphicRuleWorks" which works correctly because I added 2 columns to the data with formulas to get the "start" and "end" pdf pages. I can use this rule, however, I would rather just use their "Count" column they supply.

I'm uploading the collected file for a visual.

Thanks in advance,
Lisa
Attached Files
File Type: zip ptitemplate.zip (3.12 MB, 10 views)
__________________
Lisa McKillop
Digital Prepress Operator
RR Donnelley Manchester
Windows 10, Acrobat 11.0.3
FusionPro Desktop 10.0.26
Reply With Quote
  #2  
Old October 25th, 2018, 11:52 AM
ScottHillock ScottHillock is offline
Regular Contributor
 
Join Date: Mar 2010
Posts: 91
Default Re: Pulling in PDF pages

In JavaScript Globals add

Code:
var gCount = 1;
Change your rule to:

Code:
var result = [];
var r = CreateResource("test.pdf", "graphic");
var count = StringToNumber((Field("Count")));
var record = CurrentRecordNumber();

for (var p = gCount; p < count + gCount; p++)
{
    r.pagenumber = p;
    result.push(r.content);
}


return result.join("<br>\n");
OnRecordEnd Rule
Code:
gCount = gCount + StringToNumber(Field("Count"));
If you need to start at a different page number in the source PDF than 1, just change the value in the javascript globals.

Also, in the files you uploaded you'll need to assign the second page the type of "Overflow" in Page Usage.

Last edited by ScottHillock; October 25th, 2018 at 01:13 PM..
Reply With Quote
  #3  
Old October 25th, 2018, 12:58 PM
mclisa81 mclisa81 is offline
Regular Contributor
 
Join Date: Oct 2008
Location: Manchester CT
Posts: 97
Default Re: Pulling in PDF pages

Hi Scott,

Thanks for getting back to me.

I'm not sure if it's something I'm doing (or not doing), but the output isn't working correctly. I may have not explained it clearly the first time. I'll attach screen captures ... sorry, they're BIG screen captures.


This is how my output looks now with the new rule ...







This is what I need ...






Thanks again,
Lisa
Attached Images
File Type: jpg whatIneed.JPG (152.1 KB, 41 views)
File Type: jpg newrule.JPG (178.7 KB, 42 views)
__________________
Lisa McKillop
Digital Prepress Operator
RR Donnelley Manchester
Windows 10, Acrobat 11.0.3
FusionPro Desktop 10.0.26
Reply With Quote
  #4  
Old October 25th, 2018, 01:12 PM
ScottHillock ScottHillock is offline
Regular Contributor
 
Join Date: Mar 2010
Posts: 91
Default Re: Pulling in PDF pages

Sorry about that, I forgot one more rule.

Add this to an OnRecordEnd rule:

Code:
gCount = gCount + StringToNumber(Field("Count"));
Reply With Quote
  #5  
Old October 26th, 2018, 03:14 AM
mclisa81 mclisa81 is offline
Regular Contributor
 
Join Date: Oct 2008
Location: Manchester CT
Posts: 97
Default Re: Pulling in PDF pages

Perfect!

Thank you so much Scott!

Lisa
__________________
Lisa McKillop
Digital Prepress Operator
RR Donnelley Manchester
Windows 10, Acrobat 11.0.3
FusionPro Desktop 10.0.26
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 05:59 PM.


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