#1
|
|||
|
|||
![]()
Is there a color change rule to change the color of an inline graphic? Or it only works on a pdf brought in with a graphic box?
This is the code I am using for the inline graphic... Code:
// Rule converted from XML Template "Inline Graphic Rule: Community Name": // Begin XML Template selections // var FieldName = "Social Media Icons"; // "Choose the field containing the graphic name:" (Required): FieldList var Format = "pdf"; // "Choose the type of graphic:" (Required): PickList ["jpg" (JPG or JPEG), "tif" (TIF or TIFF), "png" (PNG), "pdf" (PDF), "gif" (GIF), "eps" (EPS)] var SearchPath = ""; // "Enter a search path:": FolderPath var DefaultGraphic = "Social Media - White .1875"; // "Choose a default graphic:": ResourceList (Graphic) var SkipIfNoValue = false; // "Skip if the field value is empty": CheckBox var Width = HundredthsOfPointsFromText("0 in"); // "Override graphic width (zero to use existing width):": Space var Height = HundredthsOfPointsFromText(".16 in"); // "Override graphic height (zero to use existing height):": Space // End XML Template selections // var fieldVal = Field(FieldName); if (!fieldVal && SkipIfNoValue) return ""; var path = CombinePath(SearchPath, fieldVal); var Pic = NullResource(); for (var pass = 1; ; pass++) { switch (pass) { case 1: var validExtensions = [".png", ".pdf", ".gif", ".eps", ".tif", ".tiff", ".jpg", ".jpeg"]; if (validExtensions.indexOf(GetFileExtension(path).toLowerCase()) >= 0) Pic = CreateResource(path, "graphic", true); break; case 2: Pic = CreateResource(ReplaceFileExtension(path, Format.toLowerCase()), "graphic", true); break; case 3: var altExtensions = { JPG: "jpeg", TIF: "tiff" }; Pic = CreateResource(ReplaceFileExtension(path, altExtensions[Format.toUpperCase()]), "graphic", true); break; case 4: //Print("Graphic not found: " + fieldVal); if (!DefaultGraphic) return ""; //else Pic = Resource(DefaultGraphic); default: return ""; // should never get here } Pic.width = Width; Pic.height = Height; if (Pic.exists) return Pic; } return ""; // should never get here |
#2
|
||||
|
||||
![]()
You can change the color of a resource, and use it inline, but it works only for PDF resources, not for any other graphic format.
If it's a PDF, you can just add a line like so before you return the resource: Code:
// Change all colors to Blue. Pic.ChangeColor("ALL", "0,0,255", 10);
__________________
Dan Korn FusionPro Developer / JavaScript Guru / Forum Moderator PTI Marketing Technologies | Printable | MarcomCentral 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@marcom.com. Complex template-building questions, as well as all installation and font questions or problems, should be directed to FusionProSupport@marcom.com. Paid consulting work may be required to fulfill your template-building needs. This is a publicly viewable forum. Please DO NOT post fonts, or other proprietary content, to this forum. Also, please DO NOT post any "live" data with real names, addresses, or any other personal, private, or confidential data. 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)}); ![]() |
#3
|
|||
|
|||
![]()
I added it here
Code:
} Pic.width = Width; Pic.height = Height; Pic.ChangeColor("ALL", "0, 0, 0, 60", 10); // Change all colors. if (Pic.exists) return Pic; Also, is there a way to add a little padding above the inline image so it lines up better with the text? ![]() Thank you so much for your help. |
#4
|
||||
|
||||
![]() Quote:
Note that this doesn't necessarily work with every PDF; it depends on how the objects are shown in the PDF file. If the PDF is merely a wrapper for a raster image, it's probably not going to work. If it's vector art, that's more likely to work. I would try just using the default "Change Color In PDF Resource Rule" Form Rule and see if that works. If you want to attach the graphic here, I can take a look at it. Quote:
Sure! Thanks for an interesting question.
__________________
Dan Korn FusionPro Developer / JavaScript Guru / Forum Moderator PTI Marketing Technologies | Printable | MarcomCentral 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@marcom.com. Complex template-building questions, as well as all installation and font questions or problems, should be directed to FusionProSupport@marcom.com. Paid consulting work may be required to fulfill your template-building needs. This is a publicly viewable forum. Please DO NOT post fonts, or other proprietary content, to this forum. Also, please DO NOT post any "live" data with real names, addresses, or any other personal, private, or confidential data. 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)}); ![]() |
![]() |
Thread Tools | Search this Thread |
Display Modes | |
|
|