Go Back   PTI Marketing Technologies User Community > Software-Related Talk > The JavaScript Library > Graphic Rules

Notices

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old February 1st, 2017, 10:21 AM
jl_arnold jl_arnold is offline
Regular Contributor
 
Join Date: Jun 2016
Posts: 53
Default Background Color

Hello,

I have a very straight forward template that will have two fields, Code and Color.

Code is a text field.
Color will be the background color to the entire document.


We want to allow users to choose ANY color they want. So in Indesign, I added the Pantone uncoated swatch library and exported it to my FusionPro PDF.

I currently have the field Color as a graphic field.



I want to know the best way to setup the Color option. I was initially thinking the Color field as a graphic field and just allowing users to select a colored graphic "Swatch" from a gallery. These were just generic PNG files that were color squares. I used these more as a test to ensure the small files worked fined to color the background.

The only issue I have with the gallery is that I now need to extracted the embedded colors from the PDF or InDesign file to PNG files to upload to an Image Library. If I can figure out an easy way to export one file for each swatch, this way should work well.

However, since I also have all the colors embedded in the PDF, I was wondering if there was a better way to allow users to select the color background.


Let me know if there are any quick tips you can provide. I know there are several ways to do this, but with the number of color options we want to provide, I am just looking for any options that avoid manually defining each color setting.

Thanks!
Jason
Reply With Quote
  #2  
Old February 2nd, 2017, 12:56 PM
jl_arnold jl_arnold is offline
Regular Contributor
 
Join Date: Jun 2016
Posts: 53
Default Re: Background Color

I went with graphic files for colors.

However, I'm trying to allow editing the font color.


The user is able to enter text and change the font of the "Code" text field in MarcomCentral.

The other text is fixed, but the text color needs to change as well. The text is formatted, so I am using a Text Resource named Page1res.

I have set my Font Format feature in MarcomCentral to allow users to change the font color of the text fields. However, I am using a Switch rule for the Page1 field so that it displays the Page1res resource formatted content. The only issue with this is the Resource maintains the font color in the resource and does not apply the font color from the Page1 field.


I think I'm only missing a small portion of the code needed.

Code:
switch (Field("Page1"))
{
	case "":
		return Resource("Page1res");
	default:
		return Resource("Page1res");
}
I've tried working with the some of the raw text functions, but I lose all formatting that way.

Can you help me set the Resource("Page1res") font color to be the selected choice from the user in MarcomCentral?

Thanks!
Jason
Reply With Quote
  #3  
Old February 2nd, 2017, 03:32 PM
jl_arnold jl_arnold is offline
Regular Contributor
 
Join Date: Jun 2016
Posts: 53
Default Re: Background Color

Created multiple fields and rules. Could not use with MarcomCentral features.

Issue resolved with manual setting all individual color options for graphics and colors.
Reply With Quote
  #4  
Old February 3rd, 2017, 12:29 PM
Dan Korn's Avatar
Dan Korn Dan Korn is offline
FusionPro Senior Engineer / Forum Moderator
 
Join Date: Aug 2008
Location: Chicago, IL
Posts: 3,980
Default Re: Background Color

From a FusionPro standpoint, you definitely do not need to make a bunch of files for each color. You can programmatically set the fill color of any frame in OnRecordStart, like so:
Code:
var myFrame = FindTextFrame("MyFrameName"); // or FindGraphicFrame
myFrame.fillColorName = "Red";
// or:
myFrame.fillColorName = Field("ColorName");
//optionally:
myFrame.fillColorPercent = 50;
If the data has color values instead of percentages, such as RGB or CMYK, then you can create a new FusionProColor object and use that for the frame's fill color. For example:
Code:
var customColor = new FusionProColor("custom name", Field("cyan"), Field("yellow"), Field("magenta"), Field("black"));
// or:
var customColor = new FusionProColor("custom name", "RGB", Field("red"), Field("green"), Field("blue"));
var myFrame = FindTextFrame("MyFrameName"); // or FindGraphicFrame
myFrame.fillColorName = "custom name";
Or you can parse out the color values if they're in something like hex digits in the data.

Now, how to present the color options to the end user is a different question. In order to help with that, I first need to know exactly where the user will be doing this selection. Is this in MarcomCentral? Or in another web-to-print application such as EFI Digital StoreFront? Or something else?
__________________
Dan Korn
FusionPro Developer / JavaScript Guru / Forum Moderator
PTI Marketing Technologies | Printable | MarcomCentral
LinkedIn

I am a not a Support engineer, and this forum is not a substitute for Support. My participation on this forum is primarily as a fellow user (and a forum moderator). I am happy to provide help and answers to questions when I can; however, there is no guarantee that I, or anyone else on this forum, will be able to answer all questions or fix any problems. If I ask for files to clarify an issue, I might not be able to look at them personally. I am not able to answer private messages, emails, or phone calls unless they go through proper Support channels. Please direct any sales or pricing questions to your salesperson or inquiries@pti.com.

