forked from coolwanglu/pdf2htmlEX
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHTMLTextPage.h
More file actions
66 lines (51 loc) · 1.44 KB
/
Copy pathHTMLTextPage.h
File metadata and controls
66 lines (51 loc) · 1.44 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
/*
* Header file for HTMLTextPage
* Copyright (C) 2013 Lu Wang <coolwanglu@gmail.com>
*/
#ifndef HTMLTEXTPAGE_H__
#define HTMLTEXTPAGE_H__
#include <vector>
#include <ostream>
#include "Param.h"
#include "StateManager.h"
#include "HTMLTextLine.h"
#include "HTMLState.h"
namespace pdf2htmlEX {
/*
* Store and optimize a page of text in HTML
*
* contains a series of HTMLTextLine
*/
class HTMLTextPage
{
public:
HTMLTextPage (const Param & param, AllStateManager & all_manager);
~HTMLTextPage();
HTMLTextLine * get_cur_line(void) const { return cur_line; }
void dump_text(std::ostream & out);
void dump_css(std::ostream & out);
void clear(void);
void open_new_line(const HTMLLineState & line_state);
/* for clipping */
void set_page_size(double width, double height);
void clip(const HTMLClipState & clip_state);
double get_width() { return page_width; }
double get_height() { return page_height; }
private:
void optimize(void);
const Param & param;
AllStateManager & all_manager;
HTMLTextLine * cur_line;
double page_width, page_height;
std::vector<HTMLTextLine*> text_lines;
struct Clip {
HTMLClipState clip_state;
size_t start_idx;
Clip(const HTMLClipState & clip_state, size_t start_idx)
:clip_state(clip_state),start_idx(start_idx)
{ }
};
std::vector<Clip> clips;
};
} //namespace pdf2htmlEX
#endif //HTMLTEXTPAGE_H__