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; }
|
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);
|
|
|
|
|
|
|
|
const char * get_code_map (long long font_id) const;
|
|
|
|
|
|
|
|
protected:
|
2012-09-22 06:41:29 +00:00
|
|
|
const Param * param;
|
|
|
|
|
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__
|