1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-12-22 04:50:09 +00:00

add dpi option for images

This commit is contained in:
Lu Wang 2012-08-12 14:56:24 +08:00
parent 39846f33bb
commit 24636a1e64
3 changed files with 9 additions and 4 deletions

View File

@ -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();

View File

@ -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;

View File

@ -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<string>(&param.owner_password)->default_value(""), "owner password (for encrypted files)")
("user-password,u", po::value<string>(&param.user_password)->default_value(""), "user password (for encrypted files)")
("hdpi", po::value<double>(&param.h_dpi)->default_value(72.0), "horizontal DPI")
("vdpi", po::value<double>(&param.v_dpi)->default_value(72.0), "vertical DPI")
("hdpi", po::value<double>(&param.h_dpi)->default_value(72.0), "horizontal DPI for text")
("vdpi", po::value<double>(&param.v_dpi)->default_value(72.0), "vertical DPI for text")
("hdpi2", po::value<double>(&param.h_dpi2)->default_value(144.0), "horizontal DPI for non-text")
("vdpi2", po::value<double>(&param.v_dpi2)->default_value(144.0), "vertical DPI for non-text")
("heps", po::value<double>(&param.h_eps)->default_value(1.0), "max tolerated horizontal offset (in pixels)")
("veps", po::value<double>(&param.v_eps)->default_value(1.0), "max tolerated vertical offset (in pixels)")
("process-nontext", po::value<int>(&param.process_nontext)->default_value(1), "process nontext objects")