node-pdfutils
PdfEngine.h
1 /*
2  * PdfEngine.h
3  * Copyright (C) 2014 tox <tox@rootkit>
4  *
5  * Distributed under terms of the MIT license.
6  */
7 
8 #ifndef PDFENGINE_H
9 #define PDFENGINE_H
10 
11 #include <v8.h>
12 #include <node.h>
13 #include <vector>
14 #include "PdfPage.h"
15 #include "PdfDocument.h"
16 
17 #define ERROR_RENDER_NOT_SUPPORTED ((char *)"Rendering pages is not supported")
18 #define ERROR_SAVE_NOT_SUPPORTED ((char *)"Saving a Document is not supported")
19 
20 enum PdfRenderFormat {
21  RENDER_SVG,
22  RENDER_PNG,
23  RENDER_GIF,
24  RENDER_PDF,
25  RENDER_TEXT
26 };
27 
28 class PdfPage;
29 class PdfDocument;
31 class PdfSaveWorker;
38 class PdfEngine {
39 private:
40  const char *_password;
41 
42 protected:
43  PdfEngine();
44 
45 public:
46  virtual ~PdfEngine();
47  inline void setPassword(const char *password) {
48  _password = password;
49  }
50 
51  inline const char* password() {
52  return _password;
53  }
54 
55  virtual bool isThreadSafe();
56 
57  virtual char* openFromData(char *data, size_t length) = 0;
58  virtual char* openFromPath(char *src) = 0;
59  virtual char* renderPage(int index, PdfRenderFormat format, PdfExportPageWorker *writer) = 0;
60  virtual char* savePdf(PdfPage *pages, PdfSaveWorker *writer) = 0;
61 
62  virtual void fillDocument(PdfDocument *document) = 0;
63  virtual void fillPage(int index, PdfPage *page) = 0;
64 
65  virtual void close() = 0;
66 
67 };
68 
69 #endif /* !PDFENGINE_H */
Class representation of a PDF-Document.
Definition: PdfDocument.h:50
Definition: PdfExportPageWorker.h:14
Definition: PdfSaveWorker.h:14
Class representation of a PDF-Page.
Definition: PdfPage.h:17
Base Class for interaction with a PDF-Engine such as Poppler.
Definition: PdfEngine.h:38