From 24636a1e6457c23271d0f358b30cb4ad0634f615 Mon Sep 17 00:00:00 2001 From: Lu Wang Date: Sun, 12 Aug 2012 14:56:24 +0800 Subject: [PATCH] add dpi option for images --- src/HTMLRenderer.cc | 6 ++++-- src/Param.h | 1 + src/pdftohtmlEX.cc | 6 ++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/HTMLRenderer.cc b/src/HTMLRenderer.cc index 4bff598..a9a282e 100644 --- a/src/HTMLRenderer.cc +++ b/src/HTMLRenderer.cc @@ -102,10 +102,10 @@ void HTMLRenderer::process(PDFDoc *doc) for(int i = param->first_page; i <= param->last_page ; ++i) { - doc->displayPage(bg_renderer, i, 4*param->h_dpi, 4*param->v_dpi, + doc->displayPage(bg_renderer, i, param->h_dpi2, param->v_dpi2, 0, true, false, false, nullptr, nullptr, nullptr, nullptr); - bg_renderer->getBitmap()->writeImgFile(splashFormatPng, (char*)(boost::format("p%|1$x|.png")%i).str().c_str(), 4*param->h_dpi, 4*param->v_dpi); + bg_renderer->getBitmap()->writeImgFile(splashFormatPng, (char*)(boost::format("p%|1$x|.png")%i).str().c_str(), param->h_dpi2, param->v_dpi2); std::cerr << "."; std::cerr.flush(); @@ -900,6 +900,8 @@ void HTMLRenderer::install_embedded_font(GfxFont * font, const std::string & suf std::string fn = (boost::format("f%|1$x|") % fn_id).str(); fontscript_fout << boost::format("Open(\"%1%/%2%%3%\",1)") % TMP_DIR % fn % suffix << endl; + + // TODO: CID fonts without ToUnicode if(font->hasToUnicodeCMap()) { auto ctu = font->getToUnicode(); diff --git a/src/Param.h b/src/Param.h index 39f8462..4ef8ba8 100644 --- a/src/Param.h +++ b/src/Param.h @@ -18,6 +18,7 @@ struct Param int first_page, last_page; double h_dpi, v_dpi; + double h_dpi2, v_dpi2; double h_eps, v_eps; int process_nontext; diff --git a/src/pdftohtmlEX.cc b/src/pdftohtmlEX.cc index 366324f..c2d38db 100644 --- a/src/pdftohtmlEX.cc +++ b/src/pdftohtmlEX.cc @@ -121,8 +121,10 @@ po::variables_map parse_options (int argc, char **argv) ("metadata,m", "show the document meta data in JSON") ("owner-password,o", po::value(¶m.owner_password)->default_value(""), "owner password (for encrypted files)") ("user-password,u", po::value(¶m.user_password)->default_value(""), "user password (for encrypted files)") - ("hdpi", po::value(¶m.h_dpi)->default_value(72.0), "horizontal DPI") - ("vdpi", po::value(¶m.v_dpi)->default_value(72.0), "vertical DPI") + ("hdpi", po::value(¶m.h_dpi)->default_value(72.0), "horizontal DPI for text") + ("vdpi", po::value(¶m.v_dpi)->default_value(72.0), "vertical DPI for text") + ("hdpi2", po::value(¶m.h_dpi2)->default_value(144.0), "horizontal DPI for non-text") + ("vdpi2", po::value(¶m.v_dpi2)->default_value(144.0), "vertical DPI for non-text") ("heps", po::value(¶m.h_eps)->default_value(1.0), "max tolerated horizontal offset (in pixels)") ("veps", po::value(¶m.v_eps)->default_value(1.0), "max tolerated vertical offset (in pixels)") ("process-nontext", po::value(¶m.process_nontext)->default_value(1), "process nontext objects")