Category : Waterwoo

Updates & tips for Watermark PDF for WooCommerce (AKA “WaterWoo”), a PDF-watermarking and password plugin for Wordpress + Woocommerce. Learn more and purchase WaterWoo here.

Comparing the Best PDF Watermarkers for WooCommerce

Let’s compare the two most well-known plugins available for WooCommerce PDF file download watermarking/passwording. As we go down the list between the two WordPress plugins, you will find there really is no competition: our plugin PDF Watermark for WooCommerce (AKA WaterWoo) is the most fully-featured, up-to-date, best-supported, and well-loved PDF manipulation (password & watermark) plugins for WordPress!

Invisible Watermarks and Other Ways to Protect Your PDFs

PDFs are a fantastic way to share documents – they preserve formatting, are widely compatible, and can even be compressed for easy transmission. But what if that PDF contains sensitive or monetized information? The Portable Document Format (PDF) offers some security, which when stacked can be quite effective. These include: Watermarks. Adding content to a PDF, especially content customized to the end-user (such as their name and other personally-identifying information like phone/email, can not only personalize a PDF, but also thwart unauthorized sharing. Keep reading to find out how to make your watermarks most effective against PDF theft. Encryption. Arcfour RC4, and the superior 128-bit key or 256-bit AES encryption Passwording. User and owner passwords can be set. An owner password gives the holder full control over the PDF, including the ability to remove passwording entirely — share with caution! continue reading…

Different Watermark on First Page

Brought to you by a longtime user, Jake, is the following snippet, which allows for a different watermark on the first page than all other pages: function jakes_custom_overlay_function( $page, $watermark, $o_X_margin, $o_Y_margin, $cell_width ) { // Only do an overlay on the first page $start_page = empty( $watermark->settings[‘start_page’] ) ? 1 : intval( $watermark->settings[‘start_page’] ); if ( $page === $start_page ) { $ishtml = false; // If watermark has HTML Multicell needs HTML argument if ( $watermark->overlay != strip_tags( $watermark->overlay ) || strpos( $watermark->overlay, ‘opacity:’ ) !== false ) { $ishtml = true; } $watermark->pdf->MultiCell( $cell_width, 1, $watermark->overlay, 0, ”, false, 1, $o_X_margin, $o_Y_margin, true, 0, $ishtml, false, $watermark->size[‘h’], ‘T’, false ); } } add_action( ‘wwpdf_custom_overlay_function’, ‘jakes_custom_overlay_function’, 10, 5 ); WaterWoo loops through each PDF page with TCPDF to apply watermarks. What this PHP code says is that if inside continue reading…

Wordpress.org plugins return

The Little Package free wordpress.org plugins are back up! The delay between when they were put back up and now should tell you just how buried I am. Thank you to my new friends who provided help with this – you know who you are! It turned out the funnel from wordpress.org to my paid plugin offerings is REAL, and when Wordpress shut me down, my income came to a halt. Generally February-April are bad months for online sales anyway, but I wasn’t anticipating crickets! And so I got busy and coded like… my income depended on it. The new version of Gift Wrapper for WooCommerce especially is improved. I hope folks jump on into version 5.1 ASAP, since it includes security updates. Against my better judgement I kept up with the CTA inside Wordpress admin, soliciting folks to upgrade, continue reading…

Where are the Wordpress.org free plugins?

I’m getting too many emails about this to answer them all, sorry. Hopefully I can answer you here. I write and maintain Wordpress plugins for a living. For ~8 years I have also provided and supported free plugins on the side. I provide two plugins in the free (open-source) Wordpress.org plugin repository, both of which are well-loved and rated. As you may have noticed, they were abruptly removed by Wordpress on January 24th. It was a surprise to me, too! Frankly I have been feeling burned out on supporting free software, so maybe this is a chance for me to at least say my piece. One has to think abstractly for it to feel rewarding, as in “I know people aren’t saying anything, but I imagine these plugins make the world better and peoples’ days easier.” I also feel like continue reading…

Creating your Own Watermarking Shortcodes for WooCommerce

You can add your own shortcodes to WaterWoo PDF Premium for on-the-fly customized watermarks. 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 shortcode: [TOTAL_PRICE] function fetch_woo_order_data_as_shortcode( $input, $order_id, $product_id ) { // first we need to get the order object from the order id // you can get a lot of info from the order object ( $order in this case) $order = wc_get_order( $order_id ); // now let’s get the order data from the order object $order_data = $order->get_data(); $order_total = $order_data[‘total’]; // BINGO! // there is a ton of other data you can get from the WC order object data, check out // https://stackoverflow.com/questions/39401393/how-to-get-woocommerce-order-details // and substitute in what you need into the code that follows below // if there isn’t a continue reading…

Watermark Width on a PDF

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, I just included a new filter in WaterWoo instead. It’s called ‘wwpdf_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 with 300mm, which should work on pages larger than A4. The code includes a fallback if it won’t work. add_filter( ‘wwpdf_cell_width’, ‘my_custom_cell_width_function’, 10, 2 ); function my_custom_cell_width_function( $cell_width, $page_size ) { continue reading…

Sharing Passwords

That title probably caught your attention because… when do we ever share passwords? Actually, we do, a lot. Website administrators often have to share passwords with users and customers who have just been issued a password. Generally that is done automatically, without the administrator ever having any idea what password was shared. You know, for security. And this is something to think about for administrators who are passwording PDF files just before delivery. How will you let the end user know what the PDF password is? In case you’re stumped, here are some ideas for how to get that information across if you’re running a WooCommerce shop. The simple way WooCommerce has a setting for each product under the “Advanced” tab called “Purchase Note.” You can put details for the customer here and it will show on the order confirmation continue reading…

Printing a barcode or QR Code on a PDF

If you are or even if you are not using WooCommerce or Easy Digital Downloads but are still programming in PHP, I am available to consult on your TCPDF barcoding project to get it running. Get in touch!   The WaterWoo PDF Premium and EDDiMark PDF plugins can add barcodes and QR codes to PDFs dynamically upon download request via WooCommerce or Easy Digital Downloads. This is because both WordPress plugins use TCPDF to write PDF content, and TCPDF allows for barcode creation. Though this blog post might also be helpful for someone just trying to figure out how to write a barcode with TCPDF and PHP, these instructions are more geared toward a Wordpress developer wishing to add 1D or 2D barcodes to existing PDF files. For WaterWoo, use the ‘wwpdf_add_barcode’ filter hook in the plugin (located in classes/wwpdf-watermark.php). continue reading…

Selling Customized Gift Certificates: A Case Study

When it’s impossible to have customers in the store and clients face-to-face, how can money be made? One fairly obvious, and earnest-enough, method is by selling your reputation on paper: gift certificates and gift vouchers. For many businesses there is a real opportunity for income here. And many (future) loyal customers understand that purchasing gift certificates is a way to support businesses right now. They know that by making these purchases, when the Great Shutdown begins to heal, their community might look closer to how it did in 2019.

Watermarking with NGINX

*** UPDATE *** As of November 2022 the information in this blog post no longer applies to the current versions of EDDiMark and WaterWoo. The post is provided for historical reference, but should be ignored by most people. A customer recently pointed out that serving watermarked files on a NGINX server needs to be done a little differently. He is using Kinsta hosting. I also confirmed the issue on a local NGINX server. By default, WaterWoo and EDDiMark try to place a PDF in the /tmp folder while watermarking takes place, then serve it (and delete the /tmp copy). Bottom line: Kinsta (or any NGINX server) does not allow user access to /tmp, and for good reason. “…you must not permit visitors to access to tmp nor config (the database dumps are stored in /tmp so a visitor can discover continue reading…

Now watermarking in any font!

Sort of a long time coming, but folks have been asking politely over the years if we could build in a font uploader for WaterWoo, such that fonts could be added without knowledge of PHP. As it was, it wasn’t too complicated to hook into the existing TCPDF addTTFfont() function, but we get it: not everyone likes PHP like we do! As of WaterWoo version 2.10, there is now a hidden admin settings page at yoursite.com/wp-admin/options-general.php?page=wwpdf-fonts (make sure to replace yoursite.com with your site), also linked from the main WaterWoo settings page under the font dropdown/selector. Visiting this settings page, you will see an uploader similar to the native Wordpress file uploader. You can either click to upload files, or drag files (one at a time) into the uploader area marked by dashed lines. In order for the font file continue reading…

A Consideration for Password-Protecting PDF Files

A few emails came in and got me thinking about use cases for passworded PDF files. One person wanted to know how to change the pop-up/alert in her PDF reader to let users know the password was their email address. Another person just wanted to know how to change the wording on the WooCommerce Thank You page and in order confirmation emails. Unfortunately, we cannot use PDF syntax to tell a PDF reader to use different wording in the password pop-up. That would be neat, but probably still buggy since there are dozens and dozens of different PDF reader applications (Acrobat/Reader, Foxit, Nitro, Preview, your browser), all with their own way of displaying that pop-up. So we must alert our customers in other ways that their password will be their email address, or what it will be. That way they continue reading…

FPDI/FPDF dropped in Free WaterWoo version

Big changes for the free version of WaterWoo PDF! We finally took the plunge and abandoned the pay-walled FPDI parser in favor of TCPDI, an open-source derivative. What does this mean for users of the free plugin? A couple things: 1) All PDF versions are watermark-able, not just versions prior to 1.5. This limitation was a bit silly, and we apologize it took us so long to obliterate it. 2) Slight watermark positioning change on the Y axis (up/down the page). You might want to check your watermark position if you are using the free version to make sure it is still sitting where you want on the page. If you are coming up with blank pages (every other page), then move your watermark UP (smaller Y-axis number). Download the free version of the PDF watermarker plugin at Wordpress.org. Buy continue reading…

Phone Number as PDF Password

A customer asked about maybe using a customer’s phone number as the PDF password instead of their email or an admin-chosen string. Here is some example code which will get that done. Make sure to test it, and customize ad-lib to suit your purposes. function waterwoo_use_phone_as_password( $password, $order_id ) { $phone = ”; // start by maybe getting phone number from order ID $order = wc_get_order( $order_id ); $order_data = $order->get_data(); $phone = $order_data[‘billing’][‘phone’]; if ( ! isset( $phone ) || $phone == ” ) { // no phone number yet, try seeing if user is logged in and has a saved phone number: if ( is_user_logged_in() ) { $user = wp_get_current_user(); $phone = get_user_meta( $user->ID, ‘billing_phone’, true ) ? get_user_meta( $user->ID, ‘billing_phone’, true ) : ”; } } // you might want to manipulate the phone number to remove continue reading…

WaterWoo Action & Filter Hooks, listed

WaterWoo PDF Premium comes with many built-in hooks that will allow someone familiar with PHP (and Wordpress hooks) to further customize the plugin functioning. Note, these hooks are not stated functions of the plugin and therefore are NOT included in plugin support other than to correct mistakes on our end or perhaps add in new hooks if you need them. They are listed here by appearance in various plugin files, with a little information about what each can do. You might find code examples for these hooks here. class-wwpdf-file-handler.php ‘wwpdf_do_cleanup’ – filter to maybe prevent cleanup of files served via forced or xsendfile download. Added in version 2.2 ‘wwpdf_file_cleanup’ – action to clean up residual files on the server if using Redirect download method. ‘wwpdf_font_decode’ – decode watermarking output differently than the default, in case of special character use ‘wwpdf_out_charset’ continue reading…

Dropbox Support Dropped

Unfortunately, we can no longer claim WaterWoo (or WooCommerce for that matter) will work with Dropbox-served files using the WooCommerce Dropbox plugin. It was brought to our attention that files are not being reliably served intact to WooCommerce from Dropbox by the plugin. Since support for the WooCommerce Dropbox plugin seems to have gone away, and the plugin hasn’t been updated in two years, we recommend you use another solution for hosting your files externally until the Dropbox/Woo plugin is repaired or a new solution becomes available.

Little Package