-
Notifications
You must be signed in to change notification settings - Fork 0
/
mypdfparser.h
53 lines (47 loc) · 1.49 KB
/
mypdfparser.h
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
#ifndef __LIBXMLPP_EXAMPLES_MYPDFPARSER_H
#define __LIBXMLPP_EXAMPLES_MYPDFPARSER_H
#include <libxml++-2.6/libxml++/libxml++.h>
#include <string>
#include "TextElement.h"
using namespace std;
class MyPdfParser : public xmlpp::SaxParser
{
int line_top = -1;
int line_right = -1;
int line_bottom = -1;
int line_left = -1;
int prev_top = -1;
int prev_right = -1;
int prev_bottom = -1;
int prev_left = -1;
int bottom = -1;
int top = -1;
int left_ = -1;
int right_ = -1;
bool first_in_line =true;
bool new_element = false;
std::vector<std::vector<TextElement> > * pageElements;
string current_element = "";
int current_element_left = -1;
int current_element_right = -1;
int current_element_top = -1;
int current_element_bottom = -1;
std::vector<TextElement> currElem ;
public:
MyPdfParser(std::vector<std::vector<TextElement>> *&);
virtual ~MyPdfParser();
protected:
//overrides:
virtual void on_start_document();
virtual void on_end_document();
virtual void on_start_element(const Glib::ustring& name,
const AttributeList& properties);
virtual void on_end_element(const Glib::ustring& name);
virtual void on_characters(const Glib::ustring& characters);
virtual void on_comment(const Glib::ustring& text);
virtual void on_warning(const Glib::ustring& text);
virtual void on_error(const Glib::ustring& text);
virtual void on_fatal_error(const Glib::ustring& text);
void split(const string& s, char c,vector<string>& v);
};
#endif //__LIBXMLPP_EXAMPLES_MYPDFPARSER_H