The following are recommendations for settings, and ideas for hooks to use for extending the function of EDDiStamper.
Setup
First of all, your WordPress installation must include a call to the SetaPDF-Stamper autoload.php file, and/or the SetaPDF folder must be moved into the wp-content/uploads/eddistamper folder. If the SetaPDF-Stamper is not included, the plugin will not do much, and certainly will not stamp.
You must purchase SetaPDF Stamper. A Seta evaluation copy of SetaPDF Stamper can be used if your server has Ioncube correctly installed, and the license file in place.
Installation instructions
- First, the Easy Digital Downloads plugin must be installed
- Install the EDDiStamper PDF plugin folder (‘eddistamper-pdf’) in your /wp-content/plugins/ folder and activate, or upload the EDDiStamper ZIP file to the built-in WordPress “Add Plugin” feature.
- Purchase your SetaPDF-Stamper license and download the Seta software package.
- Unzip the SetaPDF-Stamper software package and install the /SetaPDF folder inside your /wp-content/uploads/eddistamper folder. The Autoload.php file should be right inside the SetaPDF folder along with several other files and folders. Check to make sure. Alternatively you can include* SetaPDF-Stamper autoloader anywhere in your WP installation (optimally using the ‘plugins_loaded’ hook with a priority lower than 99), and that will also work.
Please also review the notes on the EDDiStamper general settings page, as they reveal a lot of tips and background for each setting.
Watermark Positioning
Seta allows for nine positions on the page: TOP MIDDLE BOTTOM as combined with LEFT CENTER RIGHT. Choose where you would like your watermark to essentially sit, and then you can fine-tune it by millimeter with the X and Y fine-tuners. Use font size and line height carefully to help keep your stamp from going off the page. The stamp text input field in the plugin settings accepts line breaks, just hit your enter key to apply a line break.
Passwording, protections and encryption
Encryption must be turned on to allow for passwording and permissions, and will be applied on top of those features. The user password can be set to “email,” which will be replaced with the downloader’s email (if available, please make sure it is required before using this magical setting). Otherwise, set it ad lib, and it will be required the downloader enter it correctly in order to even view the file (they will be able to view metadata, by default, more on that below). Once they enter it correctly, they can view the file, but permissions might prevent them from doing certain things with the file, per your settings, such as copy or print.
The owner password is set arbitrarily by the plugin and you might want to change it to something more suited to yourself right away. The owner password not only opens a passworded PDF, but also removes all permissions blocks. Anyone with an owner password essentially becomes an “owner” of the file, meaning they can do pretty much anything to it. Careful with this.
Filter Hooks
All stamping occurs in the classes/eddistamper-stamp.php and classes/eddistamper-test-stamp.php (for testing) files. Inside EDDiStamper_Stamp->do_stamp(), the Seta class is called, and your PDF file is manipulated. Some filter hooks available for tinkering during that process are:
‘eddistamper_custom_font‘ and ‘eddistamper_filter_font‘ – These two filters will allow you to manipulate the font in use by Seta in the meantime before Stamper integrates a custom font uploader. As it stands only three fonts are available: Helvetica, Times, and Courier.
‘eddistamper_filter_rgb‘ – Maybe you want to recolor your stamp depending on the time or some other factor…
‘eddistamper_change_timestamp‘ – This filter allows you to reset it to FALSE in order to NOT change the PDF modified time to the download/stamp time, which EDDiStamper does by default. To use it:
add_filter( 'eddistamper_change_timestamp', '__return_false' );
‘eddistamper_increment‘ – This one is important and has to do with both performance and the security of your document. Please read carefully.
The PDF format offers a way to add changes to a document by simply appending the changes to the end of the file. This method is called incremental update and has the advantage that it is very fast, because only changed objects have to be written. This behavior is the default one, when calling the save()-method. Sadly it makes it easy to revert the document to the previous state by simply cutting the bytes of the last revision.
The parameter of the save()-method allows you to define that the document should be rebuild from scratch by resolving the complete object structure. Just pass SetaPDF_Core_Document::SAVE_METHOD_REWRITE to it. This task is very performance intensive, because the complete document have to be parsed, interpreted and rewritten.
Additionally it is possible to rewrite the whole document with all available objects. The benefit of this solution is that it will keep compressed object streams intact: SetaPDF_Core_Document::SAVE_METHOD_REWRITE_ALL. The disadvantage is that unused objects may be copied/written, too.
By default EDDiStamper uses incremental update, which is faster; however, less secure. If you have a system which has more memory and processing power, you can set the file to NOT increment by using the following code in a child theme functions.php file (or by using Code Snippets plugin):
add_filter( 'eddistamper_increment', '__return_false' );
That would take your PDF further into FORTRESS-LAND.
‘eddistamper_set_password‘ – A hook to allow you to fiddle with the set password.
‘eddistamper_encrypt_metadata‘ – This is set to false by default to allow your metadata to be searched in your site implementation. To also encrypt the metadata, just set it to true like so:
add_filter( 'eddistamper_encrypt_metadata', '__return_true' );
‘eddistamper_allow_filling_forms‘ – Another encryption-related hook. By default EDDiStamper encryption allows for form filling. To turn this off use the hook like so:
add_filter( 'eddistamper_allow_filling_forms', '__return_false' );