Complex template-building questions, as well as all installation and font questions or problems, should be directed to FusionProSupport@PTI.com. Paid consulting work may be required to fulfill your template-building needs. Please do not post proprietary font files to this forum.

Please include the specific versions of FusionPro, Acrobat, and your operating system in any problem reports or help requests. I recommend putting this information in your forum signature. Please also check your composition log (.msg) file for relevant error or warning messages.

Please post questions specific to the MarcomCentral Enterprise and Web-to-Print applications in the MarcomCentral forum. Click here to request access. Or contact your Business Relationship Manager (BRM/CPM) for assistance.

Please direct any questions specific to EFI's Digital StoreFront (DSF) to EFI support.

How To Ask Questions The Smart Way

The correct spellings are JavaScript, FusionPro, and MarcomCentral (each with two capital letters and no spaces). Acceptable abbreviations are JS, FP, and MC (or MCC). There is no "S" at the end of "Expression" or "Printable"! The name of the product is FusionPro, not "Fusion". "Java" is not is not the same as JavaScript.

Check out the JavaScript Guide and JavaScript Reference! FusionPro 8.0 and newer use JavaScript 1.7. Older versions use JavaScript 1.5.

return "KbwbTdsjqu!spdlt\"".replace(/./g,function(w){return String.fromCharCode(w.charCodeAt()-1)});
Reply With Quote
  #5  
Old February 3rd, 2017, 12:31 PM
Dan Korn's Avatar
Dan Korn Dan Korn is offline
FusionPro Senior Engineer / Forum Moderator
 
Join Date: Aug 2008
Location: Chicago, IL
Posts: 3,980
Default Re: Background Color

Quote:
Originally Posted by jl_arnold View Post
I went with graphic files for colors.

However, I'm trying to allow editing the font color.


The user is able to enter text and change the font of the "Code" text field in MarcomCentral.

The other text is fixed, but the text color needs to change as well. The text is formatted, so I am using a Text Resource named Page1res.

I have set my Font Format feature in MarcomCentral to allow users to change the font color of the text fields. However, I am using a Switch rule for the Page1 field so that it displays the Page1res resource formatted content. The only issue with this is the Resource maintains the font color in the resource and does not apply the font color from the Page1 field.


I think I'm only missing a small portion of the code needed.

Code:
switch (Field("Page1"))
{
	case "":
		return Resource("Page1res");
	default:
		return Resource("Page1res");
}
I've tried working with the some of the raw text functions, but I lose all formatting that way.

Can you help me set the Resource("Page1res") font color to be the selected choice from the user in MarcomCentral?

Thanks!
Jason
This is really a separate question, which should be in its own thread. But generally, a Formatted Text Resource contains a <color> tag, which you can see if you use the View Source button. So putting another <color> tag out before the resource won't do anything. You could use a <span color=***> tag instead. But I would need to see the job files in order to offer more specific suggestions. Again, a separate thread would be best.
__________________
Dan Korn
FusionPro Developer / JavaScript Guru / Forum Moderator
PTI Marketing Technologies | Printable | MarcomCentral
LinkedIn

I am a not a Support engineer, and this forum is not a substitute for Support. My participation on this forum is primarily as a fellow user (and a forum moderator). I am happy to provide help and answers to questions when I can; however, there is no guarantee that I, or anyone else on this forum, will be able to answer all questions or fix any problems. If I ask for files to clarify an issue, I might not be able to look at them personally. I am not able to answer private messages, emails, or phone calls unless they go through proper Support channels. Please direct any sales or pricing questions to your salesperson or inquiries@pti.com.

Complex template-building questions, as well as all installation and font questions or problems, should be directed to FusionProSupport@PTI.com. Paid consulting work may be required to fulfill your template-building needs. Please do not post proprietary font files to this forum.

Please include the specific versions of FusionPro, Acrobat, and your operating system in any problem reports or help requests. I recommend putting this information in your forum signature. Please also check your composition log (.msg) file for relevant error or warning messages.

Please post questions specific to the MarcomCentral Enterprise and Web-to-Print applications in the MarcomCentral forum. Click here to request access. Or contact your Business Relationship Manager (BRM/CPM) for assistance.

Please direct any questions specific to EFI's Digital StoreFront (DSF) to EFI support.

How To Ask Questions The Smart Way

The correct spellings are JavaScript, FusionPro, and MarcomCentral (each with two capital letters and no spaces). Acceptable abbreviations are JS, FP, and MC (or MCC). There is no "S" at the end of "Expression" or "Printable"! The name of the product is FusionPro, not "Fusion". "Java" is not is not the same as JavaScript.

Check out the JavaScript Guide and JavaScript Reference! FusionPro 8.0 and newer use JavaScript 1.7. Older versions use JavaScript 1.5.

return "KbwbTdsjqu!spdlt\"".replace(/./g,function(w){return String.fromCharCode(w.charCodeAt()-1)});
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 02:37 PM.


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