Jump to content

step

Registered Users - Approved
  • Posts

    962
  • Joined

Everything posted by step

  1. If your art has 1/8" bleed, then the gutter is going to be 1/4". How do you intend on keeping the 1/8" bleed on all 3 pieces if there is only a 1/8" gutter to put the bleed? If you want 1/8" gutters the bleed needs to be set to 1/16" so that both fit. That being said, the imposition you described should fit with 1/4" gutters. In the "Layout" tab, have you made sure that the "Spacing" is set to 0"? That value is additional to any bleed you've specified in the file. So, setting 1/8" in bleed automatically gives you a 1/4" gutter – 1/4" "spacing" (FPImposer's default) will effectively make the gutter 1/2" and cause the imposition to not fit on the sheet.
  2. If the backs are variable, it seems to me you could achieve the same thing by having a two-paged template that is repeated by the number of backs that have been uploaded. I'm not sure what's the point of returning a 10 page preview if all of the fronts and backs are identical (i.e. they uploaded 1 or 0 custom backs). Instead you could count the number of backs that they've uploaded, repeat the record that many times and change the graphic on the back page for each time the record repeats itself: var backs = [Field("Image1"),Field("Image2"),Field("Image3"),Field("Image4"),Field("Image5")].filter(String).map(function(s){ return CreateResource(s, 'graphic');}); FusionPro.Composition.repeatRecordCount = backs.length; var back = backs[FusionPro.Composition.repeatRecordNumber-1] || CreateResource("DefaultBack.pdf", 'graphic'); FindGraphicFrame("Graphic1").SetGraphic(back); In the above code, the "backs" array contains the 5 "custom back" fields. The array is filtered and the empty fields are removed. Then the record is repeated by the length of the array. As it repeats the record, it steps through the "backs" array and assigns the contents to the graphic frame on the back page. If "backs" is empty, it assigns a default image to the back page. If for some reason you need to return a 10 page preview (5 cards) regardless of how many unique backs there are, you could do so like this: var back = 'DefaultBack.pdf'; var backs = [Field("Image1"),Field("Image2"),Field("Image3"),Field("Image4"),Field("Image5")].map(function(s){ back = (s) ? s : back; return CreateResource(back,'graphic');}); FusionPro.Composition.repeatRecordCount = 5; FindGraphicFrame("Graphic1").SetGraphic(backs[FusionPro.Composition.repeatRecordNumber-1]);
  3. You aren't required to put the file name in your data file for inline graphics. Assuming you've added the file as a resource for your drag-and-drop graphic rule, you can use that as an inline graphic by creating a rule that returns it (below) and inserting it in your text frame: return Resource("Your File").content; Make sure "treat returned strings as tagged text" is checked.
  4. This code makes use of two arrays; one is a list of fields that should be made upper-cased and the other is a list of fields that need price formatting applied to them: var upper = [ "Field Name1", "Field Name2", // Add as many as you like ]; var prices = [ "Field3", ]; for (var i in FusionPro.Fields){ var val = (prices.indexOf(i)+1) ? FormatNumber("$0.00", RawTextFromTagged(TaggedDataField(i))) : ToUpper(RawTextFromTagged(TaggedDataField(i))) if (upper.concat(prices).indexOf(i)+1) FusionPro.Composition.AddVariable(i, val); }
  5. Click the text frame, click the "Overflow" button on the Text Frame property window, select "Adjust text to fit." This will create an "OnCopyfit" callback function in your list of rules. More information can be found on page 152 of the User Guide PDF. On the Text Frame property window, there are text inset amounts that can be set. They located directly above the "Overflow" button. The first sets an x-inset and the second one sets a y-inset. I'm guessing if you had an 8pt x-inset, that would essentially decrease the amount of available space to fit the text by 16pts (8pt on the left and 8pt on the right). 72 - 16 = 56 so that would explain why your code works when you change the width parameter to 55.
  6. I'm not sure why you don't just apply the OnCopyfit callback function to the entire frame. It sounds like you're trying to copyfit the entire contents of the frame anyway. You might want to double-check the Text Frame editor and verify that the width is exactly 1''. Sometimes those numbers jump around by a tiny bit (for me anyway). Dropping what point size down? The size of the text frame? If your frame is 72 points like you say it is, do you have a 8pt text inset applied to the frame? You'd have to account for that as well. Again, nothing wrong with that code and that's probably the better way to accomplish this if you dead-set on not using the OnCopyfit callback. Keep in mind, though, that you have to actually give the text frame a unique name before that code will work. All of these suggestions will require "Treat returned strings as tagged text" to be checked and making use of CurrentFlow will require "Re-evaluated this rule for every text flow" to be checked. Unfortunately, I can't really offer any other solutions without seeing your template or data. All of the above worked for me.
  7. By altering the previous solutions, you can exempt certain fields by adding them to an "exclusions" array like this: var exclusions = [ "Field Name1", "Field Name2", // Add as many as you like ]; for (var i in FusionPro.Fields){ if (exclusions.indexOf(i)<0) FusionPro.Composition.AddVariable(i, ToUpper(RawTextFromTagged(TaggedDataField(i)))); } Here "Field Name1" and "Field Name2" will not be upper-cased but the rest of your fields will be. If the list of exclusions is longer than the list of fields that should be upper-cased, you can use this code: var upper = [ "Field Name1", "Field Name2", // Add as many as you like ]; for (var i in FusionPro.Fields){ if (upper.indexOf(i)+1) FusionPro.Composition.AddVariable(i, ToUpper(RawTextFromTagged(TaggedDataField(i)))); } Here, only fields in the "upper" array will be altered ("Field Name1" & "Field Name2").
  8. This will return the Spanish date if the language is set to "Spanish," for anything else it will return English: function SpanishDate(myDate) { var months = ['enero','febrero','marzo','abril','mayo','junio','julio','agosto','septiembre','octubre','noviembre','diciembre']; var days = ['domingo','lunes','martes','miércoles','jueves','viernes','sábado']; var month = months[myDate.getMonth()]; var day = days[myDate.getDay()]; return day + " " + myDate.getDate() + " de " + month + " de " + myDate.getFullYear(); } return (FusionPro.language == "Spanish") ? SpanishDate(Today()) : FormatDate(Today(), 'lm d, yyyy');
  9. I've never done what you're trying to do but it sounds like FusionPro is being passed Excel's internal date rather than the formatted text. Have you tried converting the date cells to actual text rather than dates? On the other hand, it appears to me from your examples that Excel is calculating dates based on how many days after December 30, 1899 something is: July 26, 2015 is 42,211 days after December 30 1899. So you could use this function to format it in FusionPro if you want: function ExcelDate(input,format){ if (!input) return ''; var date = new Date('12/30/1899'); date.setDate(date.getDate() + Int(input)); return FormatDate(date,format); } return ExcelDate(Field("Date"),"m-dd-yy");
  10. The easiest way would be to put a small (potentially screened back) sequence number on the printed piece that production can reference to keep each unique piece in order. You can do this by created a text box, opening the text editor, and inserting the "$outputrecordnumber" variable. Or in a rule: // Padded for 1,000,000 records return FormatNumber("0000000",FusionPro.Composition.outputRecordNumber); Putting a sequence number in the slug of the output file isn't really going to help much if the stacks get out of order on the knife. If you want to do that, though, you can click "Imposition" in the "Composition" window and check "Page Info" under "Page Marks" to print the page number in the output file. If you were running a newer version of FP (your sig says you're running 6.0), you could create a template page and use it as the background of your imposed sheet to gain a little more control over what prints on it.
  11. Thanks for the reply, Dan. Well yeah, I wasn't saying it doesn't work in Server – it obviously does. I was just saying that it seemed like the way the "Copyfit" function validated on the Server might be different. I guess the way I rationalized that to myself was: "Well, it's not like it doesn't say the text didn't fit. It just doesn't print the error because I'm not watching the composition run from the dialog box on my desktop." What? It printed "fits" right above the message telling me it doesn't fit. So, that made me think it always validated as true on the Server. I created an Assets.dat file when I collected my template and it's in the same directory as my template, but I have not specifically called it from the command line if that's what you're asking. I'm running the file like this: C: CD C:\Program Files (x86)\PTI\FusionPro\ FusionPro "\\server\path\to\templates\test\data.csv" "\\server\path\to\templates\test\test.dif" "\\server\path\to\templates\test\test-o.cfg" "\\server\path\to\templates\test\output.pdf" That's how I was hoping that worked. Can you give an example of a "severe" error? If a "medium" error is something reported by "ReportError," is it correct to assume that a minor error is something reported with "ReportWarning?" And with that assumption in mind, does that mean that "medium" and "minor" errors can only be generated if I were to physically call them from code or can FP also throw those? That's precisely it except I'm not sure I want to fail the record as much as I want to be prompted to check the log and find out what didn't copyfit. There are some cases where the truncated text isn't necessary and I don't want to have to re-run the entire job in an instance like that. That sounds neat. I definitely like the ability to add custom error codes that seems very helpful I just want to do so without skipping the record or aborting the job. That's a good idea too but a lot of our jobs (this one in particular) is pre-sorted. So if a record(s) get deemed as "bad" it would become a headache for our kitting department. Anyway, again, thanks for the feedback and the ideas. I have been working on a test file to upload to the forum (the actual file is very large and contains a bunch of customer sensitive data that I don't feel comfortable uploading) but I haven't been able to reproduce the problem. Which...I guess is good? Now I just have to figure out what it is about my actual template that's different from my testing one.
  12. Does the OnCopyfit callback work differently when composing on the server (via command line) than it does when composing locally? My OnCopyfit rule looks like this: if (!Copyfit(new MagnifyAttributes("text", 25, 400, 6, 72))) { ReportWarning("Could not copyfit text in flow " + FusionPro.Composition.CurrentFlow.name); } Upon examining the .msg file after a local composition, I see the warning that I printed (in red) followed by a pretty specific log of what went wrong: When composing on the server, I only get the detailed version and anything that I put within that 'if' statement is ignored. That leads me to believe that the 'Copyfit' function always returns true when composing on the server. Could that be true? With that in mind, I tried this: if (!Copyfit(new MagnifyAttributes("text", 25, 400, 6, 72))) { Print("doesn't fit"); } else { Print("fits"); } and got the following output when composing on the server: Ultimately, the reason I'm asking is because I'm trying to move that information into an XML log file to parse out later but it doesn't appear that copyfitting warnings are something that the XML log reports by default. My suspicion is that the errors that get reported in the XML log are system error codes and they'd be referenced by number. But, to me, a record failing to copyfit is an error I'm concerned about so I'd like to put it in the log like so: if (!Copyfit(new MagnifyAttributes("text", 25, 400, 6, 72))){ var warning = "Could not copyfit text in flow " + FusionPro.Composition.CurrentFlow.name; ReportWarning(warning); FusionPro.Composition.LogXMLMetadata('copyfit',warning); } For what it's worth, the templates are FP8.2.7 and the servers (I've tried 2 with the same results) are versions 8.2.5 and 9.3.15. Anyway, any insight or suggestions would be much appreciated!
  13. You know, I actually came across that little gem a few weeks ago and thought that would be a much cleaner method of doing things but have yet to get around to re-writing everything. The log parse is part of a larger workflow of scripts that produces a job so I'm hesitant to make edits (no matter how seemingly minor) without having enough time to properly test it. And unfortunately at the moment I'm too busy. This forum isn't going to read itself! That's for files generated in FP9 I'm assuming? I was referring to files generated by FP8 being ASCII format according to the "file" command. We have an FP9 server and an FP8 server that has yet to be upgraded and the workflow has to run on both (I know this is another argument for me to just use the XML log). But I digress.
  14. The script that I had to revise checked for composition time errors and parsed out information that I printed to the .msg log from my FP templates at the end of batch compositions. Information like: total pieces to print, total number of press sheets, job number, etc. This is all information that our planning department requires and since a composition can produce upwards of 80-something files, I scripted that in lieu of manually checking every log file. Yeah, that may be the case. But, I think (it's been a while since I worked on this) that the file command in Bash recognized the logs created on an FP8 server as ASCII so that's what I converted the logs from an FP9 server to. And just for full disclosure, I have very little idea what I'm talking about when it comes to text encoding.
  15. Scott, I had a similar issue. I'm not working with XML files, but the change to 16-bit broke some scripts that I run on my FusionPro .msg logs after composition. In order to compensate for that, I wrote a bash script that will convert the file(s) (in my case I'm batch processing data) back to ascii format to conform to my workflow. This may work for you as well: Open Terminal.app Paste this line of code and press enter: conv_ascii() { iconv -c -f `file -I $1 | sed -e 's/.*charset=\(.*\)/\1/'` -t us-ascii//TRANSLIT "$1" > "$1".tmp; mv -f "$1".tmp "$1"; } type "conv_ascii " and then drop the file you want to convert onto the Terminal window and press enter: conv_ascii /path/to/file.xml You can run the following command on your file afterwards to verify that it was converted to ascii: file -I /path/to/file.xml Expected output: Less nerdy solution: Depending on how many files you're actually editing, you might find it easier to open the file in a text editor like Sublime Text and click File > Save with encoding > UTF-8.
  16. Good, I'm glad. To be completely honest, I've never used FusionPro's chart functionality and don't know much about the way it works other than what I've shared in my previous post. That being said, I definitely see what you're talking about with the X and Y axes but have no idea how to turn those lines off. I would probably butt a textbox with a white fill up against the axes you want to disappear (creative – I know). Speaking of which, why are you wanting to hide the Y and X axes? I understand from looking at your example that the Y-axis has a funny way of incrementing (and by "funny" I mean "misleading") but if you're planning to pre-print a Y-axis that goes from 0 - 1,000,000 bushels, your chart is going to be incorrect. FP's chart is ending at the highest value (8,000 bushels for example) and a pre-printed or static Y-axis will give the appearance that the column has a value of 1,000,000. You could set a max value of the Y-axis to be 1,000,000 but that will skew the chart significantly. Anyway, just some food-for-thought. What do you mean nothing changed? I thought you just said that the chart was building properly. Well, I'm not sure what a "short-long" way to do something is. If you're wanting to trigger pages based on whether or not a record has 1, 2, or 3 charts you can do that. Make these modifications to the "Chart" function that will return nothing if a record doesn't have a value for a specific chart type: // Chart Function function Chart(type){ var data = [["1 Year"],["2 Year"],["InventoryPro"]]; var years = [2009,2010,2011,2012,2013,2014,2015,2016]; [color="red"]var empty = true; // Empty flag[/color] years.forEach( function(s){ for (var i=0; i<data.length; i++){ [color="red"] var cell = GetValue(s + " " + type + " " + data[i][0]); // If cell is not empty, set empty flag to false empty = (empty) ? !cell : empty; data[i].push(cell);[/color] } }); [color="Red"]// If chart is empty, return nothing if (empty) return '';[/color] var result = '<row type="header">'; result += '<cell><cell>' + years.join('<cell>'); data.map(function(s){return s.join('<cell>');}).forEach(function(s){ result += '<row><cell>' + s; }); return result; } Then you can set all of your body pages to "unused" and create an OnRecordStart callback rule: var charts = { Corn: Chart("Corn"), Soy: Chart("Soybeans"), Wheat: Chart("Wheat") } var page = ''; for (var i in charts){ page += (charts[i]) ? i : ''; } FusionPro.Composition.SetBodyPageUsage(page, true); Here's what that's doing: I created an object called "charts" with the properties "Corn," Soy," and "Wheat" each with the value of the chart it should return for that record. Iterate through each property and if the value is not blank (meaning it returns a chart), add it to the 'page' string. So if "Corn" returns a chart, 'page' becomes "Corn" if "Soy" returns a chart, 'page' becomes "CornSoy." And you're left with the page that matches the charts to be displayed. If a record doesn't have a chart, no page will be output.
  17. Take a look at the TagsRefGuide.pdf (FusionPro > Documentation > Tags Reference). There's some pretty good information in there about how to make these charts work. Page 36 has an example that seems to almost be exactly what you're trying to do. It's a little bit confusing but I'll try to explain: the rule that is making the chart is returning a row with cells that represent the columns. The first row should be the header row. The second should be the "1 Year" values for each header, the third should be "2 Year" values for each header, etc. And I think you'll need to make sure that each row has the same number of cells. Like this: chart = '<rowtype=header><cell>2009<row><cell>2010<row><cell>2011<row><cell>2012<row><cell>2013<row><cell>2014<row><cell>2015<row><cell>2016'; chart += '<row><cell>Year 1'; chart += '<cell>' + Field("2009 Corn 1 Year Sign Up"); chart += '<cell>' + Field("2010 Corn 1 Year Sign Up"); chart += '<cell>' + Field("2011 Corn 1 Year Sign Up"); ... etc ... chart += '<cell>' + Field("2015 Corn 1 Year Sign Up"); chart += '<cell>' Notice that since you don't have a "2016 Corn 1 Year Sign Up" field, I added a blank cell to the end in order to keep the row even with the header row. The way I would do this is to create a function that you pass the "type" (Corn, Soy, etc) to minimize code and put it in the "Globals" section. That way it can be referenced from all of your rules: // Chart Function function Chart(type){ var data = [["1 Year"],["2 Year"],["InventoryPro"]]; var years = [2009,2010,2011,2012,2013,2014,2015,2016]; years.forEach( function(s){ for (var i=0; i<data.length; i++){ data[i].push(GetValue(s + " " + type + " " + data[i][0])); } }); var result = '<row type="header">'; result += '<cell><cell>' + years.join('<cell>'); data.map(function(s){return s.join('<cell>');}).forEach(function(s){ result += '<row><cell>' + s; }); return result; } // Helper Function function GetValue(field){ try { var field = new RegExp('^' + field,'i'); for(var i in FusionPro.Fields) { if(field.test(i)) return FusionPro.Fields[i]; } return '' } catch(e) { return ''; } } The 'years' array is used to create the header along the x-axis of the chart. The 'data' will hold the values of each row that corresponds to the name in position 0 of the array. The forEach method cycles through the values for the years and looks for fields matching the following format to push into their respective arrays: "Year Type Array-Title." For example "2009 Corn 1 Year" and since it's a regexp, it doesn't care about anything else that comes after the initial match. To call the function, just modify your chart rules to look like this: return Chart("Corn");
  18. While I'm not entirely sure what you're trying to accomplish, FusionPro does offer a product called "Expressions" which does personalized image design. I haven't used it but it seems like the type of application that could handle skewing variable text and would tie in nicely with your existing copy of FP.
  19. Can you post an example of what you're trying to achieve? It's hard to tell if you actually need to use an overflow page from your description. If you're just importing pages of a PDF, you could just have one "Body" page template with graphic frames that you apply your rules to and you'd just repeat the record by the number of pages in your PDF resource (24 or 28 times). As a matter of fact, you could do it all from the OnRecordStart callback rule: var pdf = CreateResource('/path/to/Your.pdf','graphic'); var graphicFrame = "Your_Graphic_Frame"; FusionPro.Composition.repeatRecordCount = pdf.countPages; pdf.pagenumber = FusionPro.Composition.repeatRecordNumber; FindGraphicFrame(graphic).SetContents(pdf); Again, it's hard to say without a better understanding of what you're trying to accomplish so I apologize if that response is left-of-mark.
  20. If you collect your template (FusionPro > Collect) you'll see the cfg file get created from the output settings at the time of collection. You can't change the file type with a JavaScript rule but you can change the output folder path. For example: if you want your PDF files to output to a different folder than your PPML files, you could create an OnNewOutputFile callback rule that looked like this: var outputPath = '/path/to/PPML/outputFolder/'; if (FusionPro.Composition.JobOptions['OutputFormat'] == "PDF"){ outputPath = '/path/to/PDF/outputFolder/'; } FusionPro.Composition.outputFileFullPathName = outputPath;
  21. It depends on what kind of settings you want to be variable. If they are settings in the CFG file (imposition, cropmarks, output format, etc) then the short answer is "no." The CFG file is read-only so you could set up some JavaScript rules to key off of their values and do different things depending on their current settings but you are not able to alter these settings since they are generated based on the output settings dialog at the start of each composition. But if you wanted to turn on page 1 if the job is imposed and page 2 if there's no imposition, you could do something like this: // OnRecordStart Callback rule var pg = (FusionPro.Composition.JobOptions["UseImpositionDefFile"] == "Yes") ? 1 : 2; FusionPro.Composition.SetBodyPageUsage(pg,true); That being said, with FPServer you'd have the capability to have multiple cfg files (one for imposed and one for unimposed for example) that you could specify on the command line: @echo off start cmd /C Call C:\Program Files (x86)\PTI\FusionPro\FusionPro "\\path\to\data.csv" "\\path\to\dif\[templatename].dif" "\\path\to\cfg\[templatename]_imposed-o.cfg" "\\path\to\output_imposed.pdf" start cmd /C Call C:\Program Files (x86)\PTI\FusionPro\FusionPro "\\path\to\data.csv" "\\path\to\dif\[templatename].dif" "\\path\to\cfg\[templatename]_unimposed-o.cfg" "\\path\to\output_unimposed.pdf"
  22. It has become painfully evident how badly I need to update the 'script in my glasses. Sorry about that!
  23. That would indeed be simpler but the script is doing a little bit more than dumping a list of PDFs into a text file. It is taking into consideration sub-folders within the root graphics directory containing PDFs and building a two column data file: This could be written as a one-liner but, at the time, I thought having the .sh file would be more helpful and easier to re-use (if needed). But in hindsight, knowing about the executable issues, an argument could be made against how "easy" it actually turned out to be. ls -l *.pdf will only return PDF files in the directory that you cd'd into and the -l option will output a bunch of unnecessary information that will be output. I think you'd have to do something like this: cd to the folder containing the PDFs and subfolders echo "title,pdfs" > ~/Desktop/data.csv && find $PWD -type f -name "*.pdf" | sed -E 's/(.*)\/(.*)\//\2,\1\//' >> ~/Desktop/data.csv
  24. What text editor did you use, KayEll? It could be a permissions issue and you'll need to make that file executable (from Terminal): chmod +x ~/Desktop/generateData.sh If that doesn't work, just replace steps 2,3 and 4 by opening Terminal.app, pasting the below code into it, pressing Enter, and go to step 5. cat<<'EOF' > ~/Desktop/generateData.sh && sh ~/Desktop/generateData.sh #!/bin/bash echo "\n\n****\n* Drag and drop the folder containing the subfolders of your graphics\n* And press Enter\n****\n\n" read pathToPDFs dataFile=~/Desktop/data.csv echo "title,pdfs" > $dataFile IFS=$'\n' pdfs=`find $pathToPDFs -type f -name "*.pdf"`; for i in $pdfs; do subFolder=`echo $(dirname "$i")`; echo "\"${subFolder/*\//}\",\"$i\"" >> $dataFile done EOF
  25. So you have a template that contains 3 body pages and you want each the record number to print on each of the body pages? Just put a text frame on each page that returns the "«$inputrecordnumber»" variable. If you need the record number padded to four digits, create a rule (below) and place it in your 3 text boxes. return FormatNumber("0000", FusionPro.Composition.inputRecordNumber); FusionPro has a lot of built in variables, objects, and functions that make accessing this sort of information possible and you can learn more about their use through the "building blocks" pallet. In the "Rule Editor," select "Show Building Blocks" in the bottom left corner of the window. The "functions" and "objects" tabs at the top of that window will display a categorized list of built-in functionality that FusionPro has. For example: Objects > FusionPro (Global) > Composition will list properties of the FusionPro.Composition object. Drilling down further, you can access the inputRecordNumber: Objects > FusionPro (Global) > Composition > Record numbers and control > inputRecordNumber will give you a description of the property (below) and give you the option of inserting it into your rule editor (by double-clicking or clicking the "insert" button). Thumbing through those building blocks will give you an idea of other properties to use to adjust the rule to better fit your template. For example: if you're skipping records based on your data, you should probably use "FusionPro.Composition.outputRecordNumber" instead of "FusionPro.Composition.inputRecordNumber" to keep the numbering sequential. Objects > FusionPro (Global) > Composition > Record numbers and control > outputRecordNumber
×
×
  • Create New...