diff --git a/CMakeLists.txt b/CMakeLists.txt index 8a1cec4..f2b04e9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ option(ENABLE_SVG "Enable SVG support, for generating SVG background images and include_directories(${CMAKE_SOURCE_DIR}/src) -set(PDF2HTMLEX_VERSION "0.15.0") +set(PDF2HTMLEX_VERSION "0.16.0") set(ARCHIVE_NAME pdf2htmlex-${PDF2HTMLEX_VERSION}) add_custom_target(dist COMMAND git archive --prefix=${ARCHIVE_NAME}/ HEAD diff --git a/src/BackgroundRenderer/CairoBackgroundRenderer.cc b/src/BackgroundRenderer/CairoBackgroundRenderer.cc index d0464af..fac4904 100644 --- a/src/BackgroundRenderer/CairoBackgroundRenderer.cc +++ b/src/BackgroundRenderer/CairoBackgroundRenderer.cc @@ -81,7 +81,7 @@ void CairoBackgroundRenderer::beginTextObject(GfxState *state) CairoOutputDev::beginTextObject(state); } -void CairoBackgroundRenderer::beginString(GfxState *state, GooString * str) +void CairoBackgroundRenderer::beginString(GfxState *state, const GooString * str) { if (param.proof == 2) proof_begin_string(state, this); @@ -239,7 +239,7 @@ void CairoBackgroundRenderer::setMimeData(GfxState *state, Stream *str, Object * { 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; } diff --git a/src/BackgroundRenderer/CairoBackgroundRenderer.h b/src/BackgroundRenderer/CairoBackgroundRenderer.h index e4e92d2..b354cdc 100644 --- a/src/BackgroundRenderer/CairoBackgroundRenderer.h +++ b/src/BackgroundRenderer/CairoBackgroundRenderer.h @@ -46,7 +46,7 @@ public: //for proof void beginTextObject(GfxState *state); - void beginString(GfxState *state, GooString * str); + void beginString(GfxState *state, const GooString * str); void endTextObject(GfxState *state); void updateRender(GfxState *state); diff --git a/src/BackgroundRenderer/SplashBackgroundRenderer.cc b/src/BackgroundRenderer/SplashBackgroundRenderer.cc index 5ae289d..a7a23d8 100644 --- a/src/BackgroundRenderer/SplashBackgroundRenderer.cc +++ b/src/BackgroundRenderer/SplashBackgroundRenderer.cc @@ -80,7 +80,7 @@ void SplashBackgroundRenderer::beginTextObject(GfxState *state) SplashOutputDev::beginTextObject(state); } -void SplashBackgroundRenderer::beginString(GfxState *state, GooString * str) +void SplashBackgroundRenderer::beginString(GfxState *state, const GooString * str) { if (param.proof == 2) proof_begin_string(state, this); diff --git a/src/BackgroundRenderer/SplashBackgroundRenderer.h b/src/BackgroundRenderer/SplashBackgroundRenderer.h index 067de28..8b11da6 100644 --- a/src/BackgroundRenderer/SplashBackgroundRenderer.h +++ b/src/BackgroundRenderer/SplashBackgroundRenderer.h @@ -48,7 +48,7 @@ public: //for proof void beginTextObject(GfxState *state); - void beginString(GfxState *state, GooString * str); + void beginString(GfxState *state, const GooString * str); void endTextObject(GfxState *state); void updateRender(GfxState *state); diff --git a/src/HTMLRenderer/HTMLRenderer.h b/src/HTMLRenderer/HTMLRenderer.h index 24c76cd..7ec04bf 100644 --- a/src/HTMLRenderer/HTMLRenderer.h +++ b/src/HTMLRenderer/HTMLRenderer.h @@ -126,7 +126,7 @@ struct HTMLRenderer : OutputDev virtual void eoClip(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); @@ -170,7 +170,7 @@ protected: void post_process(void); void process_outline(void); - void process_outline_items(GooList * items); + void process_outline_items(const GooList * items); void process_form(std::ofstream & out); @@ -179,7 +179,7 @@ protected: void dump_css(void); // 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); //////////////////////////////////////////////////// /* diff --git a/src/HTMLRenderer/font.cc b/src/HTMLRenderer/font.cc index cf98db4..301bf30 100644 --- a/src/HTMLRenderer/font.cc +++ b/src/HTMLRenderer/font.cc @@ -595,6 +595,11 @@ void HTMLRenderer::embed_font(const string & filepath, GfxFont * font, FontInfo bool name_conflict_warned = false; 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(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; 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); } else @@ -756,7 +763,7 @@ void HTMLRenderer::embed_font(const string & filepath, GfxFont * font, FontInfo } if(ctu) - ctu->decRefCnt(); + ((CharCodeToUnicode *)ctu)->decRefCnt(); } /* diff --git a/src/HTMLRenderer/link.cc b/src/HTMLRenderer/link.cc index b8b4129..bf61e4a 100644 --- a/src/HTMLRenderer/link.cc +++ b/src/HTMLRenderer/link.cc @@ -126,7 +126,7 @@ static string get_linkdest_detail_str(LinkDest * dest, Catalog * catalog, int & 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; detail = ""; @@ -137,7 +137,7 @@ string HTMLRenderer::get_linkaction_str(LinkAction * action, string & detail) { case actionGoTo: { - auto * real_action = dynamic_cast(action); + auto * real_action = dynamic_cast(action); LinkDest * dest = nullptr; if(auto _ = real_action->getDest()) dest = _->copy(); @@ -162,7 +162,7 @@ string HTMLRenderer::get_linkaction_str(LinkAction * action, string & detail) break; case actionURI: { - auto * real_action = dynamic_cast(action); + auto * real_action = dynamic_cast(action); assert(real_action != nullptr); dest_str = real_action->getURI()->getCString(); } diff --git a/src/HTMLRenderer/outline.cc b/src/HTMLRenderer/outline.cc index 12c3896..205eac7 100644 --- a/src/HTMLRenderer/outline.cc +++ b/src/HTMLRenderer/outline.cc @@ -21,7 +21,7 @@ namespace pdf2htmlEX { using std::ostream; -void HTMLRenderer::process_outline_items(GooList * items) +void HTMLRenderer::process_outline_items(const GooList * items) { if((!items) || (items->getLength() == 0)) return; diff --git a/src/HTMLRenderer/text.cc b/src/HTMLRenderer/text.cc index 754c75b..16bb478 100644 --- a/src/HTMLRenderer/text.cc +++ b/src/HTMLRenderer/text.cc @@ -23,7 +23,7 @@ using std::none_of; using std::cerr; using std::endl; -void HTMLRenderer::drawString(GfxState * state, GooString * s) +void HTMLRenderer::drawString(GfxState * state, const GooString * s) { if(s->getLength() == 0) return; @@ -58,7 +58,7 @@ void HTMLRenderer::drawString(GfxState * state, GooString * s) // Now ready to output // get the unicodes - char *p = s->getCString(); + const char *p = s->getCString(); int len = s->getLength(); //accumulated displacement of chars in this string, in text object space