Editing PDFs
Choose the PDF Facade workflow for pages, text, tables, images, dividers, annotations, and native text.
PDF editing APIs are built on Univer commands, and they participate in undo and redo when the command has an inverse operation. Begin with the topic that matches the content you need to change.
Editing topics
- Pages and Elements covers inserting pages, enumerating editable overlays, and transforming, stacking, locking, or removing elements.
- Text and Lists covers text boxes, paragraph blocks, and semantic lists.
- Tables covers inserting and resizing grids, updating cells, and applying themes.
- Images and Dividers covers managed images and vector dividers.
- Annotations and Native Text covers the supported annotations and how to promote imported text.
Combine operations
TypeScript
const pdf = univerAPI.getActivePdf()const page = pdf?.getPageByIndex(0)if (!page) { throw new Error('No active PDF page')}const image = await page.insertImageAsync( 'https://example.com/assets/signature.png', { left: 36, top: 36, width: 144, height: 72 })image.setRotation(-4).bringToFront()Facade placement values are measured in PDF points. For an image that comes from a URL, use an absolute http or https URL. Automatic source detection does not accept relative paths.
For Unit creation, lookup, saving, and a complete overview of the wrapper, see the Univer PDFs API.
How is this guide?