PDFDancer
Kind: class
Module/package: com.pdfdancer.client.rest
SDK: com.pdfdancer.client:pdfdancer-client-java 2.0.0
REST API client for interacting with the PDFDancer PDF manipulation service. This client provides a convenient Java interface for performing PDF operations including session management, object searching, manipulation, and retrieval. Handles authentication, session lifecycle, and HTTP communication transparently.
Declaration
public class com.pdfdancer.client.rest.PDFDancer
Members
DEFAULT_EPSILON
public static final double DEFAULT_EPSILON
addPage
public com.pdfdancer.common.model.PageRef addPage()
addPage
public com.pdfdancer.common.model.PageRef addPage(com.pdfdancer.common.request.AddPageRequest)
clearClipping
public boolean clearClipping(com.pdfdancer.common.model.ObjectRef)
clearPathGroupClipping
public boolean clearPathGroupClipping(int, java.lang.String)
createNew
public static com.pdfdancer.client.rest.PDFDancer createNew()
Creates a new PDFDancer client with a blank PDF. Uses default page size (A4), orientation (PORTRAIT), and page count (1). Uses the default HTTP client configured for https://api.pdfdancer.com. Authentication:
- If PDFDANCER_API_TOKEN or PDFDANCER_TOKEN is set, uses it
- Otherwise, automatically issues an anonymous token and proceeds
createNew
public static com.pdfdancer.client.rest.PDFDancer createNew(com.pdfdancer.common.model.PageSize, com.pdfdancer.common.model.Orientation, int)
Creates a new PDFDancer client with a blank PDF using custom parameters. Uses the default HTTP client configured for https://api.pdfdancer.com. Authentication:
- If PDFDANCER_API_TOKEN or PDFDANCER_TOKEN is set, uses it
- Otherwise, automatically issues an anonymous token and proceeds
createNew
public static com.pdfdancer.client.rest.PDFDancer createNew(java.lang.String, com.pdfdancer.common.model.PageSize, com.pdfdancer.common.model.Orientation, int, com.pdfdancer.client.rest.PdfDancerHttpClient)
Creates a new PDFDancer client with a blank PDF using custom HTTP client.
createNew
public static com.pdfdancer.client.rest.PDFDancer createNew(java.lang.String, com.pdfdancer.common.model.PageSize, com.pdfdancer.common.model.Orientation, int, java.net.http.HttpClient, java.net.URI)
Creates a new PDFDancer client with a blank PDF. Uses default page size (A4), orientation (PORTRAIT), and page count (1). Uses the default HTTP client configured for https://api.pdfdancer.com. Authentication:
- If PDFDANCER_API_TOKEN or PDFDANCER_TOKEN is set, uses it
- Otherwise, automatically issues an anonymous token and proceeds
createNew
public static com.pdfdancer.client.rest.PDFDancer createNew(java.lang.String, com.pdfdancer.common.model.PageSize, com.pdfdancer.common.model.Orientation, int, java.net.http.HttpClient)
Creates a new PDFDancer client with a blank PDF using custom HTTP client.
createNew
public static com.pdfdancer.client.rest.PDFDancer createNew(java.lang.String, com.pdfdancer.common.model.PageSize, com.pdfdancer.common.model.Orientation, int)
Creates a new PDFDancer client with a blank PDF using custom parameters. Uses the default HTTP client configured for https://api.pdfdancer.com.
createSession
public static com.pdfdancer.client.rest.PDFDancer createSession(java.io.File)
Creates a new PDFDancer client by uploading an existing PDF file. Uses the default HTTP client configured for https://api.pdfdancer.com. Authentication:
- If PDFDANCER_API_TOKEN or PDFDANCER_TOKEN is set, uses it
- Otherwise, automatically issues an anonymous token and proceeds
createSession
public static com.pdfdancer.client.rest.PDFDancer createSession(java.lang.String, byte[], com.pdfdancer.client.rest.PdfDancerHttpClient)
Creates a new PDFDancer client by uploading an existing PDF. This method initializes the client, uploads the PDF data to create a new session, and prepares the client for PDF manipulation operations.
createSession
public static com.pdfdancer.client.rest.PDFDancer createSession(java.lang.String, byte[], java.net.http.HttpClient, java.net.URI)
Creates a new PDFDancer client by uploading an existing PDF file. Uses the default HTTP client configured for https://api.pdfdancer.com.
createSession
public static com.pdfdancer.client.rest.PDFDancer createSession(java.lang.String, byte[], java.net.http.HttpClient)
Creates a new PDFDancer client by uploading an existing PDF. This method initializes the client, uploads the PDF data to create a new session, and prepares the client for PDF manipulation operations.
createSession
public static com.pdfdancer.client.rest.PDFDancer createSession(java.lang.String, java.io.File)
Creates a new PDFDancer client by uploading an existing PDF file. Uses the default HTTP client configured for https://api.pdfdancer.com.
createSession
public static com.pdfdancer.client.rest.PDFDancer createSession(java.lang.String)
Creates a new PDFDancer client by uploading an existing PDF file. Uses the default HTTP client configured for https://api.pdfdancer.com. Authentication:
- If PDFDANCER_API_TOKEN or PDFDANCER_TOKEN is set, uses it
- Otherwise, automatically issues an anonymous token and proceeds
deletePage
public java.lang.Boolean deletePage(com.pdfdancer.common.model.ObjectRef)
Deletes a page from the PDF document. This method removes the specified page from the document permanently, updating the page numbering for subsequent pages.
findFonts
public java.util.List<com.pdfdancer.common.model.Font> findFonts(java.lang.String, int)
getDocumentSnapshot
public com.pdfdancer.common.response.DocumentSnapshot getDocumentSnapshot()
Retrieves a complete snapshot of the entire PDF document. This method returns all pages with their elements, document metadata, and font catalog in a single response, significantly reducing API overhead.
getDocumentSnapshot
public com.pdfdancer.common.response.DocumentSnapshot getDocumentSnapshot(java.lang.String)
Retrieves a complete snapshot of the entire PDF document with type filtering. Only elements matching the specified types will be included in the snapshot.
getFileBytes
public byte[] getFileBytes()
Downloads the current state of the PDF document with all modifications applied. This method retrieves the complete PDF file as binary data, reflecting all changes made during the current session.
getHttpClient
public com.pdfdancer.client.rest.PdfDancerHttpClient getHttpClient()
Gets the HTTP client used by this PDFDancer instance. Useful for testing and creating new instances with the same client.
getPage
public com.pdfdancer.common.model.ObjectRef getPage(int)
Retrieves a reference to a specific page by its page number. This method returns an object reference for the specified page, enabling targeted page operations.
getPages
public java.util.List<com.pdfdancer.common.model.PageRef> getPages()
Retrieves references to all pages in the PDF document. This method returns a list of object references for every page in the current document, enabling page-level operations.
getPageSnapshot
public com.pdfdancer.common.response.PageSnapshot getPageSnapshot(int, java.lang.String)
Retrieves a snapshot of a single PDF page with type filtering. Only elements matching the specified types will be included in the snapshot.
getPageSnapshot
public com.pdfdancer.common.response.PageSnapshot getPageSnapshot(int)
Retrieves a snapshot of a single PDF page. This method returns the page metadata and all elements in a single response.
getPathGroups
public java.util.List<com.pdfdancer.client.rest.PathGroupReference> getPathGroups(int)
getToken
public java.lang.String getToken()
getTypedDocumentSnapshot
public <T extends com.pdfdancer.common.model.ObjectRef> com.pdfdancer.client.rest.TypedDocumentSnapshot<T> getTypedDocumentSnapshot(java.lang.Class<T>, java.lang.String)
getTypedPageSnapshot
public <T extends com.pdfdancer.common.model.ObjectRef> com.pdfdancer.client.rest.TypedPageSnapshot<T> getTypedPageSnapshot(int, java.lang.Class<T>, java.lang.String)
movePage
public boolean movePage(int, int)
Moves a page from one position to another within the PDF document.
newBezier
public com.pdfdancer.client.rest.BezierBuilder newBezier(int)
newImage
public com.pdfdancer.client.rest.ImageBuilder newImage()
newImage
public com.pdfdancer.client.rest.ImageBuilder newImage(int)
newLine
public com.pdfdancer.client.rest.LineBuilder newLine(int)
newPage
public com.pdfdancer.client.rest.PageBuilder newPage()
Creates a new page builder for fluent page creation.
newPath
public com.pdfdancer.client.rest.PathBuilder newPath(int)
newRectangle
public com.pdfdancer.client.rest.RectangleBuilder newRectangle(int)
page
public com.pdfdancer.client.rest.PageBuilder page()
Deprecated: Use newPage() instead. This method will be removed in a future release.
page
public com.pdfdancer.client.rest.PDFDancer$PageClient page(int)
Creates a client for working with a specific page.
pages
public java.util.List<com.pdfdancer.client.rest.PDFDancer$PageClient> pages()
Returns page-scoped clients in document order.
registerFont
public java.lang.String registerFont(java.io.File)
save
public void save(java.lang.String)
selectElements
public java.util.List<com.pdfdancer.common.model.ObjectRef> selectElements()
selectFormFieldByName
public java.util.Optional<com.pdfdancer.client.rest.FormFieldReference> selectFormFieldByName(java.lang.String)
Selects a single form field with the specified name.
selectFormFields
public java.util.List<com.pdfdancer.client.rest.FormFieldReference> selectFormFields()
selectFormFieldsByName
public java.util.List<com.pdfdancer.client.rest.FormFieldReference> selectFormFieldsByName(java.lang.String)
selectForms
public java.util.List<com.pdfdancer.client.rest.FormXObjectReference> selectForms()
selectImages
public java.util.List<com.pdfdancer.client.rest.ImageReference> selectImages()
selectPaths
public java.util.List<com.pdfdancer.client.rest.PathReference> selectPaths()
text
public com.pdfdancer.client.rest.TextClient text()