Jump to content

JeremyT

Registered Users - Approved
  • Posts

    88
  • Joined

Posts posted by JeremyT

  1. I am trying to get FusionPro on the Mac to create a new folder to place output PDFs in.

     

    I've used a similar set up with FusionPro on a PC and FusionPro will create a new folder to output into.

     

    Here is what I have in OnRecordStart

     

    var BranchNumberFormatted = FormatNumber('000', Field("BR #"));
    
    
    FusionPro.Composition.outputFileFullPathName = "//Volumes/PCCustomers/A/Branch Files/" + BranchNumberFormatted + "/" + outputName;
    

    In the job I have a new branch #581. I would like FusionPro to create a folder named "581" in the "Branch Files" folder.

     

    Any suggestions?

     

    Thanks.

  2. New year, additional job requirements.

     

    So this job is for making calendar imprints. Most branches have a single address, but some have multiple addresses. FusionPro looks at my data file and chooses which template page to use depending on how many addresses. Then outputs a pdf for that branch that is labelled and put in a folder. This part of the job is for proofing, it is a smaller page size that shows the imprint in the imprint area.

     

    I need to have another page that is the "imposed" part. It takes the smaller page size pdf created above and positions it on a larger page. I need to have this be its own pdf when completed.

     

    So I need to get 2 pdfs out of this job.

    1. a smaller page size for proofing

    2. a larger page size for printing.

     

     

    What do I need to add to get the imposed pdf?

     

    Code in OnRecord Start.

    addresses = []; // Global array of addresses
    var pg = 0; // Count of pages
    
    for (var i in FusionPro.Fields) {
       var key = Int(addressMap.FindRecord('BR #', Field(i)));
       if (/IB\d+/.test(i) && (key+1))
           addresses[pg++] = key;
    }
    
    FusionPro.Composition.composeThisRecord = !!pg;
    FusionPro.Composition.SetBodyPageUsage(pg + "Address", true);

    Code in OnNewOutputFile

    var outputName = Field("Branchkey") + "-AB Imprint 2017." + FusionPro.Composition.outputFormatExtension;
    FusionPro.Composition.outputFileFullPathName = "//Volumes/Imprints/" + outputName;
    Print("Changing to output file: " + outputName);}

  3. I am trying to get Copyfit and prevent widows on a variable data text box that is a maximum of 2 lines.

     

    I have a rule written that prevents a single word from ending up on the second line of a text box.

     

    [font=Calibri,sans-serif][size=2][color=black]return TaggedTextFromRaw(Field("CU Name")).replace(/(.*)(\s)(.+)$/, "$1 $3");
    [/color][/size][/font]

     

    I turn CopyFit on the text box to automatically reduce text to fit in the box on 2 lines.

     

    How do I get CopyFit to work while preventing the second line from having only 1 word?

  4. What is the format of the cell in Excel? In other words, if you select the cell in Excel, right-click, and select "Format Cells", then on the the "Number" tab, what does it say in the "Category" list? And if that's set to "Date", what does it say in the "Type" list?

     

    In a test spreadsheet here, if the Category is set to "Date" and the Type is set to "*3/14/2001" (the first one in the list), then FusionPro reads the date in that format. If you have the Category or Type set to something else, though, it may not be interpreted correctly.

     

    Can you attach your Excel file, or at least enough of it to demonstrate the issue?

     

    Dan,

     

    Format Category of the cell is "Custom". Type is "[$-10409]mm/dd/yyy"

     

    I've attached a screen shot.

     

    If I change the format in Excel to "Date", type "3/14/01", it shows up as 42424 in FusionPro for 02/24/16.

     

    Thanks.

    ScreenShot2016-02-29at2_11_44PM.jpg.9bf369959446c1e16ee6f864dd27d713.jpg

  5. I added the code that Step suggested and got the date formatted correctly.

     

    Thanks!

     

    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");
    

  6. Except for choosing correct font for each field, I was able to get this table set up correctly using the following code:

     

    var sq = CreateResource('Yellow Square.pdf','graphic'); // Square graphic
    var r = [
    [Field("0EmailHeading"), Field("0EmailBody")],
    [Field("0WeblinkHeading"), Field("0WeblinkBody")], 
    [Field("0AllMailHeading"), Field("0AllMailBody")],
    [Field("0POSHeading"), Field("0POSBody")], 
    [Field("0OnsiteOppHeading"), Field("0OnsiteOppBody")], 
    [Field("0LDPAutoHeading"), Field("0LDPAutoBody")], 
    [Field("0COMHeading"), Field("0COMBody")],
    [Field("0StateNatHeading"), Field("0StateNatBody")]
    ]; // Array to hold paragraphs
    
    
    // Filter out empty paragraphs and splice the first 4
    r = r.filter(function(s){ return s[0] && s[1];}).splice(0,4);
    
    var table = new FPTable();
    table.AddColumns(3500, 50400); // Set your column widths here
    for (var i in r) 
       table.AddRow().SetContents(sq.content, r[i].join('<br>'))
    
    return table.MakeTags();

    Thanks again for the help!

     

     

    Last question-how do I get Headlines a different font?

  7. I figured that was probably the case but you didn't offer up any of that information in your original email so i took a guess.

    Sorry about that, I wasn't sure how much information was needed.

     

    Just put them into the array:

    var r = [
    [Field('0EmailHeading'), Field('0EmailBody')],
    [Field('0WebHeading'), Field('0WebBody')],
    [Field('0POSHeading'), Field('0POSBody')]
    ];
    

     

    I've added the fields to the array.

     

    I deleted the line

        r.push([Field('Headline' + i), Field('Body' + i)]);
    

    because it gave me "Error: In Field(), no field named Headline1". And the fields were added to the array earlier.

     

    Then I get the error "TypeError: r.join is not a function" from this row:

        table.AddRow().SetContents(sq.content, r[i].join('<br>'));
    

    If I adjust to

        table.AddRow().SetContents(sq.content, [r].join('<br>'));
    

    the rule will validate.

     

    Once I preview I only get the boxes in the first column, nothing is produced in 2nd column.

     

    Also, I get 4 boxes when I should only have 2.

     

    Do the headline fields have to be added to a separate array than the body fields? Or what are the next steps?

     

    Thanks,

    Jeremy

  8. Step,

     

    Thanks again for your help!

     

    I was unsure of the best direction to go with this part of the job.

     

    Here's an example:

    var sq = CreateResource('./YellowSquare.pdf','graphic'); // Sqaure graphic
    var r = []; // Array to hold paragraphs
    
    // Populate array with 'Headline' and 'Body' fields
    for (var i=1; i<=8; i++)
       r.push([Field('Headline' + i), Field('Body' + i)]);
    
    // Filter out empty paragraphs and splice the first 4
    r = r.filter(function(s){ return s[0] && s[1];}).splice(0,4);
    
    var table = new FPTable();
    table.AddColumns(3600,14400); // Set your column widths here
    for (var i in r) 
       table.AddRow().SetContents(sq.content, r[i].join('<br>'));
    
    return table.MakeTags();
    

     

    Looking at the data further, the headline and body fields have different names for each paragraph. So, Headline1 and Body 1, etc won't work. These are the field names for the first 3 paragraphs: 0EmailHeading, 0EmailBody, 0WebHeading, 0WebBody, 0POSHeading, 0POSBody.

     

    How do I get all those different fields into the array?

     

    Thanks,

    Jeremy

  9. I am working on a job where I need to have only the first 4 populated paragraphs be used. There is a maximum total of 8 paragraphs. Each paragraphs is comprised of Headline text and Body text.

     

    For instance if I have 5 populated paragraphs I want only paragraphs 1-4.

     

    If I have paragraphs 1, 2, 6, 7, 8 I want paragraphs 1, 2, 6, 7 but not 8.

     

    Of course, some times paragraphs only 1, 2, 6 are populated.

     

    How do I set this up?

     

    To make this more difficult each field will have a yellow box in front of the paragraph.

     

    Can the yellow boxes and text be adjusted together? Or do I need separate rules for boxes and text?

     

    I am attaching an image that shows what I am looking to do.

    ScreenShot2016-01-16at2_22_33PM.jpg.fa1627712179fdaf581f784b47231c37.jpg

  10. Step,

     

    Thanks again for your help.

     

    I used the code you suggested and all works as needed on the Mac.

     

    I switch to a Windows 8 machine to compose so that the Helvetica font will embed.

     

    When I switch to Windows 8, I am having problems with Myriad Pro Italic font. I enter "MyriadPro-It" instead of "Helvetica" in the font measure function.

     

    It's not working correctly-column width is wider than longest line of text. In my very brief experience with measuring text width that means that I don't have the correct name in the code.

     

    I copied the font name from fonts.ini but that doesn't help either.

     

    How do I find the correct name for Myriad Pro Italic so that it composes correctly?

     

    Thanks,

    Jeremy

     

    Thanks,

    Jeremy

  11. If I understand correctly, you want each page of each record to be output to its own PDF and named accordingly? So you'd end up with 17 PDFs for record one named:

    "Record1_Page1.pdf"

    "Record1_Page2.pdf"

    etc...

    But, for proofing purposes you'd like all of the pages to be output to one PDF named:

    "Record1_proof.pdf"

    "Record2_proof.pdf"

     

    This is exactly what I wanted to do!

     

    If for some reason you want to output single pdfs and proofs every time you run the job, you can use this code instead:

    var pageNames = [
       'Page1',
       'Page2',
       'Page3',
       // .. etc ..
       'Page17'
    ];
    
    
    FusionPro.Composition.repeatRecordCount = pageNames.length + 1;
    page = pageNames[FusionPro.Composition.repeatRecordNumber-1] || 'proof';
    
    if (page == 'proof')
       for (var i in pageNames)
           FusionPro.Composition.SetBodyPageUsage(pageNames[i], true);
    else
       FusionPro.Composition.SetBodyPageUsage(page, true);
    
    FusionPro.Composition.OpenNewOutputFile('Record' + FusionPro.Composition.inputRecordNumber + '_' + page + '.' + FusionPro.Composition.outputFormatExtension);
    

    I used second set of code you posted.

     

    It's exactly what I needed!

     

    Thanks Step!

     

    Jeremy

  12. I am trying to adjust where the address is centered under a logo.

     

    The problem is that if either line of text is wider than the logo then I'd like to have the widest line start at the same x coordinate as the logo (left justified under logo). Then the shortest line would be centered under the widest line.

     

    I've attached a pdf of 3 examples. The top example shows what address block looks like centered under logo-all the text is narrower than logo.

     

    Middle example shows what I'd like to happen if the street address line is the longest.

     

    Bottom example shows what I'd like to happen if the city, state zip line is the longest.

     

     

    Is the best route to adjust this add a center tab and then adjust tab position based on text line width?

     

    Or, can I adjust the width of the text frame based on longest line of text?

     

    Thanks,

    Jeremy

    Jeremys Copy Shop.pdf

  13. I am working on a project where each record gets 17 output PDFs for production. The output PDFs are labeled by adding a name in the page usage dialog. This name is added to the individual PDF file name when output.

     

    I'd also like a PDF for each record with all 17 pages in it for proofing to the customer. Each record needs its own PDF proof.

     

    I am using OnNewOutputFile to output 17 pages in individual PDFs labeled with page name. I select each page to be unused in BodyPageUsage and then have OnNewOutputFile rule turn each page on when creating individual pdfs. "Ouput to Multiple files" is checking when composing.

     

    How do I additionally get 1 file with 17 pages still labeled individually for each record?

     

    Thanks,

    Jeremy

  14. Yes. You can do that a number of ways (Print, ReportError, etc) and they are all detailed on page 79 of the RuleSystemsGuide.pdf documentation (under the "FusionPro Functions" table heading).

     

    Here are some posts that relate to your question:

    http://forums.pti.com/showthread.php?t=33.

    http://forums.pti.com/showthread.php?t=3711.

    http://forums.pti.com/showthread.php?t=2885.

     

     

    I've worked with rules like the posts you suggested show.

     

    I am unfamiliar how those rules would work with an array.

  15. Merge works correctly now that I've got the code in the right spots.

     

    I adjusted the code for returning the addresses. I added a comma after City. I also added phone and fax numbers.

     

    key = addresses.shift();
    
    var address = ExternalField("Address");
    var CityComma =[ExternalField("City"),","].filter(String).join('');
    var CSZ = [CityComma,ExternalField("St"),ExternalField("Zip")].filter(String).join(' ');
    var phone = ExternalField("Phone");
    var fax = ["Fax:",ExternalField("Fax")].filter(String).join(' ');
    address = [address,CSZ,phone,fax].filter(String).join('<br>');
    return address || '';
    
    //==================================================
    // Short hand for returning the external data values
    //==================================================
    function ExternalField(name) {
      return addressMap.GetFieldValue(key,name);
    }

    Two minor adjustments:

     

    1. I had a couple of instances where the address was missing, so nothing was returned and the incorrect BodyPage was used.

     

    Can a line be added to the composition log saying that it was not able to find an address for a specific branch?

     

    2. Now that I've added phone and fax numbers, how do I suppress "Fax: " if a branch doesn't have a fax number?

     

    Thanks again for all your help!!

  16. Progress!

     

    I added a comma between City and State. I added Phone number. I added "Fax: " and the fax number.

     

    I put the "address" array into an OnRecordStart callback rule.

     

    It now pulls address and puts them into an array.

     

    Addresses are called from an array, but the SetBodyPageUsage isn't working correctly.

     

    I attached 341 Imprint 2015.pdf which has 12 address imprints.

     

    It puts Address 1 into text frame on 1Address page, then Address 2 and Address 3 go into text frames on 2Address page, then Address 4, Address 5, Address 6 go into text frames on 3Address page.

     

    Merge should put all 12 addresses on 12Address page.

     

    Thanks again!

    Imprints 2015.pdf

    341 Imprint 2015.pdf

  17. Step,

     

    Thank you for your help.

     

    I am still having trouble getting this to work. I followed your instructions and now I get 10 blank pages for each record when I compose.

     

    You are correct, IB## fields are the address fields. So, IB1 would be address Imprint 1, IB2 would be address Imprint 2, etc.

     

    Here is what I did:

     

    I put the following code into JavaScript Globals

     

    addresses = []; // Global array of addresses
    var pg = 0; // Count of pages
    
    for (var i in FusionPro.Fields) {
       if (/IB\d+/.test(i) && Field(i))
           addresses[pg++] = Field(i);
    }
    
    FusionPro.Composition.composeThisRecord = !!pg;
    FusionPro.Composition.SetBodyPageUsage(pg + 'Address', true);
    

    In OnJobStart I put

     

    addressMap = new ExternalDataFileEx('2014 er 2015 October Branch Master List - Calendars.txt','\t');

    In the Return Address Phone Numbers from Branch Master List Rule I put

     

    var [key] = addresses || '';
    // If no branch found, return nothing
    if (!key)
       return ''
    // Remove leading zeros from Branchkey
    key = String(Int(key)); 
    var address = ExternalField("Address");
    var CSZ = [ExternalField("City"),ExternalField("St"),ExternalField("Zip")].filter(String).join(' ');
    address = [address,CSZ].filter(String).join('<br>');
    // Remove the current address from the array
    addresses.splice(0,1); 
    
    return address;
    
    //====================================
    // Short hand for returning the external data values
    //====================================
    function ExternalField(name) {
      return addressMap.GetFieldValue(addressMap.FindRecord('BR #', key),name);
    }
    

    I am attaching the newest PDF I am composing from.

     

    Thanks!

    Imprints 2015.pdf

  18. I am working on a whopper of a merge job. I am setting up a job for imprinting calendars. I am given a list of branches and it tells me how many addresses will be on the imprint. Most of the branches have just one address so I am able to pull the address using an external data file.

     

    I have a total of 10 different body pages, depending on how many addresses will be on the imprint.

     

    Merge needs to first select correct body page, based on number of addresses required.

     

    Then each address gets it's own variable text box.

     

    For example, my data file says that branch 080 has 3 addresses- 80, 102, 324. FusionPro first needs to grab body page "3 Address". Then get address for branch 80 from external data file. Then put branch 80 address in variable data box 1. Then get address for 102 and put in variable data box 2. Then get address for 324 and put in variable data box 324.

     

    After that, it needs to output a separate PDF for branch 80, labelled as such.

     

    Then continue on to next branch, which most likely will have a different number of addresses and need a different body page.

     

    - How do I get FusionPro to select the correct body page?

     

    - How do I get FusionPro to fill each variable data box with the correct address?

     

    I've got the output rules set up from last year, so I don't need help with that.

     

     

    Thanks,

    Jeremy

    Calendar Imprint T.zip

  19. I recently upgraded Fusion Pro VDP to version 9.3.15. One of the new features is being able to use native Excel Spreadsheet files as a data source. This saves a step since I don't have to save it to a delimited CSV or TXT file.

     

    I've run into an issue with formatting a date from a native Excel file. Previously the date from tab delimited TXT file came into FusionPro as "07/26/2015".

     

    Now from native Excel Spreadsheet it comes in as "42218" for date 8/2/2015, "42211" for 07/26/2015, "42197" for 07/12/15, "42183" for 06/28/15. Date field has "Date" formatting applied in Excel.

     

    I format the Date field with this rule.

    var DateShort = FormatDate(Field("Date"), "m-dd-yy")

    Is there an adjustment to this rule so that I can use the Excel Spreadsheet and return date as "m-dd-yy"?

  20. This job ends up with 2 different version, 1 for print at full resolution and 1 for web at low resolution. Customer's customer sees both version so they need to match.

     

    Each record has 3 record-specific images that need to stay at 96 dpi and then 3 record-specific images at 72 dpi.

     

    So I would need to make Photoshop down-sample 3 images and then rename as low resolution. Then rules would have to be adjusted to use the low resolution version.

     

    David, your solution will save a bunch of time. The down-sampling is done before composition instead of after. My concern is making sure both versions match. I'll have to do some testing.

     

    I'm still wondering if there is a way to accomplish 3 variable graphics at 96 dpi and 3 at 72 dpi using Javascript or adjusting settings in FusionPro starting with full resolution graphics.

  21. I am working on a project where the customer wants the output pdfs saved low resolution for web use. Each record gets its own output pdf, so there is almost 4000 pdfs at end.

     

    Adjusting composition settings only affect what FusionPro composes, so I had to optimize the static background pdf to get images to 72 dpi.

     

    The problem is that customer is requesting that 3 of the images stay at a higher resolution- 96 dpi, the other 3 need to be downsampled for web use.

     

    I composed the job at full resolution and then optimized pdf to get images above 100 dpi down to 72 dpi, so that quality of 96 dpi images is preserved.

     

    Unfortunately, composing at full resolution and then optimizing took over 15 hours.

     

    Is there a way to get pdfs composed where resolution is downsampled for only 3 of 6 images?

     

     

    Thanks,

    Jeremy

×
×
  • Create New...