1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-12-22 13:00:08 +00:00

Merge pull request #3 from pdf2htmlEX/master

bring stephengaito development master in line with pdf2htmlEX master
This commit is contained in:
stephengaito 2019-09-20 06:59:39 +01:00 committed by GitHub
commit 8397de9b80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 24 additions and 17 deletions

View File

@ -10,7 +10,7 @@ option(ENABLE_SVG "Enable SVG support, for generating SVG background images and
include_directories(${CMAKE_SOURCE_DIR}/src) include_directories(${CMAKE_SOURCE_DIR}/src)
set(PDF2HTMLEX_VERSION "0.15.0") set(PDF2HTMLEX_VERSION "0.16.0")
set(ARCHIVE_NAME pdf2htmlex-${PDF2HTMLEX_VERSION}) set(ARCHIVE_NAME pdf2htmlex-${PDF2HTMLEX_VERSION})
add_custom_target(dist add_custom_target(dist
COMMAND git archive --prefix=${ARCHIVE_NAME}/ HEAD COMMAND git archive --prefix=${ARCHIVE_NAME}/ HEAD

View File

@ -81,7 +81,7 @@ void CairoBackgroundRenderer::beginTextObject(GfxState *state)
CairoOutputDev::beginTextObject(state); CairoOutputDev::beginTextObject(state);
} }
void CairoBackgroundRenderer::beginString(GfxState *state, GooString * str) void CairoBackgroundRenderer::beginString(GfxState *state, const GooString * str)
{ {
if (param.proof == 2) if (param.proof == 2)
proof_begin_string(state, this); proof_begin_string(state, this);
@ -239,7 +239,7 @@ void CairoBackgroundRenderer::setMimeData(GfxState *state, Stream *str, Object *
{ {
if (param.svg_embed_bitmap) if (param.svg_embed_bitmap)
{ {
CairoOutputDev::setMimeData(state, str, ref, colorMap, image); CairoOutputDev::setMimeData(state, str, ref, colorMap, image, cairo_image_surface_get_height (image));
return; return;
} }

View File

@ -46,7 +46,7 @@ public:
//for proof //for proof
void beginTextObject(GfxState *state); void beginTextObject(GfxState *state);
void beginString(GfxState *state, GooString * str); void beginString(GfxState *state, const GooString * str);
void endTextObject(GfxState *state); void endTextObject(GfxState *state);
void updateRender(GfxState *state); void updateRender(GfxState *state);

View File

@ -80,7 +80,7 @@ void SplashBackgroundRenderer::beginTextObject(GfxState *state)
SplashOutputDev::beginTextObject(state); SplashOutputDev::beginTextObject(state);
} }
void SplashBackgroundRenderer::beginString(GfxState *state, GooString * str) void SplashBackgroundRenderer::beginString(GfxState *state, const GooString * str)
{ {
if (param.proof == 2) if (param.proof == 2)
proof_begin_string(state, this); proof_begin_string(state, this);

View File

@ -48,7 +48,7 @@ public:
//for proof //for proof
void beginTextObject(GfxState *state); void beginTextObject(GfxState *state);
void beginString(GfxState *state, GooString * str); void beginString(GfxState *state, const GooString * str);
void endTextObject(GfxState *state); void endTextObject(GfxState *state);
void updateRender(GfxState *state); void updateRender(GfxState *state);

View File

@ -126,7 +126,7 @@ struct HTMLRenderer : OutputDev
virtual void eoClip(GfxState * state); virtual void eoClip(GfxState * state);
virtual void clipToStrokePath(GfxState * state); virtual void clipToStrokePath(GfxState * state);
virtual void drawString(GfxState * state, GooString * s); virtual void drawString(GfxState * state, const GooString * s);
virtual void drawImage(GfxState * state, Object * ref, Stream * str, int width, int height, GfxImageColorMap * colorMap, GBool interpolate, int *maskColors, GBool inlineImg); virtual void drawImage(GfxState * state, Object * ref, Stream * str, int width, int height, GfxImageColorMap * colorMap, GBool interpolate, int *maskColors, GBool inlineImg);
@ -170,7 +170,7 @@ protected:
void post_process(void); void post_process(void);
void process_outline(void); void process_outline(void);
void process_outline_items(GooList * items); void process_outline_items(const GooList * items);
void process_form(std::ofstream & out); void process_form(std::ofstream & out);
@ -179,7 +179,7 @@ protected:
void dump_css(void); void dump_css(void);
// convert a LinkAction to a string that our Javascript code can understand // convert a LinkAction to a string that our Javascript code can understand
std::string get_linkaction_str(LinkAction *, std::string & detail); std::string get_linkaction_str(const LinkAction *, std::string & detail);
//////////////////////////////////////////////////// ////////////////////////////////////////////////////
/* /*

View File

@ -595,6 +595,11 @@ void HTMLRenderer::embed_font(const string & filepath, GfxFont * font, FontInfo
bool name_conflict_warned = false; bool name_conflict_warned = false;
auto ctu = font->getToUnicode(); auto ctu = font->getToUnicode();
// NOTE: Poppler has changed its effective ABI
// in now expects the USER to increment any ref counters
assert(ctu);
((CharCodeToUnicode *)ctu)->incRefCnt();
std::fill(cur_mapping.begin(), cur_mapping.end(), -1); std::fill(cur_mapping.begin(), cur_mapping.end(), -1);
std::fill(width_list.begin(), width_list.end(), -1); std::fill(width_list.begin(), width_list.end(), -1);
@ -634,7 +639,9 @@ void HTMLRenderer::embed_font(const string & filepath, GfxFont * font, FontInfo
Unicode u, *pu=&u; Unicode u, *pu=&u;
if(info.use_tounicode) if(info.use_tounicode)
{ {
int n = ctu ? (ctu->mapToUnicode(cur_code, &pu)) : 0; int n = ctu ?
(((CharCodeToUnicode *)ctu)->mapToUnicode(cur_code, &pu)) :
0;
u = check_unicode(pu, n, cur_code, font); u = check_unicode(pu, n, cur_code, font);
} }
else else
@ -756,7 +763,7 @@ void HTMLRenderer::embed_font(const string & filepath, GfxFont * font, FontInfo
} }
if(ctu) if(ctu)
ctu->decRefCnt(); ((CharCodeToUnicode *)ctu)->decRefCnt();
} }
/* /*

View File

@ -126,7 +126,7 @@ static string get_linkdest_detail_str(LinkDest * dest, Catalog * catalog, int &
return sout.str(); return sout.str();
} }
string HTMLRenderer::get_linkaction_str(LinkAction * action, string & detail) string HTMLRenderer::get_linkaction_str(const LinkAction * action, string & detail)
{ {
string dest_str; string dest_str;
detail = ""; detail = "";
@ -137,7 +137,7 @@ string HTMLRenderer::get_linkaction_str(LinkAction * action, string & detail)
{ {
case actionGoTo: case actionGoTo:
{ {
auto * real_action = dynamic_cast<LinkGoTo*>(action); auto * real_action = dynamic_cast<const LinkGoTo*>(action);
LinkDest * dest = nullptr; LinkDest * dest = nullptr;
if(auto _ = real_action->getDest()) if(auto _ = real_action->getDest())
dest = _->copy(); dest = _->copy();
@ -162,7 +162,7 @@ string HTMLRenderer::get_linkaction_str(LinkAction * action, string & detail)
break; break;
case actionURI: case actionURI:
{ {
auto * real_action = dynamic_cast<LinkURI*>(action); auto * real_action = dynamic_cast<const LinkURI*>(action);
assert(real_action != nullptr); assert(real_action != nullptr);
dest_str = real_action->getURI()->getCString(); dest_str = real_action->getURI()->getCString();
} }

View File

@ -21,7 +21,7 @@ namespace pdf2htmlEX {
using std::ostream; using std::ostream;
void HTMLRenderer::process_outline_items(GooList * items) void HTMLRenderer::process_outline_items(const GooList * items)
{ {
if((!items) || (items->getLength() == 0)) if((!items) || (items->getLength() == 0))
return; return;

View File

@ -23,7 +23,7 @@ using std::none_of;
using std::cerr; using std::cerr;
using std::endl; using std::endl;
void HTMLRenderer::drawString(GfxState * state, GooString * s) void HTMLRenderer::drawString(GfxState * state, const GooString * s)
{ {
if(s->getLength() == 0) if(s->getLength() == 0)
return; return;
@ -58,7 +58,7 @@ void HTMLRenderer::drawString(GfxState * state, GooString * s)
// Now ready to output // Now ready to output
// get the unicodes // get the unicodes
char *p = s->getCString(); const char *p = s->getCString();
int len = s->getLength(); int len = s->getLength();
//accumulated displacement of chars in this string, in text object space //accumulated displacement of chars in this string, in text object space