Content Editing (text and images)

Edit PDF text and images using this JavaScript sample (no servers or other external dependencies required). This sample allows text and images to be edited, moved and deleted from a PDF.This sample works on all browsers and mobile devices without using plug-ins. Learn more about our Web SDK.

1// eslint-disable-next-line no-undef
2const WebViewerConstructor = isWebComponent() ? WebViewer.WebComponent : WebViewer;
3
4WebViewerConstructor(
5 {
6 path: '../../../lib',
7 initialDoc: 'https://pdftron.s3.amazonaws.com/downloads/pl/demo-annotated.pdf',
8 enableFilePicker: true,
9 },
10 document.getElementById('viewer')
11).then(instance => {
12 samplesSetup(instance);
13
14 instance.UI.enableFeatures([instance.UI.Feature.ContentEdit]);
15 instance.UI.setToolbarGroup(instance.UI.ToolbarGroup.EDIT_TEXT);
16
17 document.getElementById('file-picker').onchange = e => {
18 const file = e.target.files[0];
19 if (file) {
20 instance.UI.loadDocument(file);
21 }
22 };
23
24 document.getElementById('url-form').onsubmit = e => {
25 e.preventDefault();
26 instance.UI.loadDocument(document.getElementById('url').value);
27 };
28});

Did you find this helpful?

Trial setup questions?

Ask experts on Discord

Need other help?

Contact Support

Pricing or product questions?

Contact Sales