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


Thread Tools Search this Thread Display Modes
Old October 25th, 2013, 12:40 PM
sandig@customprinters.com sandig@customprinters.com is offline
Regular Contributor
Join Date: Feb 2010
Posts: 62
Default Create a QR MEcard

I've never done this before in FusionPro8
Typically I create Vcard's via online sources - I do not see the option to create Vcards in FP8.

I see the helper rule for QR Contact Information - MeCard
Problem is that not all the fields I need are included.
And some of the information I need is static (not entered by a variable)

I need the variables Name, Cell, Phone and Email
I need the static information for website and address and fax

I pasted the helper rule from FP8 and inserted some comments.

var NameFieldOrRule = "Name";
var PhoneFieldOrRule = "direct";
var EmailFieldOrRule = "email";
var WebsiteFieldOrRule = ""; //HELP! I need to input static information here for website. website.com
var AddressFieldOrRule = "";//HELP! I need to input static information here.for address
var BirthdayFieldOrRule = ""; // dont want
var NoteFieldOrRule = "";// dont want
//HELP how do I include a cell phone number?
//HELP how do I include a fax number?
var PointSize = "";

// MECARD format
// http://www.nttdocomo.co.jp/english/s...on/addressbook
// Also see: http://code.google.com/p/zxing/wiki/BarcodeContents

var info = {
N: FieldOrRule(NameFieldOrRule),
TEL: OptionalFieldOrRule(PhoneFieldOrRule).replace(/\D/g,''),
EMAIL: OptionalFieldOrRule(EmailFieldOrRule),
URL: OptionalFieldOrRule(WebsiteFieldOrRule),
ADR: OptionalFieldOrRule(AddressFieldOrRule),
BDAY: OptionalFieldOrRule(BirthdayFieldOrRule),
NOTE: OptionalFieldOrRule(NoteFieldOrRule),

var result = "";
for (var label in info)
if (!info[label])

result += label;
if (!label.match(/\:$/))
result += ":";

result += info[label];

result += FusionPro.inValidation ? '\r' : ';';

if (FusionPro.inValidation)
return result;

var QR = new QRBarcode;
QR.pointSize = Int(PointSize) || 10;
return QR.Make("MECARD:" + result + ";");
Reply With Quote
Old October 25th, 2013, 01:59 PM
Dan Korn's Avatar
Dan Korn Dan Korn is offline
FusionPro Senior Engineer / Forum Moderator
Join Date: Aug 2008
Location: Chicago, IL
Posts: 4,476
Default Re: Create a QR MEcard

When you click on "New" from the Rules dialog, then click the "Graphic" button on the New Rule dialog, you will see an item in the list named "QR Contact (vCard)".
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)});
Reply With Quote
Old October 28th, 2013, 12:27 PM
sandig@customprinters.com sandig@customprinters.com is offline
Regular Contributor
Join Date: Feb 2010
Posts: 62
Default Re: Create a QR MEcard

Thank you Dan.
I think I prefer the Vcard and have modified the code to this point.
And will continue working from there.
I will repost if I have further questions.
Thanks again.

var NameRuleOrField = "Name";
var CompanyRuleOrField = "";
var PhoneRuleOrField = "direct";
var CellRuleOrField = "cell";
var EmailRuleOrField = Rule("RULE_emailsuffix");
var WebsiteRuleOrField = "";
var AddressRuleOrField = "";

// 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: RuleOrField(NameRuleOrField),
"ORG;COMPANY": "Company Name",
"TEL;WORK;VOICE": OptionalRuleOrField(PhoneRuleOrField).replace(/\D/g,''),
"TEL;CELL;MOBILE": OptionalRuleOrField(CellRuleOrField).replace(/\D/g,''),
EMAIL: EmailRuleOrField,
"URL;WEB": "http://companywebsite.com",
ADR: "2801 Oak Industrial Drive NE, Grand Rapids MI 49505",


var result = ["BEGIN:VCARD", "VERSION:2.1"];
for (var label in info)
if (info[label])
result.push(label + ":" + info[label]);

return MakeQRBarcodeGraphic(result.join(Chr(13) + Chr(10)));
Reply With Quote

mecard, 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 02:24 PM.

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