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 October 20th, 2014, 08:06 AM
jimmyhartington jimmyhartington is offline
Regular Contributor
 
Join Date: Nov 2012
Posts: 60
Default Change color and size of text QR-code

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
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/...ollect.zip.zip

Hope somebody can see what is missing.
__________________
Kind regards Jimmy Hartington

-------
Happy MarcomCentral® customer - OS version: OS X 10.12.6 - Acrobat version: XI - FusionPro version: 10.0.16
Reply With Quote
  #2  
Old October 20th, 2014, 09:59 AM
Dan Korn's Avatar
Dan Korn Dan Korn is offline
FusionPro Senior Engineer / Forum Moderator
 
Join Date: Aug 2008
Location: Chicago, IL
Posts: 4,359
Default Re: Change color and size of text QR-code

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.
__________________
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@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)});
Reply With Quote
  #3  
Old October 20th, 2014, 02:23 PM
jimmyhartington jimmyhartington is offline
Regular Contributor
 
Join Date: Nov 2012
Posts: 60
Default Re: Change color and size of text QR-code

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.
__________________
Kind regards Jimmy Hartington

-------
Happy MarcomCentral® customer - OS version: OS X 10.12.6 - Acrobat version: XI - FusionPro version: 10.0.16
Reply With Quote
Reply

Tags
color, javascript, qr-code

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 10:50 AM.


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