Documentation

More about EDDiMark PDF

EDDiMark does its magic using the open-source TCPDF and TCPDI libraries (not developed or maintained by EDDiMark dev). TCPDI parses the existing PDF (assuming it is unencrypted and uncorrupted), recreating it in memory, and TCPDF applies your watermark. Regretfully, TCPDI is unable to parse certain PDF elements into memory, such as internal links and forms. However, hopefully this feature will be more stable in a future TCPDI release. Understanding a little about how TCPDI and TCPDF come into play, using PHP memory, might help you to create the most effective and efficient watermarks.

Recommendations

PHP Version

You should be running at least PHP version 5.4 for all features of EDDiMark PDF to work, but higher that for it to work WELL. WordPress recommends you run PHP version 7.2 or higher. EddiMark is PHP version 7.2 compatible, so don’t hesitate to upgrade after making backups. PHP 7.0 is twice as fast for WordPress as PHP 5.6!

Increase Memory

Increase your PHP memory allotment to at least 192MB. In fact, put it as high as your host will allow. If your host does not allow more than 16 or 32, it might be a good time to switch hosts or servers. If you expect your PDF to take more than 30 seconds to parse (gasp!), you may also need to increase your PHP max_execution_time.

Hide your Precious Files

This is obviously important. Upload your files to an uploads folder, then consider moving it. Also, consider adding a blank index.html file to the folder containing your PDF and use .htaccess to “deny from all”.

Large PDFs?

If you are having trouble sharing large PDF files, keep in mind that your hosting plan needs to be robust enough to support the memory and bandwidth necessary to fulfill these requests. Try these suggestions: https://tcpdf.org/docs/performances/. (FYI Thai characters are already disabled in EDDiMark.) Keep your watermarks simple (avoid HTML if possible) and use non-Unicode fonts if possible (Helvetica, Times, Courier).

Maybe it’s time for a server upgrade?

Margins

EDDiMark comes with default margins to keep your watermark inside an area on the page. These are 10mm left/right, and 10mm top/bottom.

If you would like to remove this restriction, set the margins to 0. If you would like to move things in on the page, set the margins higher.

The XY fine tuners accomplish the same thing; however, they cannot remove the margins. So a margins setting was added primarily for those people wanting to remove the margins.

Simple Shortcodes

Simple shortcodes available are [FIRSTNAME] [LASTNAME] [EMAIL] [DATE] [PAYMENTID]. Using one of these in your overlay or footer text will cause the shortcode to be replaced by the customer data during watermarking.

Future [DATE] Shortcodes

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

Examples

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

[DATE-2YRS] would be 730 days from the checkout date, but does not take into account a leap year.

Opacity Shortcodes

The {OPAC} shortcode — and watermarking with opacity — is totally unique to this plugin is very helpful for people not wanting to obscure their PDF content, since the watermark sits on top. It 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. {OPAC} tag is still beta.

Text alignment

To style a link <a> or tag when using HTML, the following inline CSS options are available: font-style:italic, font-weight:bold, and text-align:center and text-align:right. This feature allows you to center text – yay!

Here’s an example of the code used to center some text.

Hooks (actions/filters)

Hooks were included to make it possible to adjust EDDiMark to carry out some of your specific needs. The hooks are NOT supported by EDDiMark staff unless you find a bug or need arguments added. We will not be able to write actions and filter code for you. The hooks were placed for your developer’s convenience.

‘ eddimark_use_uploads_dir ‘ filter to use wp-content/uploads/eddimark-pdf/ folder to retain copies of watermarked files. This might only be desired if using the filter, ‘ eddimark_file_name ‘, where a distinct file name is created per order/customer. Otherwise the file is kept in the system /tmp folder, and automatically wiped.

Want to keep a copy of watermarked files? Use the ‘ eddimark_dont_cleanup ‘ filter hook, with something like the following code in your theme or in a plugin:

IMPORTANT NOTE: If you keep files, your file names must be distinct. EDDiMark takes care of this for you by adding a timestamp to the PDF file name. You can filter this with the ‘ eddimark_file_name ‘ hook.

Considering keeping your files and need to rename them something more custom? The following code replaces the timestamp with the EDD order key:

Fonts (maybe adding)

To run watermarking with your custom font, you can run the filter “eddimark_add_custom_font”. Font must be added to TCPDF first using AddFont(). Please read TCPDF docs. Fonts which come with TCPDF can also be added back in to the fonts folder; they were removed to keep this plugin as lightweight as possible. This is in development and not a supported feature.

If your overlay or footer are not looking right after you’ve added a new font, the filter ‘wwpdf_font_decode’ might need to be used to add html_entity_decode() around your overlay or footer input.

Encryption

Be aware that protecting a PDF requires to encrypt it, which increases the processing time a lot. This can cause a PHP time-out in some cases, especially if the document contains images or fonts.

The file will be automatically encrypted if a password is set. If you don’t set any password, the document will open as usual.
If you set a user password, the PDF viewer will ask for it before displaying the document.
Typing the word “email” into the password field in EDDiMark settings will force the end user to open the PDF with the buyer’s email address.

The permission array is composed of values taken from the following ones (specify the ones you want to block):

The following are set together:

print : Print the document

print‑high : Print the document to a representation from which a faithful digital copy of the PDF content could be generated. When this is not set, printing is limited to a low-level representation of the appearance, possibly of degraded quality.

The following are set together:

modify : Modify the contents of the document by operations other than those controlled by ‘fill-forms’, ‘extract’ and ‘assemble’

assemble : Assemble the document (insert, rotate, or delete pages and create bookmarks or thumbnail images), even if ‘modify’ is not set

The ‘my_barcode_function’ function returns an array used by EDDiMark to create a barcode.

The first argument accepts either ‘1D’ or ‘2D’.

The second argument will be your barcode contents.

The third argument states the TYPE of barcode (please refer to TCPDF documentation for 1D vs 2D barcode setup and appropriate names for barcode types.)

The fourth argument is X-axis placement. In the example, I have it set 10cm (100mm) over to the right.

The fifth argument is Y-axis placement. In the example, I have it set 23cm (230mm) over to the right.

The sixth argument is the width of the barcode in millimeters.

The seventh argument is height of the barcode in millimeters.

Contact Us

Your Name*

First

Email*

What's This About*

Pre-Sale Question

Feature Request

Technical Support

Which version of the extension is installed?*

Have you checked out our FAQ and Documentation? Most support requests have answers on these two pages.

Please make sure your plugin is up-to-date. We only support the most recent version. The current version of EddiMark PDF is [php snippet=3]. Visit https://eddimark.me/my-account, download and install the latest version, and test with that before submitting a support ticket. Thank you!

Please be aware we would also like this plugin to have certain features ASAP. One such feature is preserving internal links (such as Table of Contents), and is already prioritized.