1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-12-22 04:50:09 +00:00

add jquery

This commit is contained in:
Lu Wang 2012-09-22 14:41:29 +08:00
parent 75c85903bc
commit 8020737b82
5 changed files with 34 additions and 31 deletions

View File

@ -101,6 +101,7 @@ pdf2htmlEX is made possible thanks to the following projects:
* [poppler](http://poppler.freedesktop.org/)
* [Fontforge](http://fontforge.org/)
* [jQuery](http://jquery.com/)
pdf2htmlEX is inspired by the following projects:

View File

@ -33,6 +33,7 @@ HTMLRenderer::HTMLRenderer(const Param * param)
:OutputDev()
,line_opened(false)
,line_buf(this)
,preprocessor(param)
,image_count(0)
,param(param)
{
@ -67,14 +68,7 @@ void HTMLRenderer::process(PDFDoc *doc)
xref = doc->getXRef();
cerr << "Preprocessing: ";
for(int i = param->first_page; i <= param->last_page ; ++i)
{
doc->displayPage(&preprocessor, i, param->h_dpi, param->v_dpi,
0, true, false, false,
nullptr, nullptr, nullptr, nullptr);
cerr << "." << flush;
}
cerr << endl;
preprocessor.process(doc);
cerr << "Working: ";
BackgroundRenderer * bg_renderer = nullptr;
@ -144,18 +138,6 @@ void HTMLRenderer::setDefaultCTM(double *ctm)
memcpy(default_ctm, ctm, sizeof(default_ctm));
}
GBool HTMLRenderer::checkPageSlice(Page *page, double hDPI, double vDPI,
int rotate, GBool useMediaBox, GBool crop,
int sliceX, int sliceY, int sliceW, int sliceH,
GBool printing,
GBool (* abortCheckCbk)(void *data),
void * abortCheckCbkData,
GBool (*annotDisplayDecideCbk)(Annot *annot, void *user_data),
void *annotDisplayDecideCbkData)
{
return gTrue;
}
void HTMLRenderer::startPage(int pageNum, GfxState *state)
{
this->pageNum = pageNum;

View File

@ -8,6 +8,7 @@
*/
#include <cstring>
#include <iostream>
#include <GfxState.h>
#include <GfxFont.h>
@ -17,8 +18,13 @@
namespace pdf2htmlEX {
Preprocessor::Preprocessor(void)
using std::cerr;
using std::endl;
using std::flush;
Preprocessor::Preprocessor(const Param * param)
: OutputDev()
, param(param)
, cur_font_id(0)
, cur_code_map(nullptr)
{ }
@ -29,6 +35,19 @@ Preprocessor::~Preprocessor(void)
delete [] iter->second;
}
void Preprocessor::process(PDFDoc * doc)
{
for(int i = param->first_page; i <= param->last_page ; ++i)
{
doc->displayPage(this, i, param->h_dpi, param->v_dpi,
0, true, false, false,
nullptr, nullptr, nullptr, nullptr);
cerr << "." << flush;
}
cerr << endl;
}
void Preprocessor::drawChar(GfxState *state, double x, double y,
double dx, double dy,
double originX, double originY,

View File

@ -83,15 +83,6 @@ class HTMLRenderer : public OutputDev
virtual void setDefaultCTM(double *ctm);
virtual GBool checkPageSlice(Page *page, double hDPI, double vDPI,
int rotate, GBool useMediaBox, GBool crop,
int sliceX, int sliceY, int sliceW, int sliceH,
GBool printing,
GBool (* abortCheckCbk)(void *data) = NULL,
void * abortCheckCbkData = NULL,
GBool (*annotDisplayDecideCbk)(Annot *annot, void *user_data) = NULL,
void *annotDisplayDecideCbkData = NULL);
// Start a page.
virtual void startPage(int pageNum, GfxState *state);

View File

@ -4,6 +4,7 @@
* PDF is so complicated that we have to scan twice
*
* Check used codes for each font
* Collect all used link destinations
*
* by WangLu
* 2012.09.07
@ -16,18 +17,25 @@
#include <unordered_map>
#include <OutputDev.h>
#include <PDFDoc.h>
#include <Annot.h>
#include "Param.h"
namespace pdf2htmlEX {
class Preprocessor : public OutputDev {
public:
Preprocessor(void);
Preprocessor(const Param * param);
virtual ~Preprocessor(void);
void process(PDFDoc * doc);
virtual GBool upsideDown() { return gFalse; }
virtual GBool useDrawChar() { return gTrue; }
virtual GBool interpretType3Chars() { return gFalse; }
virtual GBool needNonText() { return gFalse; }
virtual void drawChar(GfxState *state, double x, double y,
double dx, double dy,
double originX, double originY,
@ -36,6 +44,8 @@ public:
const char * get_code_map (long long font_id) const;
protected:
const Param * param;
long long cur_font_id;
char * cur_code_map;