#1
|
||||
|
||||
![]()
This sample job shows how multiple variable PDF graphic files, each of an unknown page-count, can be inserted into a FusionPro template as inline graphics into a text frame. This sample includes all sample files and heavily commented JavaScript that shows how this logic is created.
To accomodate the varying and unknown page count as well as number of PDF graphics to be inserted in each record, the advanced "Automatic Page Insertion" option in FusionPro is used. This option, also called "Page Overflow" is a function of a variable text frame. Designed initially to accomodate varying text content length, the functionality also allows for multiple graphic file insertions and is a great solution when each data record requires an unknown and possibly extremely variable set of variable graphics. Pay special attention to the variable frame settings especially the size of the frames and the settings in the "Paragraph" dialogue (inside of the variable text editor). |
#2
|
|||
|
|||
![]()
I'm not able to get this to work. I'm on a mac, so I changed the path in the "PDF Graphic Insertion Rule" to 'Macintosh HD:Path:". When I compose, all I get is the first page. I don't get the pages that are to be overflowed. I am needing to do a project similar to this -- any suggestions?
|
#3
|
||||
|
||||
![]()
Help!
I am trying to get this sample to work on my computer as well. I downloaded the job and changed the path in the script to: 'Macintosh HD:Users:kay: Desktop:Avalanche_tests:Insert PDF Graphics Inline: Docs' (There are NO spaces in front of the Ds, but if I type ![]() I can only get the first page of the doc to compose and it is not pulling the PDFs from the folder "Docs". 1) Is my path typed incorrectly? I thought on a Mac the separators were colons. But I tried / and \\ also jsut in case. 2) Is this the only part of this script that I should need to change to get this to work? Thanks for any help. I have a job very similar to this and I feel if I can get THIS sample to work, I can figure out my job as well. ******************************** I'll paste the original JS here in case that helps: //This rule will examine the input data to find a list of PDF files //that are to be inserted in the template. //Each PDF is of varying and unknown page count. Therefore, this script //will determine that page count and reference each page in each PDF. //The resulting tagged markup will include the variable <graphic> tag to reference //the PDF pages and include as inline images in the template. //This text rule in inserted into a large text frame on a Body page. That frame //is set to Overflow to a frame on an overflow page. //First, declare the variables and initiate them with values. FieldName = ''; PDFfileName = ''; pagesInPDF = 0; markupToReturn = ''; pathToAllPDFs = 'C:\\Work\\Printable\\Insert PDF Graphics Inline\\Docs\\'; pathToPDF = ''; PDFresourceRef = ''; //There are 3 fields in this sample - Doc1, Doc2, and Doc3. We will loop through //each field name with a simple for loop. The following variable sets the counter //for that loop. //For example, if you have 25 fields instead of 3 with the PDF file names in them, //such as "Doc1" through "Doc25" you would set the following to 25. FieldsToInspect = 3; //This is the main loop that parses through all of the fields for a given record. for (fieldCounter = 1; fieldCounter <= FieldsToInspect; fieldCounter++) { FieldName = 'Doc' + fieldCounter; PDFfileName = Field(FieldName); pathToPDF = pathToAllPDFs + PDFfileName; //Create a new resource that references this PDFresourceRef = CreateResource(pathToPDF ,'graphic' ,'no'); //Find out how many pages it has pagesInPDF = PDFresourceRef.countPages; //return PDFresourceRef.name; //This is the secondary loop for this script. //It will loop through and create markup for each page in the PDF. for (pageLoop = 1; pageLoop <= pagesInPDF; pageLoop++) { markupToReturn += '<graphic file="' + PDFresourceRef.name + '" pagenumber = "' + pageLoop + '" position="afterline"/>'; markupToReturn += '<P>'; } } //remove the last <P> markupToReturn = Left(markupToReturn, markupToReturn.length - 3); return markupToReturn; Thanks, KayEll
__________________
Fusion Pro VDP Creator 9.3.36 Fusion Pro Expression 3.1.8 Acrobat Pro 8.0 InDesign CC 2019 and 2020 Mac OS X 10.6.8 |
#4
|
||||
|
||||
![]()
Your signature mentions "Windows XP Version 2002," but you're obviously on a Mac. It would be useful to know the exact version of Mac OS X you're running.
At any rate, on either platform, you definitely need a trailing directory separator at the end of the path in that particular rule, so that in this line: Code:
pathToPDF = pathToAllPDFs + PDFfileName; 'Macintosh HD:Users:kay:Desktop:Avalanche_tests:Insert PDF Graphics Inline:DocsMyGraphicName', which is surely wrong (it should be something like: 'Macintosh HD:Users:kay:Desktop:Avalanche_tests:Insert PDF Graphics Inline:Docs:MyGraphicName' - note the difference that last colon makes). So, I would try adding a single colon at the end of the path specification: 'Macintosh HD:Users:kay:Desktop:Avalanche_tests:Insert PDF Graphics Inline:Docs:' If that still doesn't work (or even if it does), you probably should be using the newer POSIX-style paths on Mac instead of the old-style HFS paths. So I would try a path like this: '/Users/kay/Desktop/Avalanche_tests/Insert PDF Graphics Inline/Docs/' Note the trailing slash at the end.
__________________
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)}); ![]() |
#5
|
||||
|
||||
![]()
Dan, Yes I very recently moved my FP to my Mac and forgot to update my signature. I am using OS X 10.5.8, FP Desktop 6.0P, and Acrobat 9.
Thanks for the tip, your fix worked perfectly! I didn't realize I needed that last separator. I also didn't have my text boxes extending all the way to the edge of the PDF, so that was another problem. So, I have this sample working now, and my sample as well after I renamed all my PDFs to Doc1 and Doc2, but I think my eventual data and PDFs will be coming to me in a different manner. My fields will have the different document names as the header (ie: Kitchen, Bath, Bedroom) and the value will simply be a yes or a no if they require that document. They can have 1, 2 or all 8 documents if they desire. I'm not 100% sure how I will need to alter this to fit that. Or if I should just have them make their data fit this existing script. I can probably have them send me the data however I want. Thanks for your help! Much appreciated. KayEll
__________________
Fusion Pro VDP Creator 9.3.36 Fusion Pro Expression 3.1.8 Acrobat Pro 8.0 InDesign CC 2019 and 2020 Mac OS X 10.6.8 |
#6
|
|||
|
|||
![]()
I can't seem to get it to work either, and have tried every variation that I can think of for the path.
pathToAllPDFs = 'C:\Documents and Settings\ehigginbotham\Desktop\Insert PDF Graphics Inline\Docs:'; windiows xp fp: 6.2 thanks Eric |
#7
|
||||
|
||||
![]() Quote:
Code:
Print(pathToAllPDFs); Code:
return pathToAllPDFs; Why do all the backslashes get removed? Because the backslash is a special character in string literals in JavaScript: https://developer.mozilla.org/en/Cor...ing_Characters You can work around this in several ways, which I'll present in order from least to most recommended:
__________________
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)}); ![]() |
#8
|
|||
|
|||
![]()
I had figured out the / instead of \ thing through luck. lol I am actually using this rule for a template in marcom central, do you know if the 3rd option will work if the paths to the images are on the web? I know this is actually a question for that forum, but this rule was so similar I started here.
thanks for your help |
#9
|
||||
|
||||
![]()
Luck is fine, but debugging is better. Thus my suggestion to use Print and return statements to find out what's really going on in different places in your rules.
If you're in the MarcomCentral environment, then the Search Path is set up automatically in the composition to point to the locations of the files you upload through the Manager to your image libraries. So you don't need to specify the path anywhere from your end for any online compositions. You'll still need the path for offline compositions and Previews on your local machine, though.
__________________
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
|
|||
|
|||
![]()
Now that this rule is working, I need to use it in conjunction with a rule that will make the total page count of a book divisable by 4. Here is the rule I have so far. Any suggestions.
//Letter Page if ((Field("ZIP")) == "") { FusionPro.Composition.SetBodyPageUsage("Directory file",false); }else{ FusionPro.Composition.SetBodyPageUsage("Directory file",true); } if (Field("Page 1 y or n") == "y") { FusionPro.Composition.SetBodyPageUsage("70",true); }else{ FusionPro.Composition.SetBodyPageUsage("70",false) ; } if (Field("Page 2 y or n") == "y") { FusionPro.Composition.SetBodyPageUsage("71",true); }else{ FusionPro.Composition.SetBodyPageUsage("71",false) ; } if (Field("Page 3 y or n") == "y") { FusionPro.Composition.SetBodyPageUsage("72",true); }else{ FusionPro.Composition.SetBodyPageUsage("72",false) ; } // place each field into an array // then count the number of pages in each pdf and add them together //if there are any static pages in the booklet // adjust the starting number of the PAGECount here. // since we have no static pages in this booklet, keep the PAGECount at 0 var PAGECount=86; var PicPages=4; PAGEArray = [ Field("ZIP"),Field("Page 1 y or n"),Field("Page 2 y or n"),Field("Page 3 y or n") ] for (i = 0 ; i < PAGEArray.length ; i++) { if (PAGEArray[i] != "") { var Pic = new FusionProResource(PAGEArray[i], "graphic", "true"); PicPages = Pic.countPages; PAGECount+=PicPages; } } //divide pagecount + 10 by 4 //if remainder is 1, you will need all 3 blank pages //if remainder is 2, you will need 2 blank pages //if remainder is 3, you will need 1 blank page if (PAGECount % 4 == 1) { FusionPro.Composition.SetBodyPageUsage("Intentiona l Blank 1", "true"); FusionPro.Composition.SetBodyPageUsage("Intentiona l Blank 2", "true"); FusionPro.Composition.SetBodyPageUsage("Intentiona l Blank 3", "true"); } else if (PAGECount % 4 == 2) { FusionPro.Composition.SetBodyPageUsage("Intentiona l Blank 1", "true"); FusionPro.Composition.SetBodyPageUsage("Intentiona l Blank 2", "true"); } else if (PAGECount % 4 == 3) { FusionPro.Composition.SetBodyPageUsage("Intentiona l Blank 1", "true"); } |
![]() |
invaricconsulting |
This message has been deleted by invaricconsulting.
|
![]() |
invaricconsulting |
This message has been deleted by invaricconsulting.
|
![]() |
invaricconsulting |
This message has been deleted by invaricconsulting.
|
![]() |
Thread Tools | Search this Thread |
Display Modes | |
|
|