pdfdancer-client-typescript 2.0.6 → 2.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/README.md +10 -4
  2. package/dist/models.d.ts +9 -2
  3. package/dist/models.d.ts.map +1 -1
  4. package/dist/models.js +23 -1
  5. package/dist/models.js.map +1 -1
  6. package/dist/pdfdancer_v1.d.ts +5 -0
  7. package/dist/pdfdancer_v1.d.ts.map +1 -1
  8. package/dist/pdfdancer_v1.js +54 -1
  9. package/dist/pdfdancer_v1.js.map +1 -1
  10. package/dist/types.d.ts +38 -3
  11. package/dist/types.d.ts.map +1 -1
  12. package/dist/types.js +158 -2
  13. package/dist/types.js.map +1 -1
  14. package/dist/version.d.ts +1 -1
  15. package/dist/version.js +1 -1
  16. package/package.json +1 -1
  17. package/dist/__tests__/assertions.d.ts +0 -2
  18. package/dist/__tests__/assertions.d.ts.map +0 -1
  19. package/dist/__tests__/assertions.js +0 -11
  20. package/dist/__tests__/assertions.js.map +0 -1
  21. package/dist/__tests__/e2e/pdf-assertions.d.ts +0 -36
  22. package/dist/__tests__/e2e/pdf-assertions.d.ts.map +0 -1
  23. package/dist/__tests__/e2e/pdf-assertions.js +0 -218
  24. package/dist/__tests__/e2e/pdf-assertions.js.map +0 -1
  25. package/dist/__tests__/e2e/test-drawing-helpers.d.ts +0 -148
  26. package/dist/__tests__/e2e/test-drawing-helpers.d.ts.map +0 -1
  27. package/dist/__tests__/e2e/test-drawing-helpers.js +0 -343
  28. package/dist/__tests__/e2e/test-drawing-helpers.js.map +0 -1
  29. package/dist/__tests__/e2e/test-helpers.d.ts +0 -44
  30. package/dist/__tests__/e2e/test-helpers.d.ts.map +0 -1
  31. package/dist/__tests__/e2e/test-helpers.js +0 -233
  32. package/dist/__tests__/e2e/test-helpers.js.map +0 -1
  33. package/dist/client-v1.d.ts +0 -157
  34. package/dist/client-v1.d.ts.map +0 -1
  35. package/dist/client-v1.js +0 -576
  36. package/dist/client-v1.js.map +0 -1
  37. package/dist/client-v2.d.ts +0 -129
  38. package/dist/client-v2.d.ts.map +0 -1
  39. package/dist/client-v2.js +0 -696
  40. package/dist/client-v2.js.map +0 -1
@@ -1,157 +0,0 @@
1
- /**
2
- * PDFDancer TypeScript Client V1
3
- *
4
- * A TypeScript client that provides session-based PDF manipulation operations with strict validation.
5
- */
6
- import { Font, FormFieldRef, Image, ObjectRef, ObjectType, Paragraph, Position } from './models';
7
- import { ParagraphBuilder } from './paragraph-builder';
8
- /**
9
- * REST API client for interacting with the PDFDancer PDF manipulation service.
10
- * This client provides a convenient TypeScript interface for performing PDF operations
11
- * including session management, object searching, manipulation, and retrieval.
12
- * Handles authentication, session lifecycle, and HTTP communication transparently.
13
- *
14
- */
15
- export declare class ClientV1 {
16
- private _token;
17
- private _baseUrl;
18
- private _readTimeout;
19
- private _pdfBytes;
20
- private _sessionId;
21
- /**
22
- * Creates a new client with PDF data.
23
- * This constructor initializes the client, uploads the PDF data to create
24
- * a new session, and prepares the client for PDF manipulation operations.
25
- */
26
- constructor(token: string, pdfData: Uint8Array | File | ArrayBuffer, baseUrl?: string, readTimeout?: number);
27
- /**
28
- * Initialize the client by creating a session.
29
- * Must be called after constructor before using the client.
30
- */
31
- private init;
32
- static create(token: string, pdfData: Uint8Array, baseUrl: string, timeout?: number): Promise<ClientV1>;
33
- /**
34
- * Process PDF data from various input types with strict validation.
35
- */
36
- private _processPdfData;
37
- /**
38
- * Extract meaningful error messages from API response.
39
- * Parses JSON error responses with _embedded.errors structure.
40
- */
41
- private _extractErrorMessage;
42
- /**
43
- * Creates a new PDF processing session by uploading the PDF data.
44
- */
45
- private _createSession;
46
- /**
47
- * Make HTTP request with session headers and error handling.
48
- */
49
- private _makeRequest;
50
- /**
51
- * Searches for PDF objects matching the specified criteria.
52
- * This method provides flexible search capabilities across all PDF content,
53
- * allowing filtering by object type and position constraints.
54
- */
55
- find(objectType?: ObjectType, position?: Position): Promise<ObjectRef[]>;
56
- /**
57
- * Searches for paragraph objects at the specified position.
58
- */
59
- findParagraphs(position?: Position): Promise<ObjectRef[]>;
60
- /**
61
- * Searches for image objects at the specified position.
62
- */
63
- findImages(position?: Position): Promise<ObjectRef[]>;
64
- /**
65
- * Searches for form X objects at the specified position.
66
- */
67
- findFormXObjects(position?: Position): Promise<ObjectRef[]>;
68
- /**
69
- * Searches for vector path objects at the specified position.
70
- */
71
- findPaths(position?: Position): Promise<ObjectRef[]>;
72
- /**
73
- * Searches for text line objects at the specified position.
74
- */
75
- findTextLines(position?: Position): Promise<ObjectRef[]>;
76
- /**
77
- * Searches for form fields at the specified position.
78
- * Returns FormFieldRef objects with name and value properties.
79
- */
80
- findFormFields(position?: Position): Promise<FormFieldRef[]>;
81
- /**
82
- * Retrieves references to all pages in the PDF document.
83
- */
84
- getPages(): Promise<ObjectRef[]>;
85
- /**
86
- * Retrieves a reference to a specific page by its page index.
87
- */
88
- getPage(pageIndex: number): Promise<ObjectRef | null>;
89
- /**
90
- * Deletes a page from the PDF document.
91
- */
92
- deletePage(pageRef: ObjectRef): Promise<boolean>;
93
- /**
94
- * Deletes the specified PDF object from the document.
95
- */
96
- delete(objectRef: ObjectRef): Promise<boolean>;
97
- /**
98
- * Moves a PDF object to a new position within the document.
99
- */
100
- move(objectRef: ObjectRef, position: Position): Promise<boolean>;
101
- /**
102
- * Changes the value of a form field.
103
- */
104
- changeFormField(formFieldRef: FormFieldRef, newValue: string): Promise<boolean>;
105
- /**
106
- * Adds an image to the PDF document.
107
- */
108
- addImage(image: Image, position?: Position): Promise<boolean>;
109
- /**
110
- * Adds a paragraph to the PDF document.
111
- */
112
- addParagraph(paragraph: Paragraph): Promise<boolean>;
113
- /**
114
- * Internal method to add any PDF object.
115
- */
116
- private _addObject;
117
- /**
118
- * Modifies a paragraph object or its text content.
119
- */
120
- modifyParagraph(objectRef: ObjectRef, newParagraph: Paragraph | string): Promise<boolean>;
121
- /**
122
- * Modifies a text line object.
123
- */
124
- modifyTextLine(objectRef: ObjectRef, newText: string): Promise<boolean>;
125
- /**
126
- * Finds available fonts matching the specified name and size.
127
- */
128
- findFonts(fontName: string, fontSize: number): Promise<Font[]>;
129
- /**
130
- * Registers a custom font for use in PDF operations.
131
- */
132
- registerFont(ttfFile: Uint8Array | File): Promise<string>;
133
- /**
134
- * Downloads the current state of the PDF document with all modifications applied.
135
- */
136
- getPdfFile(): Promise<Uint8Array>;
137
- getXmlFile(): Promise<String>;
138
- /**
139
- * Saves the current PDF to a file (browser environment).
140
- * Downloads the PDF in the browser.
141
- */
142
- savePdf(filename?: string): Promise<void>;
143
- /**
144
- * Parse JSON object data into ObjectRef instance.
145
- */
146
- private _parseObjectRef;
147
- private _parseFormFieldRef;
148
- /**
149
- * Parse JSON position data into Position instance.
150
- */
151
- private _parsePosition;
152
- /**
153
- * Creates a new ParagraphBuilder for fluent paragraph construction.
154
- */
155
- paragraphBuilder(): ParagraphBuilder;
156
- }
157
- //# sourceMappingURL=client-v1.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client-v1.d.ts","sourceRoot":"","sources":["../src/client-v1.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,OAAO,EAMH,IAAI,EACJ,YAAY,EACZ,KAAK,EAIL,SAAS,EACT,UAAU,EACV,SAAS,EACT,QAAQ,EAGX,MAAM,UAAU,CAAC;AAClB,OAAO,EAAC,gBAAgB,EAAC,MAAM,qBAAqB,CAAC;AAErD;;;;;;GAMG;AACH,qBAAa,QAAQ;IACjB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,SAAS,CAAa;IAC9B,OAAO,CAAC,UAAU,CAAU;IAE5B;;;;OAIG;gBAEC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,UAAU,GAAG,IAAI,GAAG,WAAW,EACxC,OAAO,GAAE,MAAgC,EACzC,WAAW,GAAE,MAAc;IAc/B;;;OAGG;YAC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