Mikeness Posted December 18, 2014 Posted December 18, 2014 I've read through all the available posts but just can't seem to get this functionality to work. I have a two page PDF template, loaded with 7 PDF resources, 2 of which are two-page documents while the balance are 1 page. I've setup a variable graphic frame on both pages and assigned a switch rule based on the "Version" field in our .mdb file. The following rule works fine to call the first page of the PDF, however I can't seem to apply the pagenumber function to this structure. I've highlighted the two 2-page resources with red text. What is the most straightforward method to be able to call on the second page of the resource in the second variable graphic frame? Rule for page 1 that works well: switch (Field("Version").toLowerCase()) { case "NA".toLowerCase(): return Resource("NA"); case "NB".toLowerCase(): return Resource("NB"); case "TEB".toLowerCase(): return Resource("TEB"); case "TEC".toLowerCase(): return Resource("TEC"); case "TFA".toLowerCase(): return Resource("TFA"); case "TFB".toLowerCase(): return Resource("TFB"); case "TFC".toLowerCase(): return Resource("TFC"); default: return ""; } Quote
jwhittaker Posted December 18, 2014 Posted December 18, 2014 try this switch (Field("Version").toLowerCase()) { case "NA".toLowerCase(): return Resource("NA"); case "NB".toLowerCase(): return Resource("NB"); case "TEB".toLowerCase(): { var image = Resource("TEB"); image.pagenumber = 2 return image; } //return Resource("TEB"); case "TEC".toLowerCase(): { var image = Resource("TEC"); image.pagenumber = 2 return image; } //return Resource("TEC"); case "TFA".toLowerCase(): return Resource("TFA"); case "TFB".toLowerCase(): return Resource("TFB"); case "TFC".toLowerCase(): return Resource("TFC"); default: return ""; } Quote
KevinG Posted August 6, 2024 Posted August 6, 2024 I have something similar that I'm working on. I have three 2 page pdf files, 100, 150 and 250 versions. A field in the data called "image" has the same values. These are postcards with only the images being called out and a variable address block. I have 2 javascript rules using the switch and case rules but my images are not appearing when proofing. The validation says the scripts are correct. I'm stuck at this point and hope someone may have some insight. Quote
Dan Korn Posted August 6, 2024 Posted August 6, 2024 5 minutes ago, KevinG said: I have something similar that I'm working on. I have three 2 page pdf files, 100, 150 and 250 versions. A field in the data called "image" has the same values. These are postcards with only the images being called out and a variable address block. I have 2 javascript rules using the switch and case rules but my images are not appearing when proofing. The validation says the scripts are correct. I'm stuck at this point and hope someone may have some insight. It's almost impossible to say without more information. Can you collect up a minimal sample job which demonstrates the problem? Quote
KevinG Posted August 7, 2024 Posted August 7, 2024 Here are the two scripts I'm working with. I appreciate the help as I'm a total noob when it comes to JavaScript. Page2_Rule.txt Page1_Rule.txt Quote
Dan Korn Posted August 7, 2024 Posted August 7, 2024 Thanks. As you can see in the posts above in this thread, the property, for the Resource object, is "pagenumber", not "pageNumber". Note the capitalization. So your page 2 rule should be: switch (Field("image").toLowerCase()) { case "100".toLowerCase(): { var Image = Resource("100_Image"); Image.pagenumber = 2; return Image; } case "150".toLowerCase(): { var Image = Resource("150_Image"); Image.pagenumber = 2; return Image; } case "250".toLowerCase(): { var Image = Resource("250_Image"); Image.pagenumber = 2; return Image; } default: return NullResource(); } Or, more succinctly: var Image = Resource(Field("image") + "_Image"); Image.pagenumber = 2; return Image; Quote
KevinG Posted August 7, 2024 Posted August 7, 2024 Thanks I appreciate it big time. Everything seems to validate but I'm not getting my images. Its giving empty graphic boxes. Even my address block is coming up empty. Is it possible that the pdf file corrupted? Both the front and back Graphic Frames are having this issues. Resources are connected and OK. I've made sure the rule was linked to the Graphic box also. Quote
Dan Korn Posted August 7, 2024 Posted August 7, 2024 5 minutes ago, KevinG said: Its giving empty graphic boxes. Even my address block is coming up empty. What does the log (.msg) file say? You'll need to Compose, not just Preview, to see the log file. Quote
KevinG Posted August 7, 2024 Posted August 7, 2024 Job started 10:58:35 - 1723046315. Creator: FusionPro(R) VDP Creator 10.0.26 Computer Name: LENOVO Current working folder: C:\WINDOWS\system32 Temporary files folder: C:\Users\keith\AppData\Local\Temp\ Template File: C:\Customer Files\Union Bank\2024\August\CheckingSavings_Postcards_Template.pdf Input File: C:\Customer Files\Union Bank\2024\August\UBT_DC_Sample.csv Composing record #1, input record 1 No page is emitted, please check page usage in your input file. Composing record #2, input record 2 No page is emitted, please check page usage in your input file. Composing record #3, input record 3 No page is emitted, please check page usage in your input file. A blank page is emitted since no record is composed properly. Job ended 10:58:35 - 1723046315. Total Job Time: No page is emitted, please check page usage in your input file. Quote
KevinG Posted August 7, 2024 Posted August 7, 2024 Job started 10:58:35 - 1723046315. Creator: FusionPro(R) VDP Creator 10.0.26 Computer Name: LENOVO Current working folder: C:\WINDOWS\system32 Temporary files folder: C:\Users\keith\AppData\Local\Temp\ Template File: C:\Customer Files\Union Bank\2024\August\CheckingSavings_Postcards_Template.pdf Input File: C:\Customer Files\Union Bank\2024\August\UBT_DC_Sample.csv Composing record #1, input record 1 No page is emitted, please check page usage in your input file. Composing record #2, input record 2 No page is emitted, please check page usage in your input file. Composing record #3, input record 3 No page is emitted, please check page usage in your input file. A blank page is emitted since no record is composed properly. Job ended 10:58:35 - 1723046315. Total Job Time: No page is emitted, please check page usage in your input file. Error num 1036 Quote
Dan Korn Posted August 7, 2024 Posted August 7, 2024 It looks like you have Unused Body Pages. Go into the Page Usage dialog (from the menu, FusionPro -> Manage Pages -> Page Usage), and clear all the Unused flags. Then go into your OnRecordStart rule and remove any calls to FusionPro.Composition.SetBodyPageUsage. That should fix the "No page is emitted" errors when composing, and you should see the frame contents when previewing. Then you can fix your page usage, but if you have questions about that, please start a new thread here on the forum. Quote
KevinG Posted August 7, 2024 Posted August 7, 2024 Just removing the unused worked perfectly. Thank you so much for the insight and help. Its made things easier for me. Quote
Recommended Posts
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.