1 | #include "ConstructorsHolder.h"
|
2 | #include "PDFReaderDriver.h"
|
3 | #include "DocumentCopyingContextDriver.h"
|
4 | #include "PDFWriterDriver.h"
|
5 | #include "OutputFileDriver.h"
|
6 | #include "ObjectsContextDriver.h"
|
7 | #include "PDFStreamDriver.h"
|
8 | #include "FormXObjectDriver.h"
|
9 | #include "PageContentContextDriver.h"
|
10 | #include "InputFileDriver.h"
|
11 | #include "DictionaryContextDriver.h"
|
12 | #include "DocumentContextDriver.h"
|
13 | #include "InfoDictionaryDriver.h"
|
14 | #include "PDFArrayDriver.h"
|
15 | #include "PDFBooleanDriver.h"
|
16 | #include "PDFLiteralStringDriver.h"
|
17 | #include "PDFHexStringDriver.h"
|
18 | #include "PDFNullDriver.h"
|
19 | #include "PDFNameDriver.h"
|
20 | #include "PDFIntegerDriver.h"
|
21 | #include "PDFRealDriver.h"
|
22 | #include "PDFDictionaryDriver.h"
|
23 | #include "PDFIndirectObjectReferenceDriver.h"
|
24 | #include "PDFStreamInputDriver.h"
|
25 | #include "PDFSymbolDriver.h"
|
26 | #include "PDFPageInputDriver.h"
|
27 | #include "PDFObjectParserDriver.h"
|
28 | #include "PDFPageModifierDriver.h"
|
29 | #include "PDFPageDriver.h"
|
30 | #include "ResourcesDictionaryDriver.h"
|
31 | #include "XObjectContentContextDriver.h"
|
32 |
|
33 | using namespace v8;
|
34 | using namespace node;
|
35 |
|
36 | DEFINE_EXTERNAL_DE_CON_STRUCTORS(ConstructorsHolder)
|
37 |
|
38 |
|
39 | v8::Local<v8::Value> ConstructorsHolder::GetNewPDFWriter(const ARGS_TYPE& args)
|
40 | {
|
41 | CREATE_ISOLATE_CONTEXT;
|
42 | CREATE_ESCAPABLE_SCOPE;
|
43 | NEW_INSTANCE(PDFWriter_constructor, instance);
|
44 | PDFWriterDriver* element = node::ObjectWrap::Unwrap<PDFWriterDriver>(instance);
|
45 | element->holder = this;
|
46 | return CLOSE_SCOPE(instance);
|
47 | }
|
48 |
|
49 | v8::Local<v8::Value> ConstructorsHolder::GetNewByteReader(const ARGS_TYPE& args)
|
50 | {
|
51 | CREATE_ISOLATE_CONTEXT;
|
52 | CREATE_ESCAPABLE_SCOPE;
|
53 | NEW_INSTANCE(ByteReader_constructor, instance);
|
54 | return CLOSE_SCOPE(instance);
|
55 | }
|
56 |
|
57 | v8::Local<v8::Value> ConstructorsHolder::GetNewPDFReader(const ARGS_TYPE& args)
|
58 | {
|
59 | CREATE_ISOLATE_CONTEXT;
|
60 | CREATE_ESCAPABLE_SCOPE;
|
61 |
|
62 | if (args.Length() == 1)
|
63 | {
|
64 | const unsigned argc = 1;
|
65 | Local<Value> argv[argc] = { args[0] };
|
66 | NEW_INSTANCE_ARGS(PDFReader_constructor, instance, argc, argv);
|
67 | PDFReaderDriver* element = node::ObjectWrap::Unwrap<PDFReaderDriver>(instance);
|
68 | element->holder = this;
|
69 | return CLOSE_SCOPE(instance);
|
70 | }
|
71 | else
|
72 | {
|
73 | NEW_INSTANCE(PDFReader_constructor, instance);
|
74 | PDFReaderDriver* element = node::ObjectWrap::Unwrap<PDFReaderDriver>(instance);
|
75 | element->holder = this;
|
76 | return CLOSE_SCOPE(instance);
|
77 | }
|
78 |
|
79 | }
|
80 |
|
81 |
|
82 | v8::Local<v8::Value> ConstructorsHolder::GetNewDocumentCopyingContext(const ARGS_TYPE& args)
|
83 | {
|
84 | CREATE_ISOLATE_CONTEXT;
|
85 | CREATE_ESCAPABLE_SCOPE;
|
86 |
|
87 | NEW_INSTANCE(DocumentCopyingContext_constructor, instance);
|
88 | DocumentCopyingContextDriver* element = node::ObjectWrap::Unwrap<DocumentCopyingContextDriver>(instance);
|
89 | element->holder = this;
|
90 | return CLOSE_SCOPE(instance);
|
91 | }
|
92 |
|
93 |
|
94 | v8::Local<v8::Value> ConstructorsHolder::GetNewByteWriterWithPosition(const ARGS_TYPE& args)
|
95 | {
|
96 | CREATE_ISOLATE_CONTEXT;
|
97 | CREATE_ESCAPABLE_SCOPE;
|
98 |
|
99 | NEW_INSTANCE(ByteWriterWithPosition_constructor, instance);
|
100 | return CLOSE_SCOPE(instance);
|
101 | }
|
102 |
|
103 |
|
104 | v8::Local<v8::Value> ConstructorsHolder::GetNewOutputFile(const ARGS_TYPE& args)
|
105 | {
|
106 | CREATE_ISOLATE_CONTEXT;
|
107 | CREATE_ESCAPABLE_SCOPE;
|
108 |
|
109 | NEW_INSTANCE(OutputFile_constructor, instance);
|
110 | OutputFileDriver* element = node::ObjectWrap::Unwrap<OutputFileDriver>(instance);
|
111 | element->holder = this;
|
112 | return CLOSE_SCOPE(instance);
|
113 | }
|
114 |
|
115 |
|
116 | v8::Local<v8::Value> ConstructorsHolder::GetNewObjectsContext(const ARGS_TYPE& args)
|
117 | {
|
118 | CREATE_ISOLATE_CONTEXT;
|
119 | CREATE_ESCAPABLE_SCOPE;
|
120 |
|
121 | NEW_INSTANCE(ObjectsContext_constructor, instance);
|
122 | ObjectsContextDriver* element = node::ObjectWrap::Unwrap<ObjectsContextDriver>(instance);
|
123 | element->holder = this;
|
124 | return CLOSE_SCOPE(instance);
|
125 | }
|
126 |
|
127 | v8::Local<v8::Value> ConstructorsHolder::GetNewByteWriter(const ARGS_TYPE& args)
|
128 | {
|
129 | CREATE_ISOLATE_CONTEXT;
|
130 | CREATE_ESCAPABLE_SCOPE;
|
131 |
|
132 | NEW_INSTANCE(ByteWriter_constructor, instance);
|
133 | return CLOSE_SCOPE(instance);
|
134 | }
|
135 |
|
136 | v8::Local<v8::Value> ConstructorsHolder::GetNewPDFStream(const ARGS_TYPE& args)
|
137 | {
|
138 | CREATE_ISOLATE_CONTEXT;
|
139 | CREATE_ESCAPABLE_SCOPE;
|
140 |
|
141 | NEW_INSTANCE(PDFStream_constructor, instance);
|
142 | PDFStreamDriver* element = node::ObjectWrap::Unwrap<PDFStreamDriver>(instance);
|
143 | element->holder = this;
|
144 | return CLOSE_SCOPE(instance);
|
145 | }
|
146 |
|
147 | v8::Local<v8::Value> ConstructorsHolder::GetNewFormXObject(const ARGS_TYPE& args)
|
148 | {
|
149 | CREATE_ISOLATE_CONTEXT;
|
150 | CREATE_ESCAPABLE_SCOPE;
|
151 |
|
152 | NEW_INSTANCE(FormXObject_constructor, instance);
|
153 | FormXObjectDriver* element = node::ObjectWrap::Unwrap<FormXObjectDriver>(instance);
|
154 | element->holder = this;
|
155 | return CLOSE_SCOPE(instance);
|
156 | }
|
157 |
|
158 | v8::Local<v8::Value> ConstructorsHolder::GetNewPageContentContext(const ARGS_TYPE& args)
|
159 | {
|
160 | CREATE_ISOLATE_CONTEXT;
|
161 | CREATE_ESCAPABLE_SCOPE;
|
162 |
|
163 | NEW_INSTANCE(PageContentContext_constructor, instance);
|
164 | PageContentContextDriver* element = node::ObjectWrap::Unwrap<PageContentContextDriver>(instance);
|
165 | element->holder = this;
|
166 | return CLOSE_SCOPE(instance);
|
167 | }
|
168 |
|
169 | v8::Local<v8::Value> ConstructorsHolder::GetNewByteReaderWithPosition(const ARGS_TYPE& args)
|
170 | {
|
171 | CREATE_ISOLATE_CONTEXT;
|
172 | CREATE_ESCAPABLE_SCOPE;
|
173 |
|
174 | NEW_INSTANCE(ByteReaderWithPosition_constructor, instance);
|
175 | return CLOSE_SCOPE(instance);
|
176 | }
|
177 |
|
178 | v8::Local<v8::Value> ConstructorsHolder::GetNewInputFile(const ARGS_TYPE& args)
|
179 | {
|
180 | CREATE_ISOLATE_CONTEXT;
|
181 | CREATE_ESCAPABLE_SCOPE;
|
182 |
|
183 | NEW_INSTANCE(InputFile_constructor, instance);
|
184 | InputFileDriver* element = node::ObjectWrap::Unwrap<InputFileDriver>(instance);
|
185 | element->holder = this;
|
186 | return CLOSE_SCOPE(instance);
|
187 | }
|
188 |
|
189 | v8::Local<v8::Value> ConstructorsHolder::GetNewDictionaryContext(const ARGS_TYPE& args)
|
190 | {
|
191 | CREATE_ISOLATE_CONTEXT;
|
192 | CREATE_ESCAPABLE_SCOPE;
|
193 |
|
194 | NEW_INSTANCE(DictionaryContext_constructor, instance);
|
195 | return CLOSE_SCOPE(instance);
|
196 | }
|
197 |
|
198 | v8::Local<v8::Value> ConstructorsHolder::GetInstanceFor(DictionaryContext* inDictionaryContextInstance) {
|
199 | CREATE_ISOLATE_CONTEXT;
|
200 | CREATE_ESCAPABLE_SCOPE;
|
201 |
|
202 | NEW_INSTANCE(DictionaryContext_constructor, instance);
|
203 | DictionaryContextDriver* element = node::ObjectWrap::Unwrap<DictionaryContextDriver>(instance);
|
204 | element->DictionaryContextInstance = inDictionaryContextInstance;
|
205 | return CLOSE_SCOPE(instance);
|
206 | }
|
207 |
|
208 | v8::Local<v8::Value> ConstructorsHolder::GetNewDocumentContext(const ARGS_TYPE& args) {
|
209 | CREATE_ISOLATE_CONTEXT;
|
210 | CREATE_ESCAPABLE_SCOPE;
|
211 |
|
212 | NEW_INSTANCE(DocumentContext_constructor, instance);
|
213 | DocumentContextDriver* element = node::ObjectWrap::Unwrap<DocumentContextDriver>(instance);
|
214 | element->holder = this;
|
215 | return CLOSE_SCOPE(instance);
|
216 | }
|
217 |
|
218 | v8::Local<v8::Value> ConstructorsHolder::GetNewInfoDictionary(const ARGS_TYPE& args){
|
219 | CREATE_ISOLATE_CONTEXT;
|
220 | CREATE_ESCAPABLE_SCOPE;
|
221 |
|
222 | NEW_INSTANCE(InfoDictionary_constructor, instance);
|
223 | InfoDictionaryDriver* element = node::ObjectWrap::Unwrap<InfoDictionaryDriver>(instance);
|
224 | element->holder = this;
|
225 | return CLOSE_SCOPE(instance);
|
226 | }
|
227 |
|
228 | v8::Local<v8::Value> ConstructorsHolder::GetNewPDFDate(const ARGS_TYPE& args) {
|
229 | CREATE_ISOLATE_CONTEXT;
|
230 | CREATE_ESCAPABLE_SCOPE;
|
231 |
|
232 | const unsigned argc = 1;
|
233 |
|
234 | if (args.Length() != 1 || (!args[0]->IsDate() && !args[0]->IsString()))
|
235 | {
|
236 | THROW_EXCEPTION("Wrong arguments. Provide 1 argument which is a date");
|
237 | Local<Value> argv[argc] = { NEW_STRING("") };
|
238 | NEW_INSTANCE_ARGS(PDFDate_constructor, instance, argc, argv);
|
239 |
|
240 | return CLOSE_SCOPE(instance);
|
241 | } else {
|
242 | Local<Value> argv[argc] = { args[0] };
|
243 | NEW_INSTANCE_ARGS(PDFDate_constructor, instance, argc, argv);
|
244 |
|
245 | return CLOSE_SCOPE(instance);
|
246 | }
|
247 | }
|
248 |
|
249 | v8::Local<v8::Value> ConstructorsHolder::GetNewImageXObject(const ARGS_TYPE& args)
|
250 | {
|
251 | CREATE_ISOLATE_CONTEXT;
|
252 | CREATE_ESCAPABLE_SCOPE;
|
253 |
|
254 | NEW_INSTANCE(ImageXObject_constructor, instance);
|
255 | return CLOSE_SCOPE(instance);
|
256 | }
|
257 |
|
258 | v8::Local<v8::Value> ConstructorsHolder::GetNewPDFArray(){
|
259 | CREATE_ISOLATE_CONTEXT;
|
260 | CREATE_ESCAPABLE_SCOPE;
|
261 |
|
262 | NEW_INSTANCE(PDFArray_constructor, instance);
|
263 | PDFArrayDriver* element = node::ObjectWrap::Unwrap<PDFArrayDriver>(instance);
|
264 | element->holder = this;
|
265 | return CLOSE_SCOPE(instance);
|
266 | }
|
267 |
|
268 |
|
269 | v8::Local<v8::Value> ConstructorsHolder::GetNewPDFBoolean() {
|
270 | CREATE_ISOLATE_CONTEXT;
|
271 | CREATE_ESCAPABLE_SCOPE;
|
272 |
|
273 | NEW_INSTANCE(PDFBoolean_constructor, instance);
|
274 | PDFBooleanDriver* element = node::ObjectWrap::Unwrap<PDFBooleanDriver>(instance);
|
275 | element->holder = this;
|
276 | return CLOSE_SCOPE(instance);
|
277 | }
|
278 | v8::Local<v8::Value> ConstructorsHolder::GetNewPDFLiteralString() {
|
279 | CREATE_ISOLATE_CONTEXT;
|
280 | CREATE_ESCAPABLE_SCOPE;
|
281 |
|
282 | NEW_INSTANCE(PDFLiteralString_constructor, instance);
|
283 | PDFLiteralStringDriver* element = node::ObjectWrap::Unwrap<PDFLiteralStringDriver>(instance);
|
284 | element->holder = this;
|
285 | return CLOSE_SCOPE(instance);
|
286 | }
|
287 | v8::Local<v8::Value> ConstructorsHolder::GetNewPDFHexString() {
|
288 | CREATE_ISOLATE_CONTEXT;
|
289 | CREATE_ESCAPABLE_SCOPE;
|
290 |
|
291 | NEW_INSTANCE(PDFHexString_constructor, instance);
|
292 | PDFHexStringDriver* element = node::ObjectWrap::Unwrap<PDFHexStringDriver>(instance);
|
293 | element->holder = this;
|
294 | return CLOSE_SCOPE(instance);
|
295 | }
|
296 | v8::Local<v8::Value> ConstructorsHolder::GetNewPDFNull() {
|
297 | CREATE_ISOLATE_CONTEXT;
|
298 | CREATE_ESCAPABLE_SCOPE;
|
299 |
|
300 | NEW_INSTANCE(PDFNull_constructor, instance);
|
301 | PDFNullDriver* element = node::ObjectWrap::Unwrap<PDFNullDriver>(instance);
|
302 | element->holder = this;
|
303 | return CLOSE_SCOPE(instance);
|
304 | }
|
305 | v8::Local<v8::Value> ConstructorsHolder::GetNewPDFName() {
|
306 | CREATE_ISOLATE_CONTEXT;
|
307 | CREATE_ESCAPABLE_SCOPE;
|
308 |
|
309 | NEW_INSTANCE(PDFName_constructor, instance);
|
310 | PDFNameDriver* element = node::ObjectWrap::Unwrap<PDFNameDriver>(instance);
|
311 | element->holder = this;
|
312 | return CLOSE_SCOPE(instance);
|
313 | }
|
314 | v8::Local<v8::Value> ConstructorsHolder::GetNewPDFInteger() {
|
315 | CREATE_ISOLATE_CONTEXT;
|
316 | CREATE_ESCAPABLE_SCOPE;
|
317 |
|
318 | NEW_INSTANCE(PDFInteger_constructor, instance);
|
319 | PDFIntegerDriver* element = node::ObjectWrap::Unwrap<PDFIntegerDriver>(instance);
|
320 | element->holder = this;
|
321 | return CLOSE_SCOPE(instance);
|
322 | }
|
323 | v8::Local<v8::Value> ConstructorsHolder::GetNewPDFReal() {
|
324 | CREATE_ISOLATE_CONTEXT;
|
325 | CREATE_ESCAPABLE_SCOPE;
|
326 |
|
327 | NEW_INSTANCE(PDFReal_constructor, instance);
|
328 | PDFRealDriver* element = node::ObjectWrap::Unwrap<PDFRealDriver>(instance);
|
329 | element->holder = this;
|
330 | return CLOSE_SCOPE(instance);
|
331 | }
|
332 | v8::Local<v8::Value> ConstructorsHolder::GetNewPDFDictionary() {
|
333 | CREATE_ISOLATE_CONTEXT;
|
334 | CREATE_ESCAPABLE_SCOPE;
|
335 |
|
336 | NEW_INSTANCE(PDFDictionary_constructor, instance);
|
337 | PDFDictionaryDriver* element = node::ObjectWrap::Unwrap<PDFDictionaryDriver>(instance);
|
338 | element->holder = this;
|
339 | return CLOSE_SCOPE(instance);
|
340 | }
|
341 | v8::Local<v8::Value> ConstructorsHolder::GetNewPDFIndirectObjectReference() {
|
342 | CREATE_ISOLATE_CONTEXT;
|
343 | CREATE_ESCAPABLE_SCOPE;
|
344 |
|
345 | NEW_INSTANCE(PDFIndirectObjectReference_constructor, instance);
|
346 | PDFIndirectObjectReferenceDriver* element = node::ObjectWrap::Unwrap<PDFIndirectObjectReferenceDriver>(instance);
|
347 | element->holder = this;
|
348 | return CLOSE_SCOPE(instance);
|
349 | }
|
350 | v8::Local<v8::Value> ConstructorsHolder::GetNewPDFStreamInput() {
|
351 | CREATE_ISOLATE_CONTEXT;
|
352 | CREATE_ESCAPABLE_SCOPE;
|
353 |
|
354 | NEW_INSTANCE(PDFStreamInput_constructor, instance);
|
355 | PDFStreamInputDriver* element = node::ObjectWrap::Unwrap<PDFStreamInputDriver>(instance);
|
356 | element->holder = this;
|
357 | return CLOSE_SCOPE(instance);
|
358 | }
|
359 | v8::Local<v8::Value> ConstructorsHolder::GetNewPDFSymbol() {
|
360 | CREATE_ISOLATE_CONTEXT;
|
361 | CREATE_ESCAPABLE_SCOPE;
|
362 |
|
363 | NEW_INSTANCE(PDFSymbol_constructor, instance);
|
364 | PDFSymbolDriver* element = node::ObjectWrap::Unwrap<PDFSymbolDriver>(instance);
|
365 | element->holder = this;
|
366 | return CLOSE_SCOPE(instance);
|
367 | }
|
368 |
|
369 | v8::Local<v8::Value> ConstructorsHolder::GetInstanceFor(PDFObject* inObject)
|
370 | {
|
371 | CREATE_ISOLATE_CONTEXT;
|
372 | CREATE_ESCAPABLE_SCOPE;
|
373 | ESCAPABLE_HANDLE(Value) newInstance;
|
374 |
|
375 | switch(inObject->GetType())
|
376 | {
|
377 | case PDFObject::ePDFObjectBoolean:
|
378 | {
|
379 | newInstance = GetNewPDFBoolean();
|
380 | ObjectWrap::Unwrap<PDFBooleanDriver>(newInstance->TO_OBJECT())->TheObject = inObject;
|
381 | break;
|
382 | }
|
383 | case PDFObject::ePDFObjectLiteralString:
|
384 | {
|
385 | newInstance = GetNewPDFLiteralString();
|
386 | ObjectWrap::Unwrap<PDFLiteralStringDriver>(newInstance->TO_OBJECT())->TheObject = inObject;
|
387 | break;
|
388 | }
|
389 | case PDFObject::ePDFObjectHexString:
|
390 | {
|
391 | newInstance = GetNewPDFHexString();
|
392 | ObjectWrap::Unwrap<PDFHexStringDriver>(newInstance->TO_OBJECT())->TheObject = inObject;
|
393 | break;
|
394 | }
|
395 | case PDFObject::ePDFObjectNull:
|
396 | {
|
397 | newInstance = GetNewPDFNull();
|
398 | ObjectWrap::Unwrap<PDFNullDriver>(newInstance->TO_OBJECT())->TheObject = inObject;
|
399 | break;
|
400 | }
|
401 | case PDFObject::ePDFObjectName:
|
402 | {
|
403 | newInstance = GetNewPDFName();
|
404 | ObjectWrap::Unwrap<PDFNameDriver>(newInstance->TO_OBJECT())->TheObject = inObject;
|
405 | break;
|
406 | }
|
407 | case PDFObject::ePDFObjectInteger:
|
408 | {
|
409 | newInstance = GetNewPDFInteger();
|
410 | ObjectWrap::Unwrap<PDFIntegerDriver>(newInstance->TO_OBJECT())->TheObject = inObject;
|
411 | break;
|
412 | }
|
413 | case PDFObject::ePDFObjectReal:
|
414 | {
|
415 | newInstance = GetNewPDFReal();
|
416 | ObjectWrap::Unwrap<PDFRealDriver>(newInstance->TO_OBJECT())->TheObject = inObject;
|
417 | break;
|
418 | }
|
419 | case PDFObject::ePDFObjectArray:
|
420 | {
|
421 | newInstance = GetNewPDFArray();
|
422 | ObjectWrap::Unwrap<PDFArrayDriver>(newInstance->TO_OBJECT())->TheObject = inObject;
|
423 | break;
|
424 |
|
425 | }
|
426 | case PDFObject::ePDFObjectDictionary:
|
427 | {
|
428 | newInstance = GetNewPDFDictionary();
|
429 | ObjectWrap::Unwrap<PDFDictionaryDriver>(newInstance->TO_OBJECT())->TheObject = inObject;
|
430 | break;
|
431 | }
|
432 | case PDFObject::ePDFObjectIndirectObjectReference:
|
433 | {
|
434 | newInstance = GetNewPDFIndirectObjectReference();
|
435 | ObjectWrap::Unwrap<PDFIndirectObjectReferenceDriver>(newInstance->TO_OBJECT())->TheObject = inObject;
|
436 | break;
|
437 | }
|
438 | case PDFObject::ePDFObjectStream:
|
439 | {
|
440 | newInstance = GetNewPDFStreamInput();
|
441 | ObjectWrap::Unwrap<PDFStreamInputDriver>(newInstance->TO_OBJECT())->TheObject = inObject;
|
442 | break;
|
443 | }
|
444 | case PDFObject::ePDFObjectSymbol:
|
445 | {
|
446 | newInstance = GetNewPDFSymbol();
|
447 | ObjectWrap::Unwrap<PDFSymbolDriver>(newInstance->TO_OBJECT())->TheObject = inObject;
|
448 | break;
|
449 |
|
450 | }
|
451 | }
|
452 | return CLOSE_SCOPE(newInstance);
|
453 | }
|
454 |
|
455 | v8::Local<v8::Value> ConstructorsHolder::GetNewPDFObjectParser(const ARGS_TYPE& args)
|
456 | {
|
457 | CREATE_ISOLATE_CONTEXT;
|
458 | CREATE_ESCAPABLE_SCOPE;
|
459 |
|
460 | NEW_INSTANCE(PDFObjectParser_constructor, instance);
|
461 | PDFObjectParserDriver* element = node::ObjectWrap::Unwrap<PDFObjectParserDriver>(instance);
|
462 | element->holder = this;
|
463 | return CLOSE_SCOPE(instance);
|
464 | }
|
465 |
|
466 | v8::Local<v8::Value> ConstructorsHolder::GetNewPDFPageInput(const ARGS_TYPE& args)
|
467 | {
|
468 | CREATE_ISOLATE_CONTEXT;
|
469 | CREATE_ESCAPABLE_SCOPE;
|
470 |
|
471 | NEW_INSTANCE(PDFPageInput_constructor, instance);
|
472 | PDFPageInputDriver* element = node::ObjectWrap::Unwrap<PDFPageInputDriver>(instance);
|
473 | element->holder = this;
|
474 | return CLOSE_SCOPE(instance);
|
475 | }
|
476 |
|
477 | v8::Local<v8::Value> ConstructorsHolder::GetNewResourcesDictionary(const ARGS_TYPE& args)
|
478 | {
|
479 | CREATE_ISOLATE_CONTEXT;
|
480 | CREATE_ESCAPABLE_SCOPE;
|
481 |
|
482 | NEW_INSTANCE(ResourcesDictionary_constructor, instance);
|
483 | ResourcesDictionaryDriver* element = node::ObjectWrap::Unwrap<ResourcesDictionaryDriver>(instance);
|
484 | element->holder = this;
|
485 | return CLOSE_SCOPE(instance);
|
486 | }
|
487 |
|
488 | v8::Local<v8::Value> ConstructorsHolder::GetNewUsedFont(const ARGS_TYPE& args)
|
489 | {
|
490 | CREATE_ISOLATE_CONTEXT;
|
491 | CREATE_ESCAPABLE_SCOPE;
|
492 |
|
493 | NEW_INSTANCE(UsedFont_constructor, instance);
|
494 | return CLOSE_SCOPE(instance);
|
495 | }
|
496 |
|
497 | v8::Local<v8::Value> ConstructorsHolder::GetNewXObjectContentContext(const ARGS_TYPE& args)
|
498 | {
|
499 | CREATE_ISOLATE_CONTEXT;
|
500 | CREATE_ESCAPABLE_SCOPE;
|
501 |
|
502 | NEW_INSTANCE(XObjectContentContext_constructor, instance);
|
503 | XObjectContentContextDriver* driver = ObjectWrap::Unwrap<XObjectContentContextDriver>(instance->TO_OBJECT());
|
504 | driver->holder = this;
|
505 |
|
506 | return CLOSE_SCOPE(instance);
|
507 | }
|
508 |
|
509 | v8::Local<v8::Value> ConstructorsHolder::GetNewPDFTextString(const ARGS_TYPE& args)
|
510 | {
|
511 | CREATE_ISOLATE_CONTEXT;
|
512 | CREATE_ESCAPABLE_SCOPE;
|
513 |
|
514 | NEW_INSTANCE(PDFTextString_constructor, instance);
|
515 | return CLOSE_SCOPE(instance);
|
516 | }
|
517 |
|
518 | v8::Local<v8::Value> ConstructorsHolder::GetInstanceFor(PDFPage* inPage)
|
519 | {
|
520 | CREATE_ISOLATE_CONTEXT;
|
521 | CREATE_ESCAPABLE_SCOPE;
|
522 |
|
523 | Local<Value> argv[1] = { NEW_BOOLEAN(false) };
|
524 | NEW_INSTANCE_ARGS(PDFPage_constructor, instance, 1, argv);
|
525 |
|
526 |
|
527 |
|
528 | PDFPageDriver* driver = ObjectWrap::Unwrap<PDFPageDriver>(instance->TO_OBJECT());
|
529 | driver->holder = this;
|
530 | driver->mPDFPage = inPage;
|
531 | driver->mOwnsPage = false;
|
532 |
|
533 | return CLOSE_SCOPE(instance);
|
534 | }
|
535 |
|
536 | v8::Local<v8::Value> ConstructorsHolder::GetInstanceFor(ResourcesDictionary* inResourcesDictionary)
|
537 | {
|
538 | CREATE_ISOLATE_CONTEXT;
|
539 | CREATE_ESCAPABLE_SCOPE;
|
540 |
|
541 | NEW_INSTANCE(ResourcesDictionary_constructor, instance);
|
542 | ObjectWrap::Unwrap<ResourcesDictionaryDriver>(instance->TO_OBJECT())->ResourcesDictionaryInstance = inResourcesDictionary;
|
543 | return CLOSE_SCOPE(instance);
|
544 | }
|
545 |
|
546 | v8::Local<v8::Value> ConstructorsHolder::GetNewPDFPageModifier(const ARGS_TYPE& args)
|
547 | {
|
548 | CREATE_ISOLATE_CONTEXT;
|
549 | CREATE_ESCAPABLE_SCOPE;
|
550 |
|
551 | NEW_INSTANCE(PDFPageModifier_constructor, instance);
|
552 | PDFPageModifierDriver* element = node::ObjectWrap::Unwrap<PDFPageModifierDriver>(instance);
|
553 | element->holder = this;
|
554 | return CLOSE_SCOPE(instance);
|
555 | }
|
556 |
|
557 | v8::Local<v8::Value> ConstructorsHolder::GetNewPDFPage(const ARGS_TYPE& args)
|
558 | {
|
559 | CREATE_ISOLATE_CONTEXT;
|
560 | CREATE_ESCAPABLE_SCOPE;
|
561 |
|
562 | Local<Value> argv[1] = { NEW_BOOLEAN(false) };
|
563 | NEW_INSTANCE_ARGS(PDFPage_constructor, instance, 1, argv);
|
564 |
|
565 |
|
566 |
|
567 | PDFPageDriver* driver = ObjectWrap::Unwrap<PDFPageDriver>(instance->TO_OBJECT());
|
568 | driver->holder = this;
|
569 | driver->mPDFPage = new PDFPage();
|
570 | driver->mOwnsPage = true;
|
571 |
|
572 | if (args.Length() == 4 && args[0]->IsNumber() && args[1]->IsNumber() && args[2]->IsNumber() && args[3]->IsNumber())
|
573 | {
|
574 | driver->mPDFPage->SetMediaBox(PDFRectangle(TO_NUMBER(args[0])->Value(),
|
575 | TO_NUMBER(args[1])->Value(),
|
576 | TO_NUMBER(args[2])->Value(),
|
577 | TO_NUMBER(args[3])->Value()));
|
578 | }
|
579 |
|
580 | return CLOSE_SCOPE(instance);
|
581 | }
|
582 |
|
583 | bool ConstructorsHolder::IsInstance(v8::Local<v8::Value> inObject, const v8::Persistent<v8::FunctionTemplate>& constructor_template) {
|
584 | CREATE_ISOLATE_CONTEXT;
|
585 |
|
586 | return inObject->IsObject() && HAS_INSTANCE(constructor_template, inObject);
|
587 | }
|
588 |
|
589 | bool ConstructorsHolder::IsByteReaderInstance(v8::Local<v8::Value> inObject)
|
590 | {
|
591 | return ConstructorsHolder::IsInstance(inObject, ByteReader_constructor_template );
|
592 | }
|
593 |
|
594 |
|
595 | bool ConstructorsHolder::IsByteReaderWithPositionInstance(v8::Local<v8::Value> inObject)
|
596 | {
|
597 | return ConstructorsHolder::IsInstance(inObject, ByteReaderWithPosition_constructor_template );
|
598 | }
|
599 |
|
600 |
|
601 | bool ConstructorsHolder::IsByteWriterInstance(v8::Local<v8::Value> inObject)
|
602 | {
|
603 | return ConstructorsHolder::IsInstance(inObject, ByteWriter_constructor_template );
|
604 | }
|
605 |
|
606 |
|
607 | bool ConstructorsHolder::IsByteWriterWithPositionInstance(v8::Local<v8::Value> inObject)
|
608 | {
|
609 | return ConstructorsHolder::IsInstance(inObject, ByteWriterWithPosition_constructor_template );
|
610 | }
|
611 |
|
612 |
|
613 | bool ConstructorsHolder::IsDictionaryContextInstance(v8::Local<v8::Value> inObject)
|
614 | {
|
615 | return ConstructorsHolder::IsInstance(inObject, DictionaryContext_constructor_template );
|
616 | }
|
617 |
|
618 |
|
619 | bool ConstructorsHolder::IsFormXObjectInstance(v8::Local<v8::Value> inObject)
|
620 | {
|
621 | return ConstructorsHolder::IsInstance(inObject, FormXObject_constructor_template );
|
622 | }
|
623 |
|
624 |
|
625 | bool ConstructorsHolder::IsImageXObjectInstance(v8::Local<v8::Value> inObject)
|
626 | {
|
627 | return ConstructorsHolder::IsInstance(inObject, ImageXObject_constructor_template );
|
628 | }
|
629 |
|
630 |
|
631 | bool ConstructorsHolder::IsInputFileInstance(v8::Local<v8::Value> inObject)
|
632 | {
|
633 | return ConstructorsHolder::IsInstance(inObject, InputFile_constructor_template );
|
634 | }
|
635 |
|
636 |
|
637 | bool ConstructorsHolder::IsOutputFileInstance(v8::Local<v8::Value> inObject)
|
638 | {
|
639 | return ConstructorsHolder::IsInstance(inObject, OutputFile_constructor_template );
|
640 | }
|
641 |
|
642 |
|
643 | bool ConstructorsHolder::IsPageContentContextInstance(v8::Local<v8::Value> inObject)
|
644 | {
|
645 | return ConstructorsHolder::IsInstance(inObject, PageContentContext_constructor_template );
|
646 | }
|
647 |
|
648 |
|
649 | bool ConstructorsHolder::IsPDFArrayInstance(v8::Local<v8::Value> inObject)
|
650 | {
|
651 | return ConstructorsHolder::IsInstance(inObject, PDFArray_constructor_template );
|
652 | }
|
653 |
|
654 |
|
655 | bool ConstructorsHolder::IsPDFBooleanInstance(v8::Local<v8::Value> inObject)
|
656 | {
|
657 | return ConstructorsHolder::IsInstance(inObject, PDFBoolean_constructor_template );
|
658 | }
|
659 |
|
660 |
|
661 | bool ConstructorsHolder::IsPDFDictionaryInstance(v8::Local<v8::Value> inObject)
|
662 | {
|
663 | return ConstructorsHolder::IsInstance(inObject, PDFDictionary_constructor_template );
|
664 | }
|
665 |
|
666 |
|
667 | bool ConstructorsHolder::IsPDFHexStringInstance(v8::Local<v8::Value> inObject)
|
668 | {
|
669 | return ConstructorsHolder::IsInstance(inObject, PDFHexString_constructor_template );
|
670 | }
|
671 |
|
672 |
|
673 | bool ConstructorsHolder::IsPDFIndirectObjectReferenceInstance(v8::Local<v8::Value> inObject)
|
674 | {
|
675 | return ConstructorsHolder::IsInstance(inObject, PDFIndirectObjectReference_constructor_template );
|
676 | }
|
677 |
|
678 |
|
679 | bool ConstructorsHolder::IsPDFIntegerInstance(v8::Local<v8::Value> inObject)
|
680 | {
|
681 | return ConstructorsHolder::IsInstance(inObject, PDFInteger_constructor_template );
|
682 | }
|
683 |
|
684 |
|
685 | bool ConstructorsHolder::IsPDFLiteralStringInstance(v8::Local<v8::Value> inObject)
|
686 | {
|
687 | return ConstructorsHolder::IsInstance(inObject, PDFLiteralString_constructor_template );
|
688 | }
|
689 |
|
690 |
|
691 | bool ConstructorsHolder::IsPDFNameInstance(v8::Local<v8::Value> inObject)
|
692 | {
|
693 | return ConstructorsHolder::IsInstance(inObject, PDFName_constructor_template );
|
694 | }
|
695 |
|
696 |
|
697 | bool ConstructorsHolder::IsPDFNullInstance(v8::Local<v8::Value> inObject)
|
698 | {
|
699 | return ConstructorsHolder::IsInstance(inObject, PDFNull_constructor_template );
|
700 | }
|
701 |
|
702 |
|
703 | bool ConstructorsHolder::IsPDFObjectParserInstance(v8::Local<v8::Value> inObject)
|
704 | {
|
705 | return ConstructorsHolder::IsInstance(inObject, PDFObjectParser_constructor_template );
|
706 | }
|
707 |
|
708 |
|
709 | bool ConstructorsHolder::IsPDFPageInstance(v8::Local<v8::Value> inObject)
|
710 | {
|
711 | return ConstructorsHolder::IsInstance(inObject, PDFPage_constructor_template );
|
712 | }
|
713 |
|
714 |
|
715 | bool ConstructorsHolder::IsPDFPageModifierInstance(v8::Local<v8::Value> inObject)
|
716 | {
|
717 | return ConstructorsHolder::IsInstance(inObject, PDFPageModifier_constructor_template );
|
718 | }
|
719 |
|
720 |
|
721 | bool ConstructorsHolder::IsPDFReaderInstance(v8::Local<v8::Value> inObject)
|
722 | {
|
723 | return ConstructorsHolder::IsInstance(inObject, PDFReader_constructor_template );
|
724 | }
|
725 |
|
726 |
|
727 | bool ConstructorsHolder::IsPDFRealInstance(v8::Local<v8::Value> inObject)
|
728 | {
|
729 | return ConstructorsHolder::IsInstance(inObject, PDFReal_constructor_template );
|
730 | }
|
731 |
|
732 |
|
733 | bool ConstructorsHolder::IsPDFStreamInstance(v8::Local<v8::Value> inObject)
|
734 | {
|
735 | return ConstructorsHolder::IsInstance(inObject, PDFStream_constructor_template );
|
736 | }
|
737 |
|
738 |
|
739 | bool ConstructorsHolder::IsPDFStreamInputInstance(v8::Local<v8::Value> inObject)
|
740 | {
|
741 | return ConstructorsHolder::IsInstance(inObject, PDFStreamInput_constructor_template );
|
742 | }
|
743 |
|
744 |
|
745 | bool ConstructorsHolder::IsPDFSymbolInstance(v8::Local<v8::Value> inObject)
|
746 | {
|
747 | return ConstructorsHolder::IsInstance(inObject, PDFSymbol_constructor_template );
|
748 | }
|
749 |
|
750 |
|
751 | bool ConstructorsHolder::IsUsedFontInstance(v8::Local<v8::Value> inObject)
|
752 | {
|
753 | return ConstructorsHolder::IsInstance(inObject, UsedFont_constructor_template );
|
754 | } |
\ | No newline at end of file |