Blog
March 12, 2025 Updated: April 3, 2025
PDF Ink is a favorite among composers and sheet music sellers because it allows licensing information to be added anywhere on the page, right up to and even over the page margins. One of our customers, Guillaume, is using the Checkout Field Editor for WooCommerce plugin to enhance a checkout form with a field requiring buyers to enter their ensemble name, like “University Concert Choir.” Guillaume would like to have a Magic Tag called [ENSEMBLE] to use for printing the ensemble name on purchased PDF files. Let’s walk through how to set this up so the ensemble name then appears stamped on the PDF, clearly marking it for that specific […]
Read more »
November 13, 2023 Updated: March 20, 2025
Here is some PHP code for WordPress/WooCommerce which will make PDF Ink recognize TWO custom shortcodes in any watermark content: [VARIATION_DESC] and [VARIATION_NAME]. These translate to variation description and variation name, both aspects of a WooCommerce variable product. This code (everything above the dashed line) should get added anywhere in your functions.php file. If unsure where to put it, add it at the end of the file. You could also add the snippet using the WordPress plugin called “CODE SNIPPETS” (front and back end). This snippet development was sponsored by customer Michael. Thanks Michael! For reference (maybe for people migrating from WaterWoo to PDF Ink) here is a snippet which […]
April 17, 2023 Updated: March 20, 2025
A customer wrote with a neato request last month. If one WooCommerce product had several PDFs, and wasn’t a variable product, how could each PDF in the list be watermarked differently from the others? There is no setting for that inside PDF Ink because WooCommerce hasn’t exactly made that function easily possible, and also because it somehow hadn’t been requested until last month. That’s sort of amazing considering how long the plugin has been around! Anyway, it was a good request and so we added a filter hook called ‘pdfink_woo_filter_settings‘. (This hook replaces the ‘wwpdf_filter_settings_array’ in WaterWoo PDF Premium, with identical arguments.) Filtering Settings Because WooCommerce — unlike Easy Digital […]
February 20, 2023 Updated: March 20, 2025
Brought to you by a longtime user, Jake, is the following snippet, which allows for a different stamp on the first page than all other pages. This is a function for users of TCPDF. PDF Ink loops through each PDF page with TCPDF to apply watermarks. What this PHP code says is that if inside this loop, and we are on the first page (the page indicated as “start_page” in PDF Ink settings), apply the special stamp. For all other pages, business as usual (maybe a different stamp. The code needs to be cut and pasted into your WordPress child theme functions.php file, or maybe using the Code Snippets plugin […]
February 15, 2021 Updated: March 20, 2025
There are quite a few built in shortcodes, but sometimes we just need something… special. You can add your own shortcodes to PDF Ink for on-the-fly customized watermarks on PDF pages. In this simple example we are going to create a shortcode to reflect a customer’s order total (price) in the watermark, when using a custom shortcode: [TOTAL_PRICE] Now when you use [TOTAL_PRICE] in your watermark, the PDF will show the total price of the WooCommerce order the PDF was purchased in. Perhaps this way you could print out the price on a gift certificate. More on how to create gift certificates using PDF Ink can be found here. Another […]
October 20, 2020 Updated: March 20, 2025
A customer just brought up an interesting point: since the watermark width (“cell width” in TCPDF terms) is determined by the PDF page width, won’t a line of text be a “little short” (limited) if the watermark is rotated diagonally? Since it would take a lot of math with a few variables (page size, mainly) to determine the max cell width based on degree of rotation, we just included a new filter in PDF Ink instead. It’s called ‘pdfink_filter_cell_width’. (Hey, I like math but it’s still really smokey in California and getting hard to think.) The following code is a simple example of an attempt to override the cell width […]
June 1, 2020 Updated: March 20, 2025
If you would like to create a custom magic tag to display dynamic output, that can usually be done using filter hooks included in PDF Ink. The filter hook to use is ‘pdfink_filter_placement_content’ and the parameters it passes are $content, $key, $order_id and $product_id. $key refers to the placement: 0 is the first placement, 1 is the second, and if you have more, they’d be numbered 2, 3, 4 etc. PSST! The ‘pdfink_filter_placement_content‘ hook also works for Easy Digital Downloads and Download Monitor, with nearly identical parameters. Keep reading! Unless you are adding static content (such as the hour), or global data (such as the $_SERVER[‘REMOTE_ADDR’]), it’s necessary that you […]
October 6, 2018 Updated: March 20, 2025
Here is an example of adding new magic tags to PDF Ink for on-the-fly and totally-customized watermarks. A Brazilian customer using WooCommerce requested a magic tag to display the Cadastro de Pessoas Físicas (CPF) on PDFs. CPF is a taxpayer identification number all citizens of Brazil must use to shop online within Brasil. In order to collect CPF data from customers, our customer uses the Woocommerce Extra Checkout Fields for Brazil plugin.* We wrote the following code to creat the magic tag [BILLING_CPF] to import any customer’s CPF number into their personalized PDF. The plugin mentioned above must be in use, or this code will need to be modified to […]