crankin Posted February 11, 2009 Share Posted February 11, 2009 I have a project where I need to flow in multiple pdf files that have any where from 2 to 26 pages in them based on multiple fields in the data. I have the overflow working correctly and when I use the code below I can import the first page of the documents just fine. This is one many rules. if (Field("CPP1") != "") { { Pic = '<graphic file="' + Field("CPP1") + ".pdf" + '">'; TempPic = CreateResource (Field("CPP1") + ".pdf", "graphic", true); } if (TempPic.exists) { return Pic; } } When i use this code the 2 pagers will show up but in reverse order, page 2 then page 1. if (Field("BED2") != "") { var PDFResourceFile = (Field("BED2") + ".pdf"); var FirstPageNumber = Int("1"); var FirstPageCount = Int("1"); var SecondPageNumber = Int("2"); var SecondPageCount = Int("1"); var result = ""; var pdf = new FusionProResource(PDFResourceFile, "graphic"); pdf.pageNumber = FirstPageNumber; for (var i = 1; i <= FirstPageCount; i++) result += pdf.content + "\n"; pdf.pageNumber = SecondPageNumber; for (var i = 1; i <= SecondPageCount; i++) result += pdf.content + "\n"; return result; } Any help would be great. Use FP 6 on a PC Link to comment Share on other sites More sharing options...
DSweet Posted February 11, 2009 Share Posted February 11, 2009 Crankin, Try this adjustment... if (Field("BED2") != "") { var PDFResourceFile = (Field("BED2") + ".pdf"); var result = ""; var pdf = new FusionProResource(PDFResourceFile, "graphic"); var pdfPages = pdf.countPages for (var i = 1; i <= pdfPages; i++) { pdf.pagenumber = i; result += pdf.content + "\n"; } return result; }With this text rule no matter how many pages your document has, it will place all of them in line AND in the proper order. Good Luck. Link to comment Share on other sites More sharing options...
crankin Posted February 11, 2009 Author Share Posted February 11, 2009 David, First thanks for the quick help. I did try this code and it imported all the pages but in reverse order again. Also I have multiple "IF" rules like this one that I am trying to flow into one overflow story. This code will import the first "IF" Rule but stops importing after the first one. Could I be doing something wrong in calling the rules in the text editor? Here's a sample. «Tab1_BED1» «Tab1_CPP1» «Tab1_CPP2» «Tab1_CPP3» «Tab1_DAP1» «Tab1_DAP2» Thanks again Chris Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.