Jump to content

Dan Korn

Members
  • Posts

    4,884
  • Joined

  • Days Won

    17

Everything posted by Dan Korn

  1. Assuming that the blocks of text are in two Formatted Text resources named "English Address Block" and "French Address Block", and that your text frame is named "Address", this should work: // These should match your resource and frame names, and width requirements: var textFirstColumn = Resource("English Address Block").content; var textSecondColumn = Resource("French Address Block").content; var targetFrameName = "Address"; var maxColumnWidthInches = 2.5; var GutterWidthInches = 0.2; // Don't edit below here! if (FusionPro.inValidation) textFirstColumn = "This only works in composition."; var FrameWidth = FindTextFrame(targetFrameName).GetSettableTextWidth(); var tm = new FusionProTextMeasure; tm.CalculateTextExtent(textFirstColumn); if (tm.messages) ReportError("Text Measurement error: " + tm.messages); var FirstColumnWidth = Math.min(tm.textWidth, maxColumnWidthInches * 7200); var GutterWidth = GutterWidthInches * 7200; var table = new FPTable; table.AddColumns(FirstColumnWidth, GutterWidth, FrameWidth - GutterWidth - FirstColumnWidth); table.AddRows(1); //table.Rows[0].Cells[0].SetBorders("Thin", "Black", "Top", "Bottom", "Left", "Right"); var CellMargins = new FPTableMargins; CellMargins.Top = 0; CellMargins.Bottom = 0; CellMargins.Left = 0; CellMargins.Right = 0; table.Rows[0].Cells[0].Content = textFirstColumn; table.Rows[0].Cells[0].Margins = CellMargins; table.Rows[0].Cells[2].Content = textSecondColumn; table.Rows[0].Cells[2].Margins = CellMargins; return table.MakeTags();
  2. If you want to hide the entire text frame, just do this in OnRecordStart: FindTextFrame("YourTextFrameName").suppress = true;Or, if you only want to suppress some specific text, put it in a Formatted Text Resource and apply any formatting you want to it, then have a rule (either JavaScript, Switch Wizard, or Drag-and-Drop Wizard) which conditionally returns either that resource or an empty string. Of course, you can always apply the formatting through tags as well, something like this: return '<f name="Arial"><z newsize=20><color name="Red">This is what is in my text frame';You can also apply formatting in the Drag-and-Drop Rule Wizard. So there are lots of ways to accomplish this; you can pick whichever one is right for you.
  3. If it's not returning anything, then you don't have the path right. If it's got any backslashes, try using forward slashes instead.
  4. Maybe you could use a variation on the multi-page PDF resource strategy. The template PDF would just be a body page and an overflow page like in the example, and then you could save the InDesign file to PDF and use that PDF as a resource, and bring in the number of copies of each page that you want. I'm still not sure how you determine exactly how many copies of each page you want to print, but you can add the code to repeat each page the desired number of times inside the loop which accesses each page like so: for (var pageLoop = 1; pageLoop <= pagesInPDF; pageLoop++) { for (var i = 1; i <= Int(Field("count"+i)); i++) { markupToReturn += '<graphic file="' + PDFresourceRef.name + '" pagenumber = "' + pageLoop + '" position="afterline"/><P>'; } }
  5. Sorry, I think I'm still not quite understanding what you're asking (or you're not understanding what I'm asking, or both). You shouldn't really need any kind of "rule" at all to do sequential numbering. You can just insert the $inputrecordnumber variable in a text frame and set the desired record range on the Input tab of the Composition Settings dialog. But maybe I'm missing something else. If you're exporting from InDesign, you can export over an existing FusionPro PDF template and all of your variable frames and rules will be preserved. Not sure if that helps or not, though.
  6. So what determines how many of each ticket should get printed? Where do you tell it, "I want 65 of this one?"
  7. I'm not sure I understand. Do the numbers always go in the same place on each ticket, with the background art changing? If so, I would just start with an empty page with a graphic frame and a text frame or two for the numbers. Or are you asking how to set up a non-sequential series of ticket numbers?
  8. Sorry, this seems to be a documentation oversight. The parameters to CopyfitLine, in order, are: staticPart - text to not be resized dynamicPart - text to be resized (after staticPart) font - font family name size - base point size (in points) width - width of the frame or column (in points) minimum - minimum point size (in points) adjustWidthOnly - true/false (optional - see below) For the "adjustWidthOnly" parameter, if you leave it off (or specify false), the function will adjust the point size, that is, both the width and height, of the glyphs. If you specify true, the function will adjust only the set width of the glyphs, but not the height, which basically means they will look squished horizontally. In FusionPro 6.0 and newer, you can use the FindTextFrame and GetSettableTextWidth functions to automatically get the frame width instead of hard-coding it. You mean this? http://forums.printable.com/showthread.php?p=190#post190 I'm not sure what you mean. Both functions are doing the exact same "text" kind of copyfitting by default (unless you specify true for the last optional parameter to CopyfitLine). You're close. The first parameter ("") is the static part not to be resized; it's perfectly valid (and common) to specify an empty string here to resize the entire line. The last parameter (false) means that it should to a regular "text" copyfit; that can be left off and you'll get the same result.
  9. Yes, this could be done with some changes to the sample template. Instead of simply adding the <graphic> tags to the markup for the overflow pages, you could use an FPRepeatableComponent to call out a Template Page, which could have multiple frames on it: one Graphic frame to hold the page, and one Text frame to show your kit number, which you would only set on the last page of each PDF (when pageLoop == pagesInPDF in the rule). I don't have the time to actually set this up right now, but maybe someone else can pick up the ball and run with it.
  10. That will work, but if you ever need to change anything like the field name, then you'll have to make 50-plus modifications to the rule. This kind of thing is exactly what the switch statement was made for, so that you can reduce all those chained "if" statements to something like this: switch (Field("state").toUpperCase()) { case "AL": return "Alabama"; case "AK": return "Alaska"; // etc... default: return Field("state"); } Although I'd use a solution that's basically the converse of this: http://forums.printable.com/showthread.php?p=5587#post5587 var StateNamesFromAbbreviations = { "AL": "Alabama", "AK": "Alaska", "AZ": "Arizona", "AR": "Arkansas", "CA": "California", "CO": "Colorado", "CT": "Connecticut", "DE": "Delaware", "DC": "District of Columbia", "FL": "Florida", "GA": "Georgia", "HI": "Hawaii", "ID": "Idaho", "IL": "Illinois", "IN": "Indiana", "IA": "Iowa", "KS": "Kansas", "KY": "Kentucky", "LA": "Louisiana", "ME": "Maine", "MD": "Maryland", "MA": "Massachusetts", "MI": "Michigan", "MN": "Minnesota", "MS": "Mississippi", "MO": "Missouri", "MT": "Montana", "NE": "Nebraska", "NV": "Nevada", "NH": "New Hamspire", "NJ": "New Jersey", "NM": "New Mexico", "NY": "New York", "NC": "North Carolina", "ND": "North Dakota", "OH": "Ohio", "OK": "Oklahoma", "OR": "Oregon", "PA": "Pennsylvania", "RI": "Rhode Island", "SC": "South Carolina", "SD": "South Dakota", "TN": "Tennessee", "TX": "Texas", "UT": "Utah", "VT": "Vermont", "VA": "Virginia", "WA": "Washington", "WV": "West Virginia", "WI": "Wisconsin", "WY": "Wyoming", }; return StateNamesFromAbbreviations[ToUpper(Field("State"))] || Field("State"); Sorry, I don't know what you mean. Specifically what testing are you doing?
  11. FusionPro uses the Trim Box of the page, not the Crop Box, as the basis of the output page size. Any Bleed specified on the Imposition tab of the Composition Settings dialog will be added to that base page size to determine the final output page dimensions.
  12. Here's a more generalized solution: var EntriesWithLabels = [ "Tel", Field("Phone"), "Mobile", Field("Mobile"), "Fax", Field("Fax"), ]; var resultArray = new Array; for (var i = 0; i < EntriesWithLabels.length; i += 2) if (EntriesWithLabels[i] && EntriesWithLabels[i+1]) resultArray.push(EntriesWithLabels[i] + ": " + EntriesWithLabels[i+1]); return resultArray.join(", ");You can simply add or remove pairs of labels and data fields at the top. The Array.join method takes care of the problem of putting the delimiter (the comma and space in this case) only between items, and not "dangling" at the beginning or end. If each entry is on its own line, then you don't need any JavaScript at all to accomplish this. You can do it all in the Variable Text Editor. Simply type the label and then insert the variable for the data field you want, then click "Paragraph" and check the box for "Suppress if Empty", then change the drop-down box to "Containing Empty Variables". You can see this in the Cell Phone tutorial, in the address box in the middle of the first page, for the "Add2" line.
  13. It's hard to tell what's going on without seeing the job. You might want to check (or uncheck) the "Use legacy line leading" box on the Global Paragraph Settings dialog and see if that makes a difference.
  14. Dan Korn

    FP Imposer

    Click on "Layout," then click the "Advanced" button and in the first drop-down list (Ordering, Horizontal), select "Right to Left." You may also need to right-click on the picture of the two pages and select "Rotate Row 180 Degrees" from the pop-up menu. No, I don't think you want that. They're still two different pages. No, it hasn't changed for several releases.
  15. 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.
  16. Whenever you're having a problem like this, it helps to do a very basic bit of debugging. If you simply add a line like this to your rule: Print(pathToAllPDFs);And then do a composition and look in the log (.msg) file, it should become immediately obvious what the problem is. Or you can just add this line temporarily while you're in the Rule Editor and click Validate: return pathToAllPDFs;I'll bet that it returns this: [noparse]"C:Documents and SettingsehigginbothamDesktopInsert PDF Graphics InlineDocs:".[/noparse] So that's obviously not right. Why do all the backslashes get removed? Because the backslash is a special character in string literals in JavaScript: https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide/Values%2c_Variables%2c_and_Literals#Escaping_Characters You can work around this in several ways, which I'll present in order from least to most recommended: As in the sample, double up all backslashes to "escape" them, that is, to let the JavaScript interpreter know that they're literal backslash characters and not modifiers for the characters following them, like so:pathToAllPDFs = 'C:\\Documents and Settings\\ehigginbotham\\Desktop\\Insert PDF Graphics Inline\\Docs\\'; Replace the backslashes with forward slashes, like so:pathToAllPDFs = 'C:/Documents and Settings/ehigginbotham/Desktop/Insert PDF Graphics Inline/Docs/';All modern versions of Windows allow forward slashes in place of back slashes in file paths. (The only exception is at the beginning of a UNC path such as "\\server\share\filename".) Don't specify a path in the JavaScript code at all, and specify a Search Path for the job instead. Change the line in the rule to this:pathToAllPDFs = "";And then go into the Composition Settings dialog, on the Advanced tab, and enter the path in its normal format (with single backslashes, or you can use forward slashes) in the Search Path box. The call to CreateResource will automatically look for the graphics along the specified Search Path. This is much more forgiving than doing it in code because you don't have to worry about the trailing slash, and if you have multiple rules and change the location of your graphic resources, or run the job on a different machine, you can simply change the single search path setting for the job. You can also include multiple search path locations by delimiting them with semicolons and all those paths will be searched.
  17. This isn't what FusionPro means by a "widow." FusionPro's definition of a "widow" is a line or two of text flowed from a previous column or frame, not a word or two that happens to be the last line of a paragraph in a single frame. However, you can use this code to prevent the last word from being on a line by itself: return TaggedTextFromRaw(Field("YOUR FIELD NAME")).replace(/(.*)(\s)(.+)$/, "$1 $3");And you need to check the "Treat returned strings as tagged text" box.
  18. Named paragraph styles are exported from QuarkXPress and InDesign. They can also be modified using the DIF Control API in FusionPro Server jobs. This dictionary of paragraph styles is not directly accessible in FusionPro Desktop, except via <p> tags to invoke the styles as noted.
  19. Something like this might be what you're looking for: return Field("YourFieldName").replace(/((?:TM)|[©®])/g,"<superscript>$&</superscript>");Sorry, I don't have the time or space here to fully break down this code and explain it. Regular expressions are an advanced topic, so I recommend you don't go modifying examples of other code unless you really understand what you're doing. But they can be a very powerful tool. Another caveat: be careful of your encodings. These kinds of symbols are generally encoded differently on Windows and Mac, so if you're moving your job between platforms, especially if the symbols are in your input file, you may have issues. You can generally alleviate these by explicitly setting the input file's encoding in the Data Source Wizard.
  20. Remember that FusionPro Desktop is intended primarily as a design tool for building FusionPro jobs (templates), not really as an end publishing tool. While you can certainly compose your job in FP Desktop, the real power of FusionPro is in its batch (automated) composition capabilities. This batch capability is available in FusionPro Server and FusionPro Direct, in our Web-to-Print solution MarcomCentral, and in many other third-party Web-to-Print solutions which integrate FusionPro behind the scenes. In most of these environments, FusionPro Server is running as a batch process, often on a dedicated, remote server machine, with no GUI context for displaying a dialog to an end user at composition time. Also, while FusionPro does leverage the standard JavaScript 1.5 library, which has its roots in the Netscape/Mozilla Firefox browser and was originally designed for client-side web page scripting, only the core language elements are integrated with FusionPro, and web-specific objects and functions such as window and alert which you might see in online examples of web-specific JavaScript code are not relevant to FusionPro rules. Your "input" in a FusionPro rule is (primarily) the data file, not a web form, and your "output" is, well, your output, not a web page. (However, in addition to returning things that go into text and graphic frames in your composed output, you can also use functions such as Print in FusionPro rules to write to your log file.) So, if you want a context for an end user to be able to enter data in a text box of some kind, either in a desktop or a web application, you will need to create the app and integrate FusionPro Server. In FP Desktop, you will have to manually change either a file from which FusionPro is reading data, or something hard-coded in the job (in a rule or text frame) before composing. Doug's solution is a good one.
  21. It seems to me that the value of PrintVersions.length is either going to be true or false, so you should be able to just key off of that, by doing this at the end of the rule: FusionPro.Composition.SetBodyPageUsage("YourPageName", PrintVersions.length % 2);The modulus 2 (% 2) operator will return either 1 (true) or 0 (false) depending on whether the value of the first operand is odd or even.
  22. Inline graphics, by definition, flow with the text. So, you can't wrap text around an inline graphic. If you want to wrap around a graphic, then the graphic needs to go in its own (graphic) frame.
  23. What determines how many pages are included before the page in question? In other words, the answer to how to control whether to include your page depends on how the other pages are being added. If you're using Overflow pages, you can control how the last page is inserted in the Overflow Options dialog, by setting "Add pages" to "So Last Added Page Is Odd." If you're doing something like inserting pages from an external PDF as in this thread, you will have to key off of the page counter variable in your rule.
  24. 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: pathToPDF = pathToAllPDFs + PDFfileName;It properly builds the path with the last separator. Otherwise, it's going to build a path such as: [noparse]'Macintosh HD:Users:kay:Desktop:Avalanche_tests:Insert PDF Graphics Inline:DocsMyGraphicName[/noparse]', which is surely wrong (it should be something like: [noparse]'Macintosh HD:Users:kay:Desktop:Avalanche_tests:Insert PDF Graphics Inline:Docs[/noparse]:MyGraphicName' - note the difference that last colon makes). So, I would try adding a single colon at the end of the path specification: [noparse]'Macintosh HD:Users:kay:Desktop:Avalanche_tests:Insert PDF Graphics Inline:Docs[/noparse]:' 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.
  25. In a graphic rule: return CreateResource(Field("YourFieldName") + ".jpg");In a text rule: return CreateResource(Field("YourFieldName") + ".jpg", "graphic").content;
×
×
  • Create New...