1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-10-06 12:01:39 +00:00
pdf2htmlEX/src/HTMLTextPage.h

65 lines
1.4 KiB
C
Raw Normal View History

/*
* Header file for HTMLTextPage
* Copyright (C) 2013 Lu Wang <coolwanglu@gmail.com>
*/
#ifndef HTMLTEXTPAGE_H__
#define HTMLTEXTPAGE_H__
#include <vector>
#include <memory>
#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:
2013-04-07 08:10:52 +00:00
HTMLTextPage (const Param & param, AllStateManager & all_manager);
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);
2013-05-04 11:26:26 +00:00
/* for clipping */
void set_page_size(double width, double height);
void clip(double x1, double y1, double x2, double y2);
private:
void optimize(void);
const Param & param;
2013-04-07 08:10:52 +00:00
AllStateManager & all_manager;
HTMLTextLine * cur_line;
2013-05-04 11:26:26 +00:00
double page_width, page_height;
std::vector<std::unique_ptr<HTMLTextLine>> text_lines;
2013-05-04 11:26:26 +00:00
struct ClipBox {
ClipBox(double x1, double y1, double x2, double y2, size_t start_idx)
:x1(x1),y1(y1),x2(x2),y2(y2),start_idx(start_idx)
{ }
double x1, y1, x2, y2;
size_t start_idx;
};
std::vector<ClipBox> clip_boxes;
};
} //namespace pdf2htmlEX
#endif //HTMLTEXTPAGE_H__