pdfdancer-client-typescript 1.0.7 → 1.0.8

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.
package/src/types.ts CHANGED
@@ -1,4 +1,4 @@
1
- import {FormFieldRef, ObjectRef, ObjectType, Position} from "./models";
1
+ import {FormFieldRef, ObjectRef, ObjectType, Position, TextObjectRef} from "./models";
2
2
  import {PDFDancer} from "./pdfdancer_v1";
3
3
  import {ParagraphBuilder} from "./paragraph-builder";
4
4
 
@@ -87,25 +87,92 @@ export class FormFieldObject extends BaseObject<FormFieldRef> {
87
87
  }
88
88
  }
89
89
 
90
- export class ParagraphObject extends BaseObject {
90
+ export class ParagraphObject extends BaseObject<TextObjectRef> {
91
91
 
92
- static fromRef(_client: PDFDancer, objectRef: ObjectRef) {
93
- return new ParagraphObject(_client, objectRef.internalId, objectRef.type, objectRef.position);
92
+ private fontName: string | undefined;
93
+ private fontSize: number | undefined;
94
+ private lineSpacings: number[] | null | undefined;
95
+ private children: TextObjectRef[] | undefined;
96
+ private text: string | undefined;
97
+
98
+ static fromRef(_client: PDFDancer, objectRef: TextObjectRef) {
99
+ let paragraphObject = new ParagraphObject(_client, objectRef.internalId, objectRef.type, objectRef.position);
100
+ paragraphObject.setFontName(objectRef.fontName);
101
+ paragraphObject.setFontSize(objectRef.fontSize);
102
+ paragraphObject.setLineSpacings(objectRef.lineSpacings);
103
+ paragraphObject.setText(objectRef.text);
104
+ paragraphObject.setChildren(objectRef.children);
105
+ paragraphObject.ref = () => objectRef;
106
+ return paragraphObject;
94
107
  }
95
108
 
96
109
  edit() {
97
110
  return new ParagraphBuilder(this._client, this.ref());
98
111
  }
112
+
113
+ private setFontName(fontName: string | undefined) {
114
+ this.fontName = fontName;
115
+ }
116
+
117
+ private setFontSize(fontSize: number | undefined) {
118
+ this.fontSize = fontSize;
119
+ }
120
+
121
+ private setLineSpacings(lineSpacings: number[] | null | undefined) {
122
+ this.lineSpacings = lineSpacings;
123
+ }
124
+
125
+ private setText(text: string | undefined) {
126
+ this.text = text;
127
+ }
128
+
129
+ private setChildren(children: TextObjectRef[] | undefined) {
130
+ this.children = children;
131
+ }
99
132
  }
100
133
 
101
- export class TextLineObject extends BaseObject {
102
- static fromRef(_client: PDFDancer, objectRef: ObjectRef) {
103
- return new TextLineObject(_client, objectRef.internalId, objectRef.type, objectRef.position);
134
+ export class TextLineObject extends BaseObject<TextObjectRef> {
135
+
136
+ private fontName: string | undefined;
137
+ private fontSize: number | undefined;
138
+ private lineSpacings: number[] | null | undefined;
139
+ private children: TextObjectRef[] | undefined;
140
+ private text: string | undefined;
141
+
142
+ static fromRef(_client: PDFDancer, objectRef: TextObjectRef) {
143
+ let textLineObject = new TextLineObject(_client, objectRef.internalId, objectRef.type, objectRef.position);
144
+ textLineObject.setFontName(objectRef.fontName);
145
+ textLineObject.setFontSize(objectRef.fontSize);
146
+ textLineObject.setLineSpacings(objectRef.lineSpacings);
147
+ textLineObject.setText(objectRef.text);
148
+ textLineObject.setChildren(objectRef.children);
149
+ textLineObject.ref = () => objectRef;
150
+ return textLineObject;
104
151
  }
105
152
 
106
153
  edit() {
107
154
  return new TextLineBuilder(this._client, this.ref());
108
155
  }
156
+
157
+ private setFontName(fontName: string | undefined) {
158
+ this.fontName = fontName;
159
+ }
160
+
161
+ private setFontSize(fontSize: number | undefined) {
162
+ this.fontSize = fontSize;
163
+ }
164
+
165
+ private setLineSpacings(lineSpacings: number[] | null | undefined) {
166
+ this.lineSpacings = lineSpacings;
167
+ }
168
+
169
+ private setText(text: string | undefined) {
170
+ this.text = text;
171
+ }
172
+
173
+ private setChildren(children: TextObjectRef[] | undefined) {
174
+ this.children = children;
175
+ }
109
176
  }
110
177
 
111
178