1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-07-08 10:50:33 +00:00
pdf2htmlEX/src/Preprocessor.h

67 lines
1.6 KiB
C
Raw Normal View History

2012-09-07 07:03:03 +00:00
/*
* Preprocessor.h
*
* PDF is so complicated that we have to scan twice
2012-09-07 07:03:03 +00:00
*
* Check used codes for each font
2012-09-22 06:41:29 +00:00
* Collect all used link destinations
2012-09-07 07:03:03 +00:00
*
* by WangLu
* 2012.09.07
*/
#ifndef PREPROCESSOR_H__
#define PREPROCESSOR_H__
2012-09-07 07:03:03 +00:00
#include <unordered_map>
#include <OutputDev.h>
2012-09-22 06:41:29 +00:00
#include <PDFDoc.h>
#include <Annot.h>
#include "Param.h"
2012-09-07 07:03:03 +00:00
namespace pdf2htmlEX {
class Preprocessor : public OutputDev {
2012-09-07 07:03:03 +00:00
public:
2013-04-06 09:01:05 +00:00
Preprocessor(const Param & param);
virtual ~Preprocessor(void);
2012-09-07 07:03:03 +00:00
2012-09-22 06:41:29 +00:00
void process(PDFDoc * doc);
2012-09-07 07:03:03 +00:00
virtual GBool upsideDown() { return gFalse; }
virtual GBool useDrawChar() { return gTrue; }
virtual GBool interpretType3Chars() { return gFalse; }
virtual GBool needNonText() { return gFalse; }
virtual GBool needClipToCropBox() { return gTrue; }
2012-09-22 06:41:29 +00:00
2012-09-07 07:03:03 +00:00
virtual void drawChar(GfxState *state, double x, double y,
double dx, double dy,
double originX, double originY,
CharCode code, int nBytes, Unicode *u, int uLen);
2013-02-05 07:30:57 +00:00
// Start a page.
// UGLY: These 2 versions are for different versions of poppler
2012-09-26 16:17:56 +00:00
virtual void startPage(int pageNum, GfxState *state);
2013-02-05 07:30:57 +00:00
virtual void startPage(int pageNum, GfxState *state, XRef * xref);
2012-09-26 16:17:56 +00:00
2012-09-07 07:03:03 +00:00
const char * get_code_map (long long font_id) const;
2012-09-26 16:17:56 +00:00
double get_max_width (void) const { return max_width; }
double get_max_height (void) const { return max_height; }
2012-09-07 07:03:03 +00:00
protected:
2013-04-06 09:01:05 +00:00
const Param & param;
2012-09-22 06:41:29 +00:00
2012-09-26 16:17:56 +00:00
double max_width, max_height;
2012-09-07 07:03:03 +00:00
long long cur_font_id;
char * cur_code_map;
std::unordered_map<long long, char*> code_maps;
};
} // namespace pdf2htmlEX
2012-09-07 07:03:03 +00:00
#endif //PREPROCESSOR_H__