Magic Tags

Magic tags would be called shortcodes, except they function differently from PDF Ink shortcodes. Magic tags are used in PDF stamping/watermarking content, and replaced by corresponding data. For example, if you use the [TIMESTAMP] shortcode, it will be replaced with a timestamp, the moment the PDF is stamped, in the stamp text content. Especially when the text content involves a downloader's name and email address, that's pretty magical. The trick is making sure we collect the data, first, so that PDF Ink has something to work with.

Basic Magic Tags

The basic magic tags are [FIRSTNAME] [LASTNAME] [EMAIL] [DATE]. Using one of these in your placement content will cause the magic tag to be replaced by custom data during PDF download. 🪄 This data is either collected by an e-commerce solution like WooCommerce, Easy Digital Downloads, or Download Monitor, or it is gathered in a [pdfink] shortcode form, or is passed in using a filter hook.

Date Magic Tag

[DATE] can be used as-is, and will insert the order date (Woo, DLM, EDD). This is different from [TIMESTAMP], which marks the moment the PDF is marked/downloaded in UNIX timestamp format. The date format setting in your WordPress -> Settings -> General -> Date Format is used for the date magic tag.

WooCommerce Magic Tags

Information collected during checkout can be used to replace magic tags during PDF download. The magic tags for Woo are:

[FIRSTNAME] [LASTNAME] [EMAIL] [PHONE] [BUSINESSNAME]
[DATE] [ORDERNUMBER] [PRODUCTNAME] [ADDRESS1] [ADDRESS2]
[CITY] [STATE] [POSTCODE] [COUNTRY] [COUNTRYCODE]
[PRODUCTNAME]

TIP: If you do not solicit the “Business Name” field or make it mandatory, and the customer leaves it blank, the [BUSINESSNAME] magic tag will leave an empty spot in the watermark if you use it. Hopefully that makes sense! Here is information about how to use your theme’s function.php file to alter WooCommerce core fields

Quantity Purchased

WooCommerce also permits a very special magic tag [PRODUCT###]. [PRODUCT-###], typed just like that, will be replaced by the number/qty. of product purchased of the file downloaded.

Add Your Own Magic

Using the PDF Ink ‘pdfink_filter_placement_content‘ filter hook, you can gather order data and create your own [magic_tag] for use during stamping. Here is an example of creating a magic tag for checkout field data.

Easy Digital Downloads Magic Tags

If we have a valid payment ID, these magic tags will sparkle:

[FIRSTNAME] [LASTNAME] [EMAIL] [ADDRESS1] [ADDRESS2]
[CITY] [STATE] [POSTCODE] [COUNTRY] [DATE]
[PAYMENTID] [PRODUCTNAME]

Download Monitor Magic Tags

If we have a valid order number, these magic tags will twinkle:

[FIRSTNAME] [LASTNAME] [BUSINESSNAME] [EMAIL]
[PHONE] [IPADDRESS] [ADDRESS1] [ADDRESS2]
[CITY] [STATE] [POSTCODE] [COUNTRY] [DATE]
[ORDERNUMBER] [PRODUCTNAME] 

Advanced Magic Tags

Future [DATE] Magic Tags

To add a future date marked from the date of purchase, you can use the [DATE-#YRS] [DATE-#MOS] [DATE-#WKS] [DATE-#DAYS] magic tag, where # is replaced with the number of days/months/weeks/years desired. This magic tag is based on 30-day months, and 365-day years, so it might be best to use days if you need precision. Examples:

Magic tag [DATE-6WKS] would be 6 weeks from the checkout date.

Magic tag [DATE-365DAYS] would be 365 days from the checkout date.

Magic tag [DATE-2YRS] would be 730 days from the checkout date, because it is 365+365 and does not take a leap year into account.

{OPAC} Opacity Magic Tag

(TCPDF only) The {OPAC} magic tag — and PDF text with opacity — is totally unique to this plugin. It is very helpful for people not wanting to obscure their PDF content, since the watermark sits on top of text. Some people use the {OPAC} tag to create an invisible — or nearly invisible — text watermark.

The {OPAC} tag doesn’t always play nice with HTML in your watermark, so sometimes some rearranging will need to be done. Consider wrapping your HTML inside {OPAC} tags if trying to get opacity, if the inverse isn’t working. Examples:

{OPAC-0.5}This is sample text{/OPAC}

This is sample text” will be at 50% transparency. The tag needs a dash, then a number representing the fraction of 100% opacity.

{OPAC-0.1}This is very transparent text{/OPAC}

This is very transparent text” will be at 10% transparency.

Note there is an open tag and a close tag around the text. If text does not wrap when using this tag, you may have to use HTML <br> tags. Again, the {OPAC} tag is for TCPDF only.