-
Notifications
You must be signed in to change notification settings - Fork 6
Using this Extension
An example may be linking to Competition Terms and Conditions page will take the entire page's output after the XSLT has run and generate a PDF from the resulting HTML. The user will be prompted to download the PDF directly with the filename being the $current-page
value.
- On the page you wish to generate into a PDF, add the page type of
pdf
This may be used when sending an email to a user that requires attachments using the Email Template Filter. URL to PDF will search for sections in the resulting HTML between any element with the data attribute data-utp='attachment'
. The HTML inside these elements will be treated as individual PDF's and be replaced by <link rel='attachment' href='{path/to/pdf}' />
. When this page is used by the ETF extension, it will take the <link />
elements and add them as attachments to the email sent.
- On the page that will have the attachments, add the page type of
pdf-attachment
- For areas of the page that you would like as PDF's, add the data attribute
data-utp='attachment'
to the parent element - If you would like the output PDF to have a particular name, add
data-utp-filename='output-name'
. Note that whatever is added here will be sanitized and converted to a valid filename usingLang::createFilename
. If this attribute is not present, the filename will be the md5 has of thewebsite
andcurrent-page
parameters.
The resulting page will now have the PDF areas replaced with <link />
elements that are readable by the Email Template Filter extension.
Source
<div data-utp='attachment' data-utp-filename='Your tickets to the best show on the planet'>
<h1>This will be inside a PDF!</h1>
</div>
Will become
<link rel='attachment' href='http://example.com/manifest/tmp/your-tickets-to-the-best-show-on-the-planet.pdf' />