Using the QR Code function, Inline Text Insertion Style, and Repeated Text Using Styles, we can embed vCard/VCF data into QR Codes. This data may include name, phone number, email address, etc. More info about vCard formatting can be found here.
Example data for vCard data is shown below:
BEGIN:VCARD
VERSION:4.0
N:Gump;Forrest;;;
FN:Forrest Gump
ORG:United States Coast Guard
TITLE:Shrimp Man
TEL;TYPE=cell:123-555-1212
ADR;TYPE=work;LABEL="123 Main St\nNew York, NY 12345":;;123 Main St;New York;NY;12345;USA
EMAIL:forrestgump@example.com
REV:20080424T195243Z
END:VCARD
To create this vCard QR Code, first create your template in Acrobat. To effectively create the vCard QR Code, we need to collect all of the information (in the proper format) that will be included in the Code in one block.
In this case, Block_3 will contain the correctly formatted data and Block_4 will contain the QR Code itself. Since we do not want or need the text in Block_3 to print, it should be formatted it to be white, and in this case, it's also been set it to be 3 points tall. This text will be contained within the final PDF, but will appear to be "hidden" as it will be white. Block_3 appears behind Block_4 because its block number is smaller.
| Block_0 |
Name. We need to make a Style for this block to be able to include it in the vCard.
|
| Block_1 |
Title. |
| Block_2 |
Contact Info. We need to make a Style for this block to include the phone number and email in the vCard.
|
| Block_3 |
Will contain data for the QR Code. We need make a Style for this block that is formatted properly and uses the same field names as fields in other Styles on the page. Using Repeated Text Using Styles will collect information from other blocks to make the data for the QR Code.
|
| Block_4 |
QR Code. Data for the code will be taken from Block_3.
|
Block_4 must be an image block that contains a custom property with value set to Block_3.
Once the entire PDF is formatted correctly, create Styles within the Designer admin. All of the text being fed to Block_3 will come from other blocks on the page. You must create Styles to get the data to feed properly to Block_3.
The Style for Block_1 will contain the name. The code used is:
%Name|John Smith%
The Style for Block_2 will contain the phone number and the email address. The code used is:
72 Route 236
Kittery, ME 03904
T %Telephone|555.555.5555%
C %Cell|555.555.5555%
F %Fax|555.555.5555%
E %Email|email@printscience.com%
The Style for Block_3 will use the same field names as fields in the Styles for Block_1 and Block_2. **The Style for Block_3 must be in the correct format and include the proper declarations to create the vCard QR Code.** The code used (in our example) is:
BEGIN:VCARD
VERSION:4.0
FN:%Name|%
TEL;TYPE=work,voice;VALUE=uri:%Telephone|%
EMAIL:%Email|%
END:VCARD
Note that Name, Telephone and Email are all fields in other Styles in the document.
Once the Styles are assigned to the appropriate blocks after the template has been uploaded to the Designer Admin, it is ready for personalization. User would see the following:
Once the card is created, the QR Code contains the data from Block_3. When scanned, the contact info from the card appears.
See also: Barcodes | Special Functions in PDFlib (overview of all special functions)