Read more about SimplePDF Embed »
Join Our Discord
·
Follow us on Twitter
Open PDF files with SimplePDF, using a simple script tag.
Add this script in the head of your webpage:
<script src="https://unpkg.com/@simplepdf/web-embed-pdf" defer></script>
Replace companyIdentifier
with your own
<script
src="https://unpkg.com/@simplepdf/web-embed-pdf"
companyIdentifier="yourcompany"
defer
></script>
Anchor links (a
) with an href pointing to a PDF file (.pdf
) or SimplePDF forms are automatically opened in SimplePDF
Exclude any anchor tags from opening SimplePDF by adding the class exclude-simplepdf
:
<a href="/example.pdf" class="exclude-simplepdf">Doesn't open with SimplePDF</a>
Add a class simplepdf
to any anchor tag to open them with SimplePDF:
<a href="/example_without_pdf_extension" class="simplepdf"
>Open with SimplePDF</a
>
In case you want to have more control over how the modal for editing PDFs is invoked, you can directly interact with the simplePDF
global variable that is injected in the window
by the script.
SimplePDF currently supports the following languages automatically detects the language of the page (using the lang
attribute) and opens the editor in the following languages:
- English (
en
) - German (
de
) - Spanish (
es
) - French (
fr
) - Italian (
it
) - Portuguese (
pt
)
If you wish to override the automatic detection, you can specify the locale
attribute on the script tag as follows:
<script
src="https://unpkg.com/@simplepdf/web-embed-pdf"
companyIdentifier="yourcompany"
locale="fr"
defer
></script>
window.simplePDF.openEditor({ href: "publicly_available_url_pdf" });
window.simplePDF.openEditor({ href: null });
window.simplePDF.closeEditor();
The context is sent as part of the submission via the webhooks integration: read more
Use-cases:
- Link a submission back to a customer
- Specify the environment / configuration of the editor
Do not store sensitive information in the context (!!) as it is available locally to anyone inspecting the code
window.simplePDF.openEditor({
href: "publicly_available_url_pdf",
context: {
customer_id: "123",
environment: "prod",
},
});