Jump to content

Dan Korn

Members
  • Posts

    4,884
  • Joined

  • Days Won

    17

Posts posted by Dan Korn

  1. Sure, you can remove empty items and just put spaces between what's left.  There are a lot of ways you can do this, probably the most succinct is:

    var s = [Field("Name"), Field("Title"), Field("Company")].filter(String).join(' ');

    If you want the company on another line, sure, you can conditionally put out either a <p> or <br> tag if the Company field is not empty, though you have to make sure that you don't put the tag in before calling TaggedFromRaw.  The best way to do that is to call the TaggedDataField function, something like this:
     

    var s = [TaggedDataField("Name"), TaggedDataField("Title")].filter(String).join(' ');
    if (Field("Company"))
        s += "<br>" + TaggedDataField("Company");

    Or like this:

    var s = [[TaggedDataField("Name"), TaggedDataField("Title")].filter(String).join(' '), TaggedDataField("Company")].filter(String).join('<br>');

     

  2. FusionPro does support Unicode, such as Japanese, but not color emoji characters.  You can use an inline graphic instead in your FP template.  Add a resource with a picture of a balloon (or a smiley face, or whatever other emoji picture you want), then make a Graphic rule to return the resource, and insert that rule into the Text Editor.

    Now, when you mention, "the form," I assume you're talking about the web form in Marcom Portal.  That probably should not allow emojis.  I would ask your Marcom support representative about that.

  3. 7 minutes ago, IceisforHockey said:

    Is the original font (for all the lowercase characters) set in the text editor in the PDF?

    meaning I want all characters to be arial except for the capital letters to be in Helvetica.

    Yes, any character that's not modified by the rule to be in a particular font and size will be in whatever font the text is in nominally, i.e. whatever font and point size was set for the rule in the Text Editor.

    If you want to specify both fonts in the rule instead, then you can just put another font tag in front of everything, like so:
     

    var s = "Mr. and Mrs. John Doe and Family";
    return '<f name="Arial">' + TaggedFromRaw(s).replace(/[A-Z]/g, '<span font="Helvetica" pointsize=20>$&</span>');

    If you want the point size of the capital letters to be a multiple of the original point size, rather than hard-coded to something like 20 points, then you can do this:

    var s = "Mr. and Mrs. John Doe and Family";
    return '<f name="Arial">' + TaggedFromRaw(s).replace(/[A-Z]/g, '<span font="Helvetica"><magnify factor=200>$&</magnify></span>');
  4. Your description of the job is good, but this is still a bit tough to figure out in the abstract.  Some files might be helpful to visualize what you want.

    The most straightforward way to do something like this is probably just to add all the various pages from the multiple PDFs into a single master template, as Unused Body Pages, and use FusionPro.Composition.SetBodyPageUsage in OnRecordStart to pull the pages you want per-record.

    That said, there is a new feature as of FusionPro VDP 13.0 that lets you bring in pages from other FP templates, with their variable frames, into a job, as repeatable components.  This is done by exporting the DIF files from the "foreign" templates, then you can pass the name of each DIF file, and a page number, to the FPRepeatableComponent object, to bring in the page, with its variable frames, into the main job as an inline repeatable component, in a text frame in the master job, overflowing that text frame to Overflow pages, as in the standard multi-page PDF resource example.  I might be able to provide an example of this; I have to check whether the one that we did for another customer can be shared.

  5. 52 minutes ago, aparkssiskfs.com said:

    Thank you Dan, that worked just how I needed it to.  One thing I did wrong, I was using OnRecordStart not OnJobStart - that makes a difference apparently (not sure why).

    If you think about it, the total number of records doesn't change per-record, it's a job-level thing.  And it has to be calculated ahead of time, in a preprocessing step, and you obviously have to tell FusionPro to do that preprocessing at the start of the whole job.  FusionPro doesn't do preprocessing by default, as there is a bit of a time cost to it, but in cases like this, there's no other way to know for sure how many records will be composed.

    1 hour ago, aparkssiskfs.com said:

    I somewhat knew that some things validate during the composition but I didn't know that any property containing FusionPro.Composition happens during composing only.

    Some things can be examined and calculated at rule validation time, in the Rule Editor, like the values of fields, but other things have no context outside of a composition, like activating pages.  The Validate button in the editor is for convenience, to help in the development and debugging of rules, but ultimately, the composed output is what matters.

    1 hour ago, aparkssiskfs.com said:

    I'm slowly learning FP, I have been teaching myself. Thanks for the help, I appreciate it.

    Sure, glad to help.  You're part of a great community here.

    • Like 1
  6. 6 minutes ago, aparkssiskfs.com said:

    I did what you said but it gives me 1 of 0. Not the quantity of the file? I will try again in the morning when I get back into the office but do you have any suggestions on what im missing? 

    When I validate the expression, it says, 1 of undefined

    Any property of FusionPro.Composition is going to be valid at composition time, but not at rule validation time.  Compose the job and the output should be correct.

    • Like 1
  7. 1 hour ago, hopkinsprinting said:

    Will an M1 native version of FusionPro release this year?

    This year just started.  There's no official roadmap date for this, but I would say that Yes, I would expect it to be sometime in the next 12 months.

  8. If you want the true number of total records, you can either use the $outputrecordnumber and $totalrecordcount variables in the Text Editor, or create a rule like so:

    return FusionPro.Composition.outputRecordNumber + " of " + FusionPro.Composition.totalRecordCount;

    But either way, you need to set the job to do preprocessing to determine the total number of record, in OnJobStart, like so:

    FusionPro.Composition.forcePreprocessing = true;
  9. 9 hours ago, olllllllo said:

    Changing the stack to "2" from "1" fixes the problem in FP 13.1.2.

    Thank you for that confirmation.

    9 hours ago, dbarbee said:

    I tried the workaround, and it didn't resolve the issue. Any other suggestions? Or should I downgrade to a previous version?

    Hmm, it worked for olllllllo.  Are you sure you're referencing the FPI file that you changed?  If so, please collect and post a job that reproduces the problem.

    A patch build is in the works and we hope to make it available soon.  Apologies for the trouble.

  10. Okay, thank you for attaching that job.  It was very helpful to me in identifying the problem.

    It's an issue when Infinite Stack is set AND the Stack Count is set to 1.  So the workaround is to set the Stack Count to anything other than 1, and Infinite Stack will work again.

    This will be fixed in an upcoming release.

  11. 47 minutes ago, hopkinsprinting said:

    Is 13.1 now M1 native or does it still require Rosetta to run?

    The 13.1.2 FusionPro app and the Acrobat plug-in on Mac are still Intel executables, and require Rosetta to run on newer Silicon (M1 and M2) chip Macs.

  12. 2 minutes ago, dbarbee said:

    We are also experiencing this issue where it is not honoring the "Infinite Stack" as the Primary Imposition Step. I am running Acrobat Pro Version 2023.006.20380 on Mac OS 12.7.2. We were previously using the latest version of FusionPro without issue, which I think was 13.0.4.

    Is there any progress on a resolution? Are you able to duplicate the error, or do you need assistance?

    No, so far we have not had enough details about the problem to analyze it, nor a job which reproduces the issue.

    Is it an issue with the FP Imposer program?  That is, is it that saving a new FPI file doesn't have the "Infinite Stack" set correctly?  Or is it a composition issue, where if you take an existing FPI file, it doesn't compose correctly?

  13. Nothing was caught in our regression testing, which includes stacked imposition jobs.

    Can you please post a sample job which reproduces the problem, and a clear explanation of what the expected output is, and how it's different than the actual output?  Also, in what previous version of FusionPro did this work differently?

  14. You can't have a set height for table rows.  The whole idea is that cells will expand as necessary to accommodate their contents, and that each row will expand to accommodate the largest cell in the row.

    But you can specify a minimum row height, with the minHeight property, and, as long as none of the cells have so much data that they need a larger height, every row will be that minimum size.

    You would do this not in the Table Style rule that you show converted to JavaScript, but in the Table rule itself.  Better yet, don't convert either of those rules to JavaScript.  Instead, create a new JavaScript rule to post-process the table, like so:

    var table = Rule("Table - from data rule: Your Data"); // <- your table rule name here
    
    for (var r in table.Rows)
        table.Rows[r].minHeight = HundredthsOfPointsFromText("1 in");
    
    return table;

    Make sure this rule has the "Re-evaluate this rule for every text flow" and "Treat returned values as tagged text" boxes checked.  Then use this new rule in the output.

    Also, note that a whole new table UI, with support for minimum height, without having to write any code at all, is in the works for a future version of FusionPro.

    All that said, I do wonder if a table is the best approach to the job as described, "for a sheet of labels."  To me, that description suggests you want to create an imposition job, where the page in your FusionPro template is simply the 2.625x1 inch size, and you create an imposition template (an FPI file) with the FP Imposer tool to output these pages of labels onto imposed sheets.  Then you don't need a table or any code or rule to lay them out; the imposition system does it all for you, based on the settings in the FPI file.

    • Like 1
  15. So, two separate questions here.  For the European numbers, I would create the Choose Phone Format rule so that it returns the number with dashes (format 123-456-7890), then create another rule, a JavaScript rule this time, and have it replace the first dash with a space, like so:

    return Rule("Choose Phone Format: Phone").replace('-', ' ');

    And use the JavaScript rule in the output.  Note that the main Form rule does NOT have to be converted to JavaScript.  The other rule can do the work to tweak the result.

    The country codes are another story.  The current logic behind the Choose Phone Format rule doesn't support multi-digit country codes, nor those variations in the following digits.  It's not really designed for international numbers like that.  I would assume that such numbers are presented in the correct format in the first place in the data, and that trying to reformat them would possibly be destructive, but you seem to know more about these formats than I do.  You could trying Googling for something like "JavaScript format phone number with country code" to see what others have come up with.

  16. Okay, so based on that additional information, there are several ways you can accomplish this.

    Method 1: Create a series of Unused Body Pages, with names such as "Header 1", "Header 2", etc.  Then in the OnRecordStart rule, you can call FusionPro.Composition.SetBodyPageUsage to activate the pages as needed.  I can't tell you exactly what the code should be without seeing your job files, or at least the data, but it would be something like this:

    for (var i = 1; i <= 8; i++)
    	FusionPro.Composition.SetBodyPageUsage("Header " + i, Trim(Field("Header Data " + i)) != "");

    Please refer to the sections "How to switch body pages during composition" in both the User Guide and the Rules Guide for more information, or search this forum for "SetBodyPageUsage" for lots of other examples.

    Method 2: If the job contains only these "Header" pages, and nothing else, you can accomplish this with a single page job, with a single text frame, and some code in OnRecordStart.  Again, not having your data file, I have to guess a bit at your field names, but it would be something like:

    var HeaderData = [];
    for (var i = 1; i <= 8; i++)
        HeaderData.push(Trim(Field("Header Data " + i)));
    
    HeaderData = HeaderData.filter(String); // remove empty items
    
    FusionPro.Composition.repeatRecordCount = HeaderData.length;
    FusionPro.Composition.AddVariable("Header", HeaderData[FusionPro.Composition.repeatRecordNumber - 1], FusionPro.inputTreatFlatDataAsTagged);

    Then you can go to the Text Frame, edit the text, and in the Variable Text Editor dialog, type "Header" (without quotes) into the Variable box, and click Insert.

    Method 3: Use a Repeatable Component with the text frame in it, and insert instances of the Repeatable Component for populated data fields into a Body page text frame, which overflows to an Overflow page.  This is a bit more complex; I can provide more information if you want to go this route.
     

     

×
×
  • Create New...