Shortcodes

A [pdfink] shortcode can be used anywhere within WordPress where shortcodes are supported. For most users, this will primarily be within the content of a WordPress post, page, or widget. The [pdfink] shortcode will output a link, which when clicked, will manipulate the corresponding PDF before delivery.

Shortcode Generation

To create a shortcode, go to WordPress settings menu -> PDF Ink -> Shortcodes and click the “Add New Shortcode” button. You can create a shortcode just like you might create a WordPress page, and return to edit it later… Or just create a new one. You can create as many shortcodes as you would like.

The most crucial part of a shortcode created using “Add New Shortcode” is the post ID. All the other data, such as the file location, is stored secret in your WP database and is accessed behind-the-scenes, and only when a file is requested. Your users will not have access to the file location. The whole point is keeping the file safe, right?

Shortcode Title

If you do not give your shortcode a descriptive Title, the shortcode [pdfink id=xxx] will be saved as the title (since that can be handy). Otherwise, it is okay to give your shortcode a descriptive title so that you can tell them apart in the shortcode listing page (yourwebsite.com/wp-admin/edit.php?post_type=pdfink_shortcode). The title does not show on the frontend.

Shortcode Value

Basic PDF Ink shortcode values look like [pdfink id=”1234″]. At all times, your shortcode will be printed on the right of the PDF Ink shortcode editor screen, highlighted in yellow. Copy that to your clipboard, and paste it in your post. It is also possible to enter it programmatically into your PHP code, but if you’re doing that you might as well look into manual shortcode creation.

Screenshot of PDF Ink shortcode generation screen, part of WordPress

For what it’s worth, Gutenberg has a nice “shortcode” block, but if you’re not using blocks, just include the bracketed shortcode [pdfink…] (everything highlighted in yellow) in your WP content.

On the frontend, your shortcode will be replaced with a styled download link. Most importantly, the original file location is kept hidden from the user and the PDF file can be stamped and/or passworded before delivery.

Manual Shortcode Creation

If you want a little more control over your shortcodes, you can write them out yourself in your WordPress content. Start with an opening bracket “[“, then type pdfink. Then add parameters to flesh out how you want your link to function and what you want to happen to your file.

Examples

Following are examples of PDF Ink shortcodes and how to write them programmatically if you aren’t creating them using the PDF Ink settings.

The next shortcode will open a modal when “click to download” is clicked. The modal has first name, last name, and email fields but only email is required. When “Get PDF” is clicked, the stamped and/or encrypted PDF is downloaded by force download method.

[pdfink file_id=6845 text="click to download" style="modal" fields="first,last,email" required="email" download_method="force" submit-text="Get PDF"]

The next shortcode will show an inline form requiring an email address, and if the user isn’t logged in, will require that they are logged in first. If there is WordPress user data such as first name and last name stored in the database, that can be used for stamping. The URL is stored to a hash table in the WP database and is not revealed to your users.

[pdfink url="https://mysite.com/wp-content/uploads/2026/03/file.pdf" style="form" fields="email" required="email" login=true]

The next shortcode will show a simple inline link and when clicked will redirect to a stamped file. The file is stored in the WP media library under ID 5309. There are no fields, required or submit_text attributes for this shortcode because stamping fires on the click of the link. Login is required, though.

[pdfink file_id="5309" style="link" login=true text="Click to download training manual"]

Shortcode Parameters

The following parameters are shown within the sample shortcodes above:

file_id (integer)WP Media Library attachment ID of the PDF
url (string)Actual URL to the file. This is stored obfuscated in a pdfink_links WPDB table and is not visible to your user.
text (string)Text to display, prompting a click. For example, “Click to download!”
style (string)How to display the prompt/file request: link (“link“), link to a popup modal form (“modal“), or an inline form (“form“). “ajax-link” is another less-recommended option. It is also possible to set up a PDF embed on the page using “embed-pdf-object” or “embed-adobe“. The Adobe embed style requires an SDK API key be saved in PDF Ink settings.
fields (string, comma-separated)If using a form or modal style, specify fields to show on the form: first, last, email. The shortcode above will show all three.
required (string, comma-separated)Specify fields to require on the form: first, last, email. The shortcode above requires only email be filled.
submit_text (string)Text to display as form submit button. For example, “Go!” or “Submit”
login (boolean)Require a user be logged in to your WordPress website before download. Default false.
download_method (‘force’ or ‘x-accel’)Serve the file as forced download or using X-Accel-Redirect/X-Sendfile. AJAX downloads are by redirect, which is not secure, which is why it isn’t highly recommended to use AJAX.
skip (boolean)default false. set to true to skip manipulation and display. Useful for embedded display; otherwise it’s sorta silly. Skipping is not possible with AJAX links.