compatibility.dart
11.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
/*
* Copyright (C) 2017, David PHAM-VAN <dev.nfet.net@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
part of pdf;
@deprecated
class PDFAnnot extends PdfAnnot {
static const SOLID = PdfBorderStyle.solid;
static const DASHED = PdfBorderStyle.dashed;
static const BEVELED = PdfBorderStyle.beveled;
static const INSET = PdfBorderStyle.inset;
static const UNDERLINED = PdfBorderStyle.underlined;
static const FULL_PAGE = -9999.0;
PDFAnnot(PdfPage pdfPage,
{String type,
String s,
double l,
double b,
double r,
double t,
String subtype,
PdfObject dest,
double fl,
double fb,
double fr,
double ft})
: super._create(pdfPage,
type: type,
content: s,
srcRect: PdfRect.fromLTRB(l, t, r, b),
subtype: subtype,
dest: dest,
destRect: PdfRect.fromLTRB(fl, ft, fr, fb));
factory PDFAnnot.annotation(
PdfPage pdfPage, String s, double l, double b, double r, double t) =>
PDFAnnot(pdfPage, type: "/Annot", s: s, l: l, b: b, r: r, t: t);
factory PDFAnnot.text(
PdfPage pdfPage, double l, double b, double r, double t, String s) =>
PDFAnnot(pdfPage, type: "/Text", l: l, b: b, r: r, t: t, s: s);
factory PDFAnnot.link(PdfPage pdfPage, double l, double b, double r, double t,
PdfObject dest,
[double fl = FULL_PAGE,
double fb = FULL_PAGE,
double fr = FULL_PAGE,
double ft = FULL_PAGE]) =>
PDFAnnot(pdfPage,
type: "/Link",
l: l,
b: b,
r: r,
t: t,
dest: dest,
fl: fl,
fb: fb,
fr: fr,
ft: ft);
}
@deprecated
class PDFArrayObject extends PdfArrayObject {
PDFArrayObject(PdfDocument pdfDocument, List<String> values)
: super(pdfDocument, values);
}
@deprecated
class PDFBorder extends PdfBorder {
PDFBorder(PdfDocument pdfDocument, double width,
{int style, List<double> dash})
: super(pdfDocument, width,
style: PdfBorderStyle.values[style], dash: dash);
}
@deprecated
class PDFCatalog extends PdfCatalog {
PDFCatalog(
PdfDocument pdfDocument, PdfPageList pdfPageList, PdfPageMode pageMode)
: super(pdfDocument, pdfPageList, pageMode);
}
@deprecated
class PDFDocument extends PdfDocument {
PDFDocument(
{PdfPageMode pageMode = PdfPageMode.none, DeflateCallback deflate})
: super(pageMode: pageMode, deflate: deflate);
}
@deprecated
class PDFColor extends PdfColor {
PDFColor(double r, double g, double b, [double a = 1.0]) : super(r, g, b, a);
factory PDFColor.fromInt(int color) {
final c = PdfColor.fromInt(color);
return PDFColor(c.r, c.g, c.b, c.a);
}
factory PDFColor.fromHex(String color) {
final c = PdfColor.fromHex(color);
return PDFColor(c.r, c.g, c.b, c.a);
}
}
@deprecated
class PDFFontDescriptor extends PdfFontDescriptor {
PDFFontDescriptor(PdfTtfFont ttfFont, PdfObjectStream file)
: super(ttfFont, file);
}
@deprecated
class PDFFont extends PdfFont {
factory PDFFont(PdfDocument pdfDocument, {String subtype, String baseFont}) {
return PdfFont.helvetica(pdfDocument);
}
}
@deprecated
class PDFFormXObject extends PdfFormXObject {
PDFFormXObject(PdfDocument pdfDocument) : super(pdfDocument);
}
@deprecated
class PDFGraphics extends PdfGraphics {
PDFGraphics(PdfPage page, PdfStream buf) : super(page, buf);
}
@deprecated
class PDFImage extends PdfImage {
PDFImage(PdfDocument pdfDocument,
{@required Uint8List image,
@required int width,
@required int height,
bool alpha = true,
bool alphaChannel = false})
: super(pdfDocument,
image: image,
width: width,
height: height,
alpha: alpha,
alphaChannel: alphaChannel);
}
@deprecated
class PDFInfo extends PdfInfo {
PDFInfo(PdfDocument pdfDocument,
{String title,
String author,
String creator,
String subject,
String keywords})
: super(pdfDocument,
title: title,
author: author,
creator: creator,
subject: subject,
keywords: keywords);
}
@deprecated
class PDFObjectStream extends PdfObjectStream {
PDFObjectStream(PdfDocument pdfDocument, {String type, bool isBinary = false})
: super(pdfDocument, type: type, isBinary: isBinary);
}
@deprecated
class PDFObject extends PdfObject {
PDFObject(PdfDocument pdfDocument, [String type]) : super(pdfDocument, type);
}
@deprecated
class PDFOutline extends PdfOutline {
@deprecated
static const PdfOutlineMode FITPAGE = PdfOutlineMode.fitpage;
@deprecated
static const PdfOutlineMode FITRECT = PdfOutlineMode.fitrect;
PDFOutline(PdfDocument pdfDocument,
{String title, PdfPage dest, double l, double b, double r, double t})
: super(pdfDocument,
title: title, dest: dest, rect: PdfRect.fromLTRB(l, t, r, b));
}
@deprecated
class PDFOutput extends PdfOutput {
PDFOutput(PdfStream os) : super(os);
}
@deprecated
class PDFPageFormat extends PdfPageFormat {
static const a4 = PdfPageFormat.a4;
static const a3 = PdfPageFormat.a3;
static const a5 = PdfPageFormat.a5;
static const letter = PdfPageFormat.letter;
static const legal = PdfPageFormat.legal;
static const point = PdfPageFormat.point;
static const inch = PdfPageFormat.inch;
static const cm = PdfPageFormat.cm;
static const mm = PdfPageFormat.mm;
static const A4 = a4;
static const A3 = a3;
static const A5 = a5;
static const LETTER = letter;
static const LEGAL = legal;
static const PT = point;
static const IN = inch;
static const CM = cm;
static const MM = mm;
const PDFPageFormat(double width, double height) : super(width, height);
}
@deprecated
class PDFPageList extends PdfPageList {
PDFPageList(PdfDocument pdfDocument) : super(pdfDocument);
}
@deprecated
class PDFPage extends PdfPage {
PDFPage(PdfDocument pdfDocument, {PdfPageFormat pageFormat})
: super(pdfDocument, pageFormat: pageFormat);
/// Returns the page's PageFormat.
/// @return PageFormat describing the page size in device units (72dpi)
/// use pageFormat
@deprecated
PdfPageFormat getPageFormat() {
return pageFormat;
}
/// Gets the dimensions of the page.
/// @return a Dimension object containing the width and height of the page.
/// use pageFormat.dimension
@deprecated
PdfPoint getDimension() => PdfPoint(pageFormat.width, pageFormat.height);
/// This method adds a text note to the document.
/// @param note Text of the note
/// @param x Coordinate of note
/// @param y Coordinate of note
/// @param w Width of the note
/// @param h Height of the note
/// @return Returns the annotation, so other settings can be changed.
@deprecated
PdfAnnot addNote(String note, double x, y, w, h) {
var xy1 = cxy(x, y + h);
var xy2 = cxy(x + w, y);
PdfAnnot ob = PdfAnnot.text(this,
rect: PdfRect.fromLTRB(xy1.x, xy1.y, xy2.x, xy2.y), content: note);
return ob;
}
/// Adds a hyperlink to the document.
/// @param x Coordinate of active area
/// @param y Coordinate of active area
/// @param w Width of the active area
/// @param h Height of the active area
/// @param dest Page that will be displayed when the link is activated. When
/// displayed, the zoom factor will be changed to fit the display.
/// @param vx Coordinate of view area
/// @param vy Coordinate of view area
/// @param vw Width of the view area
/// @param vh Height of the view area
/// @return Returns the annotation, so other settings can be changed.
@deprecated
PdfAnnot addLink(double x, y, w, h, PdfObject dest,
[double vx = PDFAnnot.FULL_PAGE,
vy = PDFAnnot.FULL_PAGE,
vw = PDFAnnot.FULL_PAGE,
vh = PDFAnnot.FULL_PAGE]) {
var xy1 = cxy(x, y + h);
var xy2 = cxy(x + w, y);
var xy3 = cxy(vx, vy + vh);
var xy4 = cxy(vx + vw, vy);
PdfAnnot ob = PdfAnnot.link(this,
srcRect: PdfRect.fromLTRB(xy1.x, xy1.y, xy2.x, xy2.y),
dest: dest,
destRect: PdfRect.fromLTRB(xy3.x, xy3.y, xy4.x, xy4.y));
return ob;
}
/// This method attaches an outline to the current page being generated. When
/// selected, the outline displays the top of the page.
/// @param title Outline title to attach
/// @param x Left coordinate of region
/// @param y Bottom coordinate of region
/// @param w Width of region
/// @param h Height coordinate of region
/// @return [PdfOutline] object created, for addSubOutline if required.
@deprecated
PdfOutline addOutline(String title,
{double x, double y, double w, double h}) {
PdfPoint xy1 = cxy(x, y + h);
PdfPoint xy2 = cxy(x + w, y);
PdfOutline outline = PdfOutline(pdfDocument,
title: title,
dest: this,
rect: PdfRect.fromLTRB(xy1.x, xy2.y, xy2.x, xy1.y));
pdfDocument.outline.outlines.add(outline);
return outline;
}
/// This utility method converts the y coordinate to User space
/// within the page.
/// @param x Coordinate in User space
/// @param y Coordinate in User space
/// @return y Coordinate in User space
@deprecated
double cy(double x, double y) => cxy(x, y).y;
/// This utility method converts the x coordinate to User space
/// within the page.
/// @param x Coordinate in User space
/// @param y Coordinate in User space
/// @return x Coordinate in User space
@deprecated
double cx(double x, double y) => cxy(x, y).x;
/// This utility method converts the coordinates to User space
/// within the page.
/// @param x Coordinate in User space
/// @param y Coordinate in User space
/// @return array containing the x & y Coordinate in User space
@deprecated
PdfPoint cxy(double x, double y) => PdfPoint(x, pageFormat.height - y);
}
@deprecated
class PDFPoint extends PdfPoint {
PDFPoint(double w, double h) : super(w, h);
}
@deprecated
class PDFRect extends PdfRect {
const PDFRect(double x, double y, double w, double h) : super(x, y, w, h);
}
@deprecated
class PDFStream extends PdfStream {}
@deprecated
class TTFParser extends TtfParser {
TTFParser(ByteData bytes) : super(bytes);
}
@deprecated
class PDFTTFFont extends PdfTtfFont {
PDFTTFFont(PdfDocument pdfDocument, ByteData bytes)
: super(pdfDocument, bytes);
}
@deprecated
class PDFXObject extends PdfXObject {
PDFXObject(PdfDocument pdfDocument, String subtype)
: super(pdfDocument, subtype);
}
@deprecated
enum PDFPageMode { NONE, OUTLINES, THUMBS, FULLSCREEN }
@deprecated
enum PDFLineCap { JOIN_MITER, JOIN_ROUND, JOIN_BEVEL }
@deprecated
class PDFXref extends PdfXref {
PDFXref(int id, int offset) : super(id, offset);
}