jimmyhartington Posted October 20, 2014 Share Posted October 20, 2014 Hi I have a template, where I need to make a QR-code and set the color of it. So I have made a rule for this. But what ever color or size I set in the text frame with the QR-code does not apply. If I make QR-code from the built in dialogs (without converting to JavaScript), then I can change the color and size. Here is my code var PointSize = "18"; var NameRuleOrField = Trim(Field("Name")); var CompanyRuleOrField = Rule("R Companyname for QR"); var PhoneRuleOrField = Trim(Field("Direct phone")); var MobileRuleOrField = Trim(Field("Mobile phone")); var EmailRuleOrField = Rule("R Email for QR"); var WebsiteRuleOrField = "www.tytex.com"; if (Trim(Field("Title 2")).length == 0 ) { var TitleRuleOrField = Rule("R Title 1"); } else { var TitleRuleOrField = Rule("R Title 1") + ", " + Rule("R Title 2"); } // vCard format // http://en.wikipedia.org/wiki/VCard // Note that support for vCard may be more limited than for MECARD, // and that vCard requires more data to be encoded, resulting in a denser barcode. var info = { N: NameRuleOrField, ORG: CompanyRuleOrField, TITLE: TitleRuleOrField, "TEL;WORK;VOICE": PhoneRuleOrField, "TEL;WORK;CELL": MobileRuleOrField, EMAIL: EmailRuleOrField, URL: WebsiteRuleOrField, } var result = ["BEGIN:VCARD", "VERSION:2.1"]; for (var label in info) { if (info[label]) result.push(label + ":" + info[label]); } result.push("END:VCARD"); return MakeQRBarcodeGraphic(result.join(Chr(13) + Chr(10))); var QR = new QRBarcode; QR.pointSize = Int(PointSize) || 10; return QR.Make(result); And here is a collect of my job. https://dl.dropboxusercontent.com/u/1372858/Temp/1/Collect.zip.zip Hope somebody can see what is missing. Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted October 20, 2014 Share Posted October 20, 2014 Is this a text rule or a graphic rule? If it's a graphic rule, then the intent is that you set the scaling to something like "Best Fit" in the graphic frame. If it's a text frame, then you can set the point size like you're doing at the end of your rule. However, the way your rule is written, those last three lines will never be executed, since you always hit the "return MakeQRBarcodeGraphic" line just above. So if this really is a text rule, then you need to get ride of that "return MakeQRBarcodeGraphic" line. Quote Link to comment Share on other sites More sharing options...
jimmyhartington Posted October 20, 2014 Author Share Posted October 20, 2014 Sorry. My mistake. This is a text-rule. Tried to make a graphic rule first but remembered that I could not change the color of the graphic rule. But I tried to use much of the same code, and missed the return. That fixed it. Thanks Dan. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.