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)
|
|
|
|
{
|
2012-11-16 12:46:52 +00:00
|
|
|
if(((state->getRender() & 3) == 3)
|
|
|
|
|| ((state->getFont()) && (state->getFont()->getWMode())))
|
2012-10-12 12:06:43 +00:00
|
|
|
{
|
|
|
|
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,
|
2012-12-07 12:31:09 +00:00
|
|
|
0,
|
|
|
|
(param->use_cropbox == 0),
|
|
|
|
false, false,
|
2012-10-02 13:11:00 +00:00
|
|
|
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
|