Go Back   MarcomCentral (PTI) and FusionPro User Communities > Software-Related Talk > The JavaScript Library

Notices

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old February 27th, 2012, 11:02 AM
jdubois jdubois is offline
Forum n00b
 
Join Date: Mar 2009
Posts: 6
Default Assigning color in OnRecordStart

I have a product which references defined colors in the PDF document for various colored text and text boxes, etc. As example, color 1 is C=4 M=24 Y=50 K=25, color 2 is C=25 M=25 Y=0 K=0, etc. I have defined these colors in the fusion pro document under Advanced>Colors menu.

now the user would like to be able to change these colors within the fields of the Marcomm store. So for example, out of a list of 12 defined colors for the product, they would like to select and define from a drop down for color 1, color 2, color 3, etc. and have it utilize those values to create the PDF.

I have no idea how to define color values on the fly rather than through the fusion pro program, though I am assuming it can be done in some fashion with an OnRecordStart rule.

Can anyone help me with an example on how I might be able to accomplish this?
Reply With Quote
  #2  
Old February 27th, 2012, 12:45 PM
esmith's Avatar
esmith esmith is offline
Senior Contributor
 
Join Date: Oct 2008
Location: Charlotte, NC
Posts: 870
Default Re: Assigning color in OnRecordStart

I don't know that that can be done with JavaScript within a FP rule. I would think you would need to define all your colors in the Color palette and then offer a drop down box on MarcomCentral for the user to choose the colors they want from your existing palette.

Having said that, I just recently learned that it is possible to write a custom XML .dif file during the call from the portal to FPServer. Since the .dif file contains the color definitions, it stands to reason that colors could be defined via custom-generated .difs for each "order". Since I am just now "stepping in the shallow end" of this concept, you will need Dan's assistance (as will I).
__________________
Eric Smith
Content Developer
Classic
FP 9.3.6, MAC OSX 10.9.4, Acrobat 11.0.09
Reply With Quote
  #3  
Old February 27th, 2012, 03:58 PM
ThomasLewis's Avatar
ThomasLewis ThomasLewis is offline
Senior Contributor
 
Join Date: Feb 2011
Posts: 208
Default Re: Assigning color in OnRecordStart

You can do this with the <color> tag. The only issue is it is expecting hex values. I wrote the following function to convert CMYK to hex:

Code:
function cmyk2hex(cmyk)
{
    a = cmyk.split("-");
    hex = "";

    for (x=0;x<4;x++)
    {
        h = Math.round(a[x] * 2.55).toString(16);
        if (h.length == 1) hex += "0" + h;
        else hex += h;
    }

    return hex;
}

return '<color cmyk="' + cmyk2hex("100-0-40-0") + '">' + "text" + '</color>';
Just put your values in CMYK order between the hyphens.
Reply With Quote
  #4  
Old February 28th, 2012, 05:19 AM
esmith's Avatar
esmith esmith is offline
Senior Contributor
 
Join Date: Oct 2008
Location: Charlotte, NC
Posts: 870
Default Re: Assigning color in OnRecordStart

Nice solution Thomas. Thanks for sharing!
__________________
Eric Smith
Content Developer
Classic
FP 9.3.6, MAC OSX 10.9.4, Acrobat 11.0.09
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 07:29 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) 2011, PTI Marketing Technologies™, Inc.