#1
|
|||
|
|||
![]()
I've been using this rule to insert magazine text pages inside a composition of a book cover. So the front cover is Body Page 1, Inside front cover is Body Page 2, the PDF I want to insert is next and then the Back Inside Cover and Back cover are the other Body Pages. Easy enough.
The PDF files I want to insert are on a new server and for some reason, it is not finding the PDF I want to insert. The only thing I changed from the last template was the pathName field because the files are in a different location. I've double checked the names in the path and the file name and everything is correct. I'm stumped. Can someone see if they see anything that would not allow me to find the PDF in this rule when I validate it? Only thing I could think of is the server permissions. This is the Error message: ***Error*** (uncaught exception: Error: Graphic not found: magazine-97.pdf) var pathName = "//ServerLocation/Resources/"; var FullResourcePath = 'magazine-' + Field("MagIDShort") + ".pdf"; //change to match your data file field var x = new FusionProResource(FullResourcePath, "graphic", 1); if (!x.exists) ReportError("Graphic not found: " + FullResourcePath); var pdfString = ''; for (var pgnbr = 1; pgnbr <= x.countPages; pgnbr++) { x.pagenumber = pgnbr; pdfString += x.value + '<p>\n'; } Print("Result is: " + pdfString); return pdfString;
__________________
Bryan Mathes, Print Production Specialist FusionPro Designer 10.1.11, FusionPro Producer (Server) API 10.1.11 Mac OSX 10.12.6 Mac Pro 2.8 GHz Quad Core Intel Xeon Last edited by ReminderVDP; November 18th, 2019 at 02:26 PM.. |
#2
|
||||
|
||||
![]()
You have this line in the rule:
Code:
var pathName = "//ServerLocation/Resources/"; I would think you would want the next line to be something like: Code:
var FullResourcePath = pathName + 'magazine-' + Field("MagIDShort") + ".pdf"; After that, you need to make sure the path is in the correct format, which depends on the platform (Windows or Mac). I guess my question to you is, are you composing this job locally, on your Mac, or are you composing it on Windows, via Producer? If you're composing on Mac, then you probably want a path that starts with "/Volumes/". And, on Mac, you need to make sure that you're actually connected to the server. You probably need to do a "Connect to Server" (Command-K) in the Finder, then connect to the remote server with SMB or a similar protocol. I would make sure you can see one of the files in question in the Finder, then drag it into a Terminal window to get the actual POSIX path, which, again, I would expect to start with "/Volumes/". If you're composing on Windows, then you probably want a UNC path, which starts with two backslashes; but backslashes need to be escaped in JavaScript, so that string would need to start with four backslashes, something like this: Code:
var pathName = "\\\\ServerName\\Resources\\"; If you want to make this work both for local Mac compositions, and for remote Windows (Producer) compositions, then you can write the code something like this: Code:
var pathName = "\\\\ServerName\\Resources\\"; // Windows UNC path if (FusionPro.isMac) pathName = "/Volumes/Resources/"; // need to connect to the server in the Finder first var FullResourcePath = pathName + 'magazine-' + Field("MagIDShort") + ".pdf"; Quote:
__________________
Dan Korn FusionPro Developer / JavaScript Guru / Forum Moderator PTI Marketing Technologies | Printable | MarcomCentral I am a not a Support engineer, and this forum is not a substitute for Support. My participation on this forum is primarily as a fellow user (and a forum moderator). I am happy to provide help and answers to questions when I can; however, there is no guarantee that I, or anyone else on this forum, will be able to answer all questions or fix any problems. If I ask for files to clarify an issue, I might not be able to look at them personally. I am not able to answer private messages, emails, or phone calls unless they go through proper Support channels. Please direct any sales or pricing questions to your salesperson or inquiries@marcom.com. Complex template-building questions, as well as all installation and font questions or problems, should be directed to FusionProSupport@marcom.com. Paid consulting work may be required to fulfill your template-building needs. This is a publicly viewable forum. Please DO NOT post fonts, or other proprietary content, to this forum. Also, please DO NOT post any "live" data with real names, addresses, or any other personal, private, or confidential data. Please include the specific versions of FusionPro, Acrobat, and your operating system in any problem reports or help requests. I recommend putting this information in your forum signature. Please also check your composition log (.msg) file for relevant error or warning messages. Please post questions specific to the MarcomCentral Enterprise and Web-to-Print applications in the MarcomCentral forum. Click here to request access. Or contact your Business Relationship Manager (BRM/CPM) for assistance. Please direct any questions specific to EFI's Digital StoreFront (DSF) to EFI support. How To Ask Questions The Smart Way The correct spellings are JavaScript, FusionPro, and MarcomCentral (each with two capital letters and no spaces). Acceptable abbreviations are JS, FP, and MC (or MCC). There is no "S" at the end of "Expression" or "Printable"! The name of the product is FusionPro, not "Fusion". "Java" is not is not the same as JavaScript. Check out the JavaScript Guide and JavaScript Reference! FusionPro 8.0 and newer use JavaScript 1.7. Older versions use JavaScript 1.5. return "KbwbTdsjqu!spdlt\"".replace(/./g,function(w){return String.fromCharCode(w.charCodeAt()-1)}); ![]() Last edited by Dan Korn; November 18th, 2019 at 03:53 PM.. |
#3
|
|||
|
|||
![]()
Dan,
I am using this rule and need to make a variation on it where the first 22 pages go into the text body page and the rest of the text (22 pages) goes into the overflow text body page. I have a center spread between the pages that will have advertisements in it so the text PDF file needs to be split in half. I tried doing a page count of 22 pages but I get the validation error of: line 9: SyntaxError: missing : after proerty id I don't thing the var pages is correct and is causing the SyntaxError. Rule: var pathName = "/Users/macpro1/Desktop/InkJet Layout_2-21-20/"; var FullResourcePath = 'magazine-' + Field("MagIDShort") + ".pdf"; //change to match your data file field var x = new FusionProResource(FullResourcePath, "graphic", 1); if (!x.exists) ReportError("Graphic not found: " + FullResourcePath); var pdfString = ''; for (var pages = Math.min(x.countPages, 22); { x.pagenumber = pages; pdfString += x.value + '<p>\n'; } Print("Result is: " + pdfString); return pdfString; Like usual, I'm probably over-complicating it.
__________________
Bryan Mathes, Print Production Specialist FusionPro Designer 10.1.11, FusionPro Producer (Server) API 10.1.11 Mac OSX 10.12.6 Mac Pro 2.8 GHz Quad Core Intel Xeon |
#4
|
||||
|
||||
![]()
So, a few things.
First, if you're posting code, it's a lot more readable if you put it into code formatting blocks, like in my posts. It's easy to do. Just click the "Go Advanced" button underneath the box you're typing into, then, after you copy-and-paste in the code, select it, then click the # button above the box where you're typing. (You can do all kinds of other formatting in that "Advanced" mode too.) Second, I think you're on the right track with: Code:
var pages = Math.min(x.countPages, 22); But you still need an actual "control" variable in the "for" statement on the line right below that. It's not just "for (pages)", it's what you had in your original post, but instead of: Code:
for (var pgnbr = 1; pgnbr <= x.countPages; pgnbr++) Code:
var pages = Math.min(x.countPages, 22); for (var pgnbr = 1; pgnbr <= pages; pgnbr++) Code:
for (var pgnbr = 1; pgnbr <= Math.min(x.countPages, 22); pgnbr++) So, putting it all back together: Code:
var pathName = "/Users/macpro1/Desktop/InkJet Layout_2-21-20/"; var FullResourcePath = 'magazine-' + Field("MagIDShort") + ".pdf"; //change to match your data file field var x = new FusionProResource(FullResourcePath, "graphic", 1); if (!x.exists) ReportError("Graphic not found: " + FullResourcePath); var pdfString = ''; var pages = Math.min(x.countPages, 22); for (var pgnbr = 1; pgnbr <= pages; pgnbr++) { x.pagenumber = pgnbr; pdfString += x.value + '<p>\n'; } Print("Result is: " + pdfString); return pdfString; Quote:
__________________
Dan Korn FusionPro Developer / JavaScript Guru / Forum Moderator PTI Marketing Technologies | Printable | MarcomCentral I am a not a Support engineer, and this forum is not a substitute for Support. My participation on this forum is primarily as a fellow user (and a forum moderator). I am happy to provide help and answers to questions when I can; however, there is no guarantee that I, or anyone else on this forum, will be able to answer all questions or fix any problems. If I ask for files to clarify an issue, I might not be able to look at them personally. I am not able to answer private messages, emails, or phone calls unless they go through proper Support channels. Please direct any sales or pricing questions to your salesperson or inquiries@marcom.com. Complex template-building questions, as well as all installation and font questions or problems, should be directed to FusionProSupport@marcom.com. Paid consulting work may be required to fulfill your template-building needs. This is a publicly viewable forum. Please DO NOT post fonts, or other proprietary content, to this forum. Also, please DO NOT post any "live" data with real names, addresses, or any other personal, private, or confidential data. Please include the specific versions of FusionPro, Acrobat, and your operating system in any problem reports or help requests. I recommend putting this information in your forum signature. Please also check your composition log (.msg) file for relevant error or warning messages. Please post questions specific to the MarcomCentral Enterprise and Web-to-Print applications in the MarcomCentral forum. Click here to request access. Or contact your Business Relationship Manager (BRM/CPM) for assistance. Please direct any questions specific to EFI's Digital StoreFront (DSF) to EFI support. How To Ask Questions The Smart Way The correct spellings are JavaScript, FusionPro, and MarcomCentral (each with two capital letters and no spaces). Acceptable abbreviations are JS, FP, and MC (or MCC). There is no "S" at the end of "Expression" or "Printable"! The name of the product is FusionPro, not "Fusion". "Java" is not is not the same as JavaScript. Check out the JavaScript Guide and JavaScript Reference! FusionPro 8.0 and newer use JavaScript 1.7. Older versions use JavaScript 1.5. return "KbwbTdsjqu!spdlt\"".replace(/./g,function(w){return String.fromCharCode(w.charCodeAt()-1)}); ![]() Last edited by Dan Korn; March 2nd, 2020 at 05:33 PM.. |
#5
|
|||
|
|||
![]()
Thanks Dan. I did not create 22 pages for text. I have one body page and an overflow page. Currently, the text is 44 pages and flows between cover pages in the output PDF. We are trying to add a center spread area with advertisements for the customer so the layout would be:
Front Cover Text: pages 1-22 Center Spread of ads Text: pages 23-44 Back cover I'll give this a try and see if it works.
__________________
Bryan Mathes, Print Production Specialist FusionPro Designer 10.1.11, FusionPro Producer (Server) API 10.1.11 Mac OSX 10.12.6 Mac Pro 2.8 GHz Quad Core Intel Xeon |
#6
|
|||
|
|||
![]()
Dan,
This worked. I'm taking it one step further and want to figure out a way to split the number of pages in half, no matter how many there are in the text PDF. Above, I knew I had a text document 44 pages and I told it to use the first 22. What can I put in the pages variable if I don't know the total amount of text pages? This is what I have right now and it finds the middle page of the text PDF, 22, but I can't get it to add the rest of the pages after page 22. It will only add that page. I would need it to start on page 23 of the text which I could add a +1 in the pages line. I think it's the page number variable causing the problem in this code though. Code:
var pathName = "/Users/macpro1/Desktop/InkJet Layout_2-21-20/"; var FullResourcePath = 'magazine-' + Field("MagIDShort") + ".pdf"; //change to match your data file field var x = new FusionProResource(FullResourcePath, "graphic", 1); if (!x.exists) ReportError("Graphic not found: " + FullResourcePath); var pdfString = ''; var pages = Math.min(x.countPages/2) for (var pgnbr = pages; pgnbr <= pages; pgnbr++); { x.pagenumber = pgnbr; pdfString += x.value + '<p>\n'; } Print("Result is: " + pdfString); return pdfString;
__________________
Bryan Mathes, Print Production Specialist FusionPro Designer 10.1.11, FusionPro Producer (Server) API 10.1.11 Mac OSX 10.12.6 Mac Pro 2.8 GHz Quad Core Intel Xeon |
#7
|
||||
|
||||
![]() Quote:
Do you mean there's a second rule to insert "Text: pages 23-44" as in your description? Since I can't actually run the code in your template context, I'm basically guessing, but I think that second rule would look something like this: Code:
var FullResourcePath = 'magazine-' + Field("MagIDShort") + ".pdf"; //change to match your data file field var x = new FusionProResource(FullResourcePath, "graphic", 1); if (!x.exists) ReportError("Graphic not found: " + FullResourcePath); var pdfString = ''; var halfPages = Math.floor(x.countPages/2); for (var pgnbr = halfPages + 1; pgnbr <= x.countPages; pgnbr++); { x.pagenumber = pgnbr; pdfString += x.value + '<p>\n'; } Print("Result is: " + pdfString); return pdfString; Code:
var FullResourcePath = 'magazine-' + Field("MagIDShort") + ".pdf"; //change to match your data file field var x = new FusionProResource(FullResourcePath, "graphic", 1); if (!x.exists) ReportError("Graphic not found: " + FullResourcePath); var pdfString = ''; // First half of "Text" var halfPages = Math.floor(x.countPages/2); for (var pgnbr = 1; pgnbr <= halfPages; pgnbr++); { x.pagenumber = pgnbr; pdfString += x.value + '<p>\n'; } // Center Spread of ads var ads = new FusionProResource(AdsResourcePath, "graphic", 1); for (var pgnbr = 1; pgnbr <= ads.countPages; pgnbr++); { ads.pagenumber = pgnbr; pdfString += ads.value + '<p>\n'; } // Second half of "Text" for (var pgnbr = halfPages + 1; pgnbr <= x.countPages; pgnbr++); { x.pagenumber = pgnbr; pdfString += x.value + '<p>\n'; } Print("Result is: " + pdfString); return pdfString;
__________________
Dan Korn FusionPro Developer / JavaScript Guru / Forum Moderator PTI Marketing Technologies | Printable | MarcomCentral I am a not a Support engineer, and this forum is not a substitute for Support. My participation on this forum is primarily as a fellow user (and a forum moderator). I am happy to provide help and answers to questions when I can; however, there is no guarantee that I, or anyone else on this forum, will be able to answer all questions or fix any problems. If I ask for files to clarify an issue, I might not be able to look at them personally. I am not able to answer private messages, emails, or phone calls unless they go through proper Support channels. Please direct any sales or pricing questions to your salesperson or inquiries@marcom.com. Complex template-building questions, as well as all installation and font questions or problems, should be directed to FusionProSupport@marcom.com. Paid consulting work may be required to fulfill your template-building needs. This is a publicly viewable forum. Please DO NOT post fonts, or other proprietary content, to this forum. Also, please DO NOT post any "live" data with real names, addresses, or any other personal, private, or confidential data. Please include the specific versions of FusionPro, Acrobat, and your operating system in any problem reports or help requests. I recommend putting this information in your forum signature. Please also check your composition log (.msg) file for relevant error or warning messages. Please post questions specific to the MarcomCentral Enterprise and Web-to-Print applications in the MarcomCentral forum. Click here to request access. Or contact your Business Relationship Manager (BRM/CPM) for assistance. Please direct any questions specific to EFI's Digital StoreFront (DSF) to EFI support. How To Ask Questions The Smart Way The correct spellings are JavaScript, FusionPro, and MarcomCentral (each with two capital letters and no spaces). Acceptable abbreviations are JS, FP, and MC (or MCC). There is no "S" at the end of "Expression" or "Printable"! The name of the product is FusionPro, not "Fusion". "Java" is not is not the same as JavaScript. Check out the JavaScript Guide and JavaScript Reference! FusionPro 8.0 and newer use JavaScript 1.7. Older versions use JavaScript 1.5. return "KbwbTdsjqu!spdlt\"".replace(/./g,function(w){return String.fromCharCode(w.charCodeAt()-1)}); ![]() Last edited by Dan Korn; March 9th, 2020 at 11:06 AM.. |
#8
|
|||
|
|||
![]()
Dan,
That would be a second rule for the second half of the text. When I validate it, it only gives me page 23 as a result. It doesn`t include the rest of the pages after page 23.
__________________
Bryan Mathes, Print Production Specialist FusionPro Designer 10.1.11, FusionPro Producer (Server) API 10.1.11 Mac OSX 10.12.6 Mac Pro 2.8 GHz Quad Core Intel Xeon |
#9
|
||||
|
||||
![]()
We've reached the limit of the help I can provide without the context of the template. I need the see the job files to diagnose this further.
__________________
Dan Korn FusionPro Developer / JavaScript Guru / Forum Moderator PTI Marketing Technologies | Printable | MarcomCentral I am a not a Support engineer, and this forum is not a substitute for Support. My participation on this forum is primarily as a fellow user (and a forum moderator). I am happy to provide help and answers to questions when I can; however, there is no guarantee that I, or anyone else on this forum, will be able to answer all questions or fix any problems. If I ask for files to clarify an issue, I might not be able to look at them personally. I am not able to answer private messages, emails, or phone calls unless they go through proper Support channels. Please direct any sales or pricing questions to your salesperson or inquiries@marcom.com. Complex template-building questions, as well as all installation and font questions or problems, should be directed to FusionProSupport@marcom.com. Paid consulting work may be required to fulfill your template-building needs. This is a publicly viewable forum. Please DO NOT post fonts, or other proprietary content, to this forum. Also, please DO NOT post any "live" data with real names, addresses, or any other personal, private, or confidential data. Please include the specific versions of FusionPro, Acrobat, and your operating system in any problem reports or help requests. I recommend putting this information in your forum signature. Please also check your composition log (.msg) file for relevant error or warning messages. Please post questions specific to the MarcomCentral Enterprise and Web-to-Print applications in the MarcomCentral forum. Click here to request access. Or contact your Business Relationship Manager (BRM/CPM) for assistance. Please direct any questions specific to EFI's Digital StoreFront (DSF) to EFI support. How To Ask Questions The Smart Way The correct spellings are JavaScript, FusionPro, and MarcomCentral (each with two capital letters and no spaces). Acceptable abbreviations are JS, FP, and MC (or MCC). There is no "S" at the end of "Expression" or "Printable"! The name of the product is FusionPro, not "Fusion". "Java" is not is not the same as JavaScript. Check out the JavaScript Guide and JavaScript Reference! FusionPro 8.0 and newer use JavaScript 1.7. Older versions use JavaScript 1.5. return "KbwbTdsjqu!spdlt\"".replace(/./g,function(w){return String.fromCharCode(w.charCodeAt()-1)}); ![]() |
#10
|
|||
|
|||
![]()
I think that rule I was working in got corrupted somehow. I put your code in a new Rule and it works. No matter what I changed the page number to in the rule I was using, it showed page 23. Seems to be working with the new rule now. Thanks for your help.
__________________
Bryan Mathes, Print Production Specialist FusionPro Designer 10.1.11, FusionPro Producer (Server) API 10.1.11 Mac OSX 10.12.6 Mac Pro 2.8 GHz Quad Core Intel Xeon |
![]() |
Thread Tools | Search this Thread |
Display Modes | |
|
|