Jump to content

Pulling in PDF pages


mclisa81

Recommended Posts

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

ptitemplate.zip

Link to comment
Share on other sites

In JavaScript Globals add

 

var gCount = 1;

 

Change your rule to:

 

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

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.

Edited by ScottHillock
Link to comment
Share on other sites

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

 

http://forums.pti.com/attachment.php?attachmentid=1905&d=1540497427

 

 

 

 

This is what I need ...

 

http://forums.pti.com/attachment.php?attachmentid=1904&d=1540496780

 

 

 

Thanks again,

Lisa

whatIneed.thumb.JPG.db6bd25f189381618f4ee798c5038c11.JPG

newrule.thumb.JPG.d0e54338e616e78d5d5c6542fff7fabd.JPG

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