JPalchak Posted April 21, 2016 Share Posted April 21, 2016 Hello, I'm having some issues with a tricky file I need to compose. I have 2 documents and 1 set of data to use for both. Normally to pull up a page you could use a Field that has been defined in the data for that purpose, however there isn't one exactly for this case. Which 6-page document I use is determined by the value of the ASK field. http://i.imgur.com/aXzSuCz.png Now I've set up an OnRecordStart rule that checks if there is a value in that field or not Like so: http://i.imgur.com/2iE7EyO.png And the body pages like so: http://i.imgur.com/o5ppLCn.png It seems pretty straightforward, if there is no value or a null value then the 6 body pages that will be composed for a record will be NO ASK-P1 through P6. However all I get are errors. http://i.imgur.com/UZ8t42m.png What am I missing? Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted April 21, 2016 Share Posted April 21, 2016 It seems pretty straightforward, if there is no value or a null value then the 6 body pages that will be composed for a record will be NO ASK-P1 through P6. However all I get are errors. Are the errors really all you get? What does the output file look like? Those errors are about missing graphics, and have nothing at all to do with page usage. I'm not sure why you think those two things are connected. I would guess that it's simply a matter of your graphic file names being malformed. It looks like they're using the old-style HFS paths from Mac OS 9, with colons as directory separators. In modern versions of Mac OS X, you should use POSIX paths with forward slashes as directory separators instead. Specifically, instead of paths like "./2016 general proposal ask:no ask.pdf", they should be in the form of "./2016 general proposal ask/no ask.pdf". I don't know where in your job that path with the colon is coming from, though. (Also, I do appreciate the screen shots, and I do often say here on the forum that a picture is worth a thousand words. But in the case of the contents of a log file, or a rule, it's better to simply copy-and-paste the text instead of posting a picture of it. Or just attach a text file. That makes it easier for others to help because we can copy-and-paste the text contents on our end instead of having to try to re-type what's shown in a screen shot.) As for your rule itself, I think it's fine, although it's very repetitive, and can be reduced quite a bit. For one thing, you're already starting out with all the pages set to be unused, so you don't need any of the lines calling FusionPro.Composition.SetBodyPageUsage with the second parameter set to false. Also, you could do a simple iteration instead of 1 line for page 1, another line for page 2, another line for page 3, etc. For example, this should work just as well: for (var i = 1; i <= 6; i++) { if (Field("ASK")) FusionPro.Composition.SetBodyPageUsage("ASK-P" + i, true); else FusionPro.Composition.SetBodyPageUsage("NO ASK-P" + i, true); } Or, even more succinctly: for (var i = 1; i <= 6; i++) { var pageName = "ASK-P" + i; if (!Field("ASK")) pageName = "NO " + pageName; FusionPro.Composition.SetBodyPageUsage(pageName, true); } Or, even less: for (var i = 1; i <= 6; i++) FusionPro.Composition.SetBodyPageUsage((Field("ASK") ? "" : "NO ") + "ASK-P" + i, true); Quote Link to comment Share on other sites More sharing options...
JPalchak Posted April 22, 2016 Author Share Posted April 22, 2016 None of my pages are resources or using graphic frames, do I need to make them into graphic frames? I don't see why I need to since I've had pages placed in a document before and called them out using the setbodypage. The output file is blank pages with the fusion pro output from the data on them. http://i.imgur.com/pircg13.png Quote Link to comment Share on other sites More sharing options...
step Posted April 22, 2016 Share Posted April 22, 2016 None of my pages are resources or using graphic frames, do I need to make them into graphic frames? I don't see why I need to since I've had pages placed in a document before and called them out using the setbodypage. The output file is blank pages with the fusion pro output from the data on them. Probably not the case, but it might be worth making sure that you don't have "Suppress static PDF background in composition" checked in your composition settings (under "graphics"). What version of FusionPro are you using? I think I recall a quirk in previous versions of FusionPro that had difficulty dealing with template file names with capital letters in them. Is your file all lower cased – as it's listed in the message log? Is that colon (:) part of the file name? It might be worth trying to rename your template something simple like "test.pdf" and trying to recompose. I also wanted to mention that you can toggle body pages by page number in FP8 and FP9 – I'm not sure about 7... for (var i=1; i<=6; i++) FusionPro.Composiiton.SetBodyPageUsage(i + !Field('ASK') * 6, true) console.log(i + !Field('Ask') * 6) Or similar: var pg = 7; while (--pg) FusionPro.Composiiton.SetBodyPageUsage(pg + !Field('ASK') * 6, true); Quote Link to comment Share on other sites More sharing options...
JPalchak Posted April 22, 2016 Author Share Posted April 22, 2016 Suppress static is unchecked and I'm on v9.0.3. I regularly have capitalized page names but I tried making them all lower-case but the same results occur. It's like it wants a resource called no ask.pdf and ask.pdf to use for the body pages but why? If I already have a static background to use and all I'm doing is telling it which 6 pages to use per record. Quote Link to comment Share on other sites More sharing options...
step Posted April 22, 2016 Share Posted April 22, 2016 Maybe it's a permissions issue with that particular PDF or something. It's really difficult to say based on a couple of screenshots. Can you collect and upload your template/data? Quote Link to comment Share on other sites More sharing options...
JPalchak Posted April 25, 2016 Author Share Posted April 25, 2016 Maybe it's a permissions issue with that particular PDF or something. It's really difficult to say based on a couple of screenshots. Can you collect and upload your template/data? Yep, here's a link to the .zip https://dl.dropboxusercontent.com/u/48443037/2016%20General%20Proposal%20ASK%3ANO%20ASK.zip Quote Link to comment Share on other sites More sharing options...
ScottHillock Posted April 25, 2016 Share Posted April 25, 2016 Remove the slash / from the filename so it is "2016 General Proposal ASKNO ASK.pdf". The slash is being treated like a directory separator, and is being replaced with the Mac seperator ":", on composition. Usually I try and keep file names as simple and short as possible, and all lower case. Quote Link to comment Share on other sites More sharing options...
JPalchak Posted April 25, 2016 Author Share Posted April 25, 2016 Remove the slash / from the filename so it is "2016 General Proposal ASKNO ASK.pdf". The slash is being treated like a directory separator, and is being replaced with the Mac seperator ":", on composition. Usually I try and keep file names as simple and short as possible, and all lower case. Worked like a charm, got the file with that and I didn't change it to my usual _ naming convention. Thanks! Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted April 25, 2016 Share Posted April 25, 2016 Remove the slash / from the filename so it is "2016 General Proposal ASKNO ASK.pdf". The slash is being treated like a directory separator, and is being replaced with the Mac seperator ":", on composition. Usually I try and keep file names as simple and short as possible, and all lower case. Yeah, on Windows, the template file name shows up as "2016 General Proposal ASK:NO ASK.pdf", with a colon, which is not legal in a Windows file name at all, and Windows can't even extract it (though WinRAR and 7-Zip handle it by simply removing the colon). At any rate, my initial suspicion was correct: The problem had absolutely nothing at all to do with page usage or anything else in your rules. Quote Link to comment Share on other sites More sharing options...
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.