PDFDancer
Kind: class
Module/package: pdfdancer_v2
SDK: pdfdancer-client-typescript 2.0.0
REST API client for interacting with the PDFDancer PDF manipulation service. This client provides a convenient TypeScript interface for performing PDF operations including session management, object searching, manipulation, and retrieval. Handles authentication, session lifecycle, and HTTP communication transparently.
Declaration
class PDFDancer
Members
constructor
constructor(): PDFDancer
clearClipping
clearClipping(objectRef: ObjectRef): Promise<boolean>
clearPathGroupClipping
clearPathGroupClipping(pageNumber: number, groupId: string): Promise<boolean>
deletePage
deletePage(pageNumber: number): Promise<boolean>
Deletes the page at the specified page number.
findFonts
findFonts(fontName: string, fontSize: number): Promise<Font[]>
Finds available fonts matching the specified name and size.
getBytes
getBytes(): Promise<Uint8Array>
Downloads the current state of the PDF document with all modifications applied.
getDocumentSnapshot
getDocumentSnapshot(types?: ObjectType[]): Promise<DocumentSnapshot>
Gets a snapshot of the entire PDF document. Returns page count, fonts, and snapshots of all pages with their elements.
getPageSnapshot
getPageSnapshot(pageNumber: number, types?: ObjectType[]): Promise<PageSnapshot>
Gets a snapshot of a specific page. Returns the page reference and all elements on that page.
movePage
movePage(fromPage: number, toPage: number): Promise<boolean>
Moves an existing page to a new position.
new
new(options?: { pageSize?: PageSizeInput; orientation?: Orientation; initialPageCount?: number; }, token?: string, baseUrl?: string, timeout?: number, retryConfig?: RetryConfig): Promise<PDFDancer>
Creates a new, blank PDF document with the specified parameters.
newBezier
newBezier(pageNumber: number): BezierBuilder
newImage
newImage(pageNumber?: number): ImageBuilder
newLine
newLine(pageNumber: number): LineBuilder
newPage
newPage(): PageBuilder
newPath
newPath(pageNumber?: number): PathBuilder
newRectangle
newRectangle(pageNumber: number): RectangleBuilder
open
open(pdfData: string | Uint8Array | ArrayBuffer, token?: string, baseUrl?: string, timeout?: number, retryConfig?: RetryConfig): Promise<PDFDancer>
Opens a PDF document for manipulation.
page
page(pageNumber: number): PageClient
Creates a client for working with a specific page.
pages
pages(): Promise<PageClient[]>
registerFont
registerFont(ttfFile: string | Uint8Array): Promise<string>
Registers a custom font for use in PDF operations.
save
save(filename: string): Promise<void>
Saves the current PDF to a file (browser environment). Downloads the PDF in the browser.
selectElements
selectElements(types?: ObjectType[]): Promise<ObjectRef[]>
selectForm
selectForm(): Promise<FormXObject>
selectFormFieldByName
selectFormFieldByName(fieldName: string): Promise<FormFieldObject>
selectFormFields
selectFormFields(): Promise<FormFieldObject[]>
selectFormFieldsByName
selectFormFieldsByName(fieldName: string): Promise<FormFieldObject[]>
selectForms
selectForms(): Promise<FormXObject[]>
selectImage
selectImage(): Promise<ImageObject>
selectImages
selectImages(): Promise<ImageObject[]>
selectPath
selectPath(): Promise<PathObject>
selectPaths
selectPaths(): Promise<PathObject[]>
text
text(): TextClient