1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-10-05 19:41:40 +00:00
pdf2htmlEX/src/SplashBackgroundRenderer.cc

45 lines
1.1 KiB
C++
Raw Normal View History

2012-08-06 06:21:37 +00:00
/*
2012-10-02 12:56:40 +00:00
* SplashBackgroundRenderer.cc
2012-08-06 06:21:37 +00:00
*
2012-10-02 12:56:40 +00:00
* Copyright (C) 2012 Lu Wang <coolwanglu@gmail.com>
2012-08-06 06:21:37 +00:00
*/
2012-10-02 13:11:00 +00:00
#include <PDFDoc.h>
2012-10-02 12:56:40 +00:00
#include "SplashBackgroundRenderer.h"
2012-08-20 21:48:21 +00:00
2012-10-02 12:56:40 +00:00
namespace pdf2htmlEX {
2012-08-06 06:21:37 +00:00
2012-10-02 13:11:00 +00:00
using std::string;
2012-10-02 12:56:40 +00:00
const SplashColor SplashBackgroundRenderer::white = {255,255,255};
2012-08-20 21:48:21 +00:00
2012-10-02 12:56:40 +00:00
void SplashBackgroundRenderer::drawChar(GfxState *state, double x, double y,
2012-08-06 06:21:37 +00:00
double dx, double dy,
double originX, double originY,
CharCode code, int nBytes, Unicode *u, int uLen)
{
if(((state->getRender() & 3) == 3)
|| ((state->getFont()) && (state->getFont()->getWMode())))
{
SplashOutputDev::drawChar(state,x,y,dx,dy,originX,originY,code, nBytes, u, uLen);
}
2012-08-06 06:21:37 +00:00
}
2012-10-02 13:11:00 +00:00
static GBool annot_cb(Annot *, void *) {
return false;
};
void SplashBackgroundRenderer::render_page(PDFDoc * doc, int pageno, const string & filename)
{
doc->displayPage(this, pageno, param->h_dpi, param->v_dpi,
0, true, false, false,
nullptr, nullptr, &annot_cb, nullptr);
getBitmap()->writeImgFile(splashFormatPng,
(char*)filename.c_str(),
param->h_dpi, param->v_dpi);
}
2012-10-02 12:56:40 +00:00
} // namespace pdf2htmlEX