---
title: "DataTables PDF Export &#8211; How to display links"
date: 2026-04-23
author: "GravityKit"
link: "https://www.gravitykit.com/docs/gravityview-pro/datatables/datatables-pdf-export-how-to-display-links/"
---

By default, DataTables does not include links on a [PDF export](https://www.gravitykit.com/docs/gravityview-pro/datatables/datatables-buttons/). With the help of the code snippet below, you'll be able to display working links on your PDFs.

A sample View containing links in some columns:

![DataTable with company names as clickable links, export options, and a Delete Entry button per row](https://www.gravitykit.com/wp-content/uploads/2025/10/file-a76xEtUMZr.png)
*The View exported as PDF doesn't include links, by default:*![Data table showing sample company data with departments, websites, and job titles](https://www.gravitykit.com/wp-content/uploads/2025/10/file-Yo9PxzzpKh.png)
*The PDF export containing after applying the code snippet:*![Data table with entry ID, company name, department, website links, job title, and delete entry options](https://www.gravitykit.com/wp-content/uploads/2025/10/file-SxQmeXJW9Y.png)
*The code:*
```
document.addEventListener("DOMContentLoaded",function(){wp.hooks.addFilter("gk.datatables.options","dt-custom-code",function(t){return t.buttons=t.buttons.map(t=>{if("pdf"!==t.extend)return t;let e=t.exportOptions?.format?.body;return t.exportOptions=t.exportOptions||{},t.exportOptions.format=t.exportOptions.format||{},t.exportOptions.format.body=function(t,o,n,r){let i=e?e(t,o,n,r):t;return t.startsWith("{t.table&&t.table.body.forEach(t=>{t.forEach(t=>{"string"==typeof t.text&&t.text.startsWith("
```

```
document.addEventListener("DOMContentLoaded",function(){wp.hooks.addFilter("gk.datatables.options","dt-custom-code",function(t){return t.buttons=t.buttons.map(t=>{if("pdf"!==t.extend)return t;let e=t.exportOptions?.format?.body;return t.exportOptions=t.exportOptions||{},t.exportOptions.format=t.exportOptions.format||{},t.exportOptions.format.body=function(t,o,n,r){let i=e?e(t,o,n,r):t;return t.startsWith("a")?t:i},t.customize=function(t){t.content.forEach(t=>{t.table&&t.table.body.forEach(t=>{t.forEach(t=>{"string"==typeof t.text&&t.text.startsWith("a")&&(t.text={text:jQuery(t.text).text(),link:jQuery(t.text).attr("href"),style:"linkStyle"})})})}),t.styles.linkStyle={decoration:"underline",color:"blue"}},t}),t})});
```

This code has been minified to make it easy to be copied. Here's a [link to the full code](https://gist.github.com/rafaehlers/945fdff9f2328d394ec2e6d16a55d5b4).

This JavaScript code should be copied and pasted, as it is, on the Custom JavaScript editor that sits inside View Editor > View Settings metabox > Custom Code tab.

![Custom JavaScript code for configuring DataTables PDF export settings in GravityView](https://www.gravitykit.com/wp-content/uploads/2025/10/file-gQgXe30rTp-1.png)