2012-09-07 07:03:03 +00:00
|
|
|
/*
|
2012-09-22 04:41:53 +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
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2012-09-22 04:41:53 +00:00
|
|
|
#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
|
|
|
|
2012-09-11 13:52:46 +00:00
|
|
|
namespace pdf2htmlEX {
|
|
|
|
|
2012-09-22 04:41:53 +00:00
|
|
|
class Preprocessor : public OutputDev {
|
2012-09-07 07:03:03 +00:00
|
|
|
public:
|
2012-09-22 06:41:29 +00:00
|
|
|
Preprocessor(const Param * param);
|
2012-09-22 04:41:53 +00:00
|
|
|
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; }
|
2013-03-28 06:59:24 +00:00
|
|
|
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:
|
2012-09-22 06:41:29 +00:00
|
|
|
const Param * param;
|
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
2012-09-11 13:52:46 +00:00
|
|
|
} // namespace pdf2htmlEX
|
2012-09-07 07:03:03 +00:00
|
|
|
|
2012-09-22 04:41:53 +00:00
|
|
|
#endif //PREPROCESSOR_H__
|