PdfDocument.open(bytes, password?) | A PDF, or a .docx laid out into pages |
PdfDocument.create(), PdfDocument.sample() | An empty document; a sample document |
pageCount, info(), setInfo() | Page count and metadata |
renderPage(page, scale) | RGBA pixels: { width, height, data } |
renderPagePng(page, scale) | PNG bytes |
pageText(page), pageTextLayout(page) | Plain text; text lines with their positions |
search(query, { caseSensitive }) | [{ page, text, quadPoints }] |
textBlocks(page) | The page’s text in blocks (paragraphs, headings, table cells) with runs of font, size and colour |
replaceText(page, block, text), editText(page, spec) | Edit the page’s own text: replace a block (keeping its style), set styled runs, add or remove text; one undo step |
textEditFonts(page, spec) | Fonts an edit needs that are not loaded yet |
pageImages(page) | The page’s own pictures with their place: { images: [{ id, rect, matrix, width, height }] } |
transformImage(page, id, t), replaceImage(page, id, bytes), deleteImage(page, id), addImage(page, bytes, rect?) | Move, resize or turn a picture, put another one in its place, take it off, or add a PNG or JPEG; one undo step |
pageTables(page), setTable(page, id, spec), deleteTable(page, id) | Tables drawn on the page: { x, top, cols, rows, border, borderWidth, pad, cells: [[{ paragraphs, align, fill }]] }; rows grow to hold their text; editable again after saving |
insertBlankPage(), deletePage(), movePage(), rotatePage(), appendPdf(bytes) | Page tools |
annotations(page?), annotation(id) | Read annotations |
addAnnotation(page, spec), updateAnnotation(id, patch), deleteAnnotation(id) | Change annotations |
moveAnnotation(), reorderAnnotation(), flatten() | Position, stacking order, flatten into the page |
exportAnnotations(), importAnnotations(list) | Annotations as JSON |
renderAnnotationPng(id, scale) | One annotation alone as a PNG |
undo(), redo() | History |
save({ incremental }), close() | Bytes out; free the document |
setLicenseKey(key, { host, app, licenseServer }), licenseStatus(), licenseCheck() | Your licence key (checked offline). Without a key nothing opens (UdsError with code LICENSE_KEY_NEEDED); a trial key works with a watermark. A key is for one SDK: a Web SDK key here in Node.js (or a Server SDK key in a browser) throws UdsError with code LICENSE_WRONG_SDK |