Use Cases
Clickable PDF Links
Enable PDF links through htmlToPdfOptions.enableLinks:
Clickable PDF Links
Enable PDF links through htmlToPdfOptions.enableLinks:
const htmlToPdfOptions = {
enableLinks: true,
}
<Html2Pdf :html-to-pdf-options="htmlToPdfOptions">
<template #pdf-content>
<a href="https://www.npmjs.com/package/vue-pdf-export">
Open vue-pdf-export on npm
</a>
</template>
</Html2Pdf>
In selectable-text mode, anchors are converted into real PDF link annotations, so compatible PDF viewers can show the link cursor and open the URL when clicked.
For best selectable-text rendering, keep PDF link styling straightforward. Very large letter-spacing, transforms, or highly compressed fixed-width buttons can create visual differences because browser and PDF font metrics are not identical.
Recommended PDF-friendly link CSS:
.pdf-link {
display: inline-flex;
align-items: center;
width: auto;
max-width: 100%;
padding: 8px 12px;
font-weight: 700;
line-height: 1.2;
letter-spacing: 0;
white-space: nowrap;
text-decoration: underline;
}
