mirror of
https://github.com/pdf2htmlEX/pdf2htmlEX.git
synced 2024-12-22 13:00:08 +00:00
add the 'dest-dir' option
This commit is contained in:
parent
0182ea303b
commit
ed130cee60
@ -78,7 +78,7 @@ void HTMLRenderer::process(PDFDoc *doc)
|
|||||||
doc->displayPage(bg_renderer, i, param->h_dpi2, param->v_dpi2,
|
doc->displayPage(bg_renderer, i, param->h_dpi2, param->v_dpi2,
|
||||||
0, true, false, false,
|
0, true, false, false,
|
||||||
nullptr, nullptr, nullptr, nullptr);
|
nullptr, nullptr, nullptr, nullptr);
|
||||||
bg_renderer->getBitmap()->writeImgFile(splashFormatPng, (char*)(format("p%|1$x|.png")%i).str().c_str(), param->h_dpi2, param->v_dpi2);
|
bg_renderer->getBitmap()->writeImgFile(splashFormatPng, (char*)(dest_dir / (format("p%|1$x|.png")%i).str()).c_str(), param->h_dpi2, param->v_dpi2);
|
||||||
|
|
||||||
cerr << ".";
|
cerr << ".";
|
||||||
cerr.flush();
|
cerr.flush();
|
||||||
|
@ -119,7 +119,7 @@ void HTMLRenderer::install_embedded_font(GfxFont * font, const string & suffix,
|
|||||||
|
|
||||||
string fn = (format("f%|1$x|") % fn_id).str();
|
string fn = (format("f%|1$x|") % fn_id).str();
|
||||||
|
|
||||||
fontscript_fout << format("Open(\"%1%\", 1)") % (tmp_dir / (fn + suffix)) << endl;
|
fontscript_fout << format("Open(%1%, 1)") % (tmp_dir / (fn + suffix)) << endl;
|
||||||
|
|
||||||
auto ctu = font->getToUnicode();
|
auto ctu = font->getToUnicode();
|
||||||
int * code2GID = nullptr;
|
int * code2GID = nullptr;
|
||||||
@ -169,7 +169,7 @@ void HTMLRenderer::install_embedded_font(GfxFont * font, const string & suffix,
|
|||||||
|
|
||||||
if(cnt > 0)
|
if(cnt > 0)
|
||||||
{
|
{
|
||||||
fontscript_fout << format("LoadEncodingFile(\"%1%\", \"%2%\")") % (tmp_dir / (fn+".encoding")) % fn << endl;
|
fontscript_fout << format("LoadEncodingFile(%1%, \"%2%\")") % (tmp_dir / (fn+".encoding")) % fn << endl;
|
||||||
fontscript_fout << format("Reencode(\"%1%\", 1)") % fn << endl;
|
fontscript_fout << format("Reencode(\"%1%\", 1)") % fn << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -177,7 +177,7 @@ void HTMLRenderer::install_embedded_font(GfxFont * font, const string & suffix,
|
|||||||
ctu->decRefCnt();
|
ctu->decRefCnt();
|
||||||
}
|
}
|
||||||
|
|
||||||
fontscript_fout << format("Generate(\"%1%.ttf\")") % (dest_dir / fn) << endl;
|
fontscript_fout << format("Generate(%1%)") % (dest_dir / (fn+".ttf")) << endl;
|
||||||
|
|
||||||
export_remote_font(fn_id, ".ttf", "truetype", font);
|
export_remote_font(fn_id, ".ttf", "truetype", font);
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ struct Param
|
|||||||
std::string owner_password, user_password;
|
std::string owner_password, user_password;
|
||||||
std::string input_filename, output_filename;
|
std::string input_filename, output_filename;
|
||||||
|
|
||||||
std::string dest_dir;
|
std::string dest_dir, tmp_dir;
|
||||||
|
|
||||||
int first_page, last_page;
|
int first_page, last_page;
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
|
|
||||||
namespace po = boost::program_options;
|
namespace po = boost::program_options;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
using namespace boost::filesystem;
|
||||||
|
|
||||||
Param param;
|
Param param;
|
||||||
|
|
||||||
@ -122,6 +123,7 @@ po::variables_map parse_options (int argc, char **argv)
|
|||||||
("owner-password,o", po::value<string>(¶m.owner_password)->default_value(""), "owner password (for encrypted files)")
|
("owner-password,o", po::value<string>(¶m.owner_password)->default_value(""), "owner password (for encrypted files)")
|
||||||
("user-password,u", po::value<string>(¶m.user_password)->default_value(""), "user password (for encrypted files)")
|
("user-password,u", po::value<string>(¶m.user_password)->default_value(""), "user password (for encrypted files)")
|
||||||
("dest-dir", po::value<string>(¶m.dest_dir)->default_value("."), "destination directory")
|
("dest-dir", po::value<string>(¶m.dest_dir)->default_value("."), "destination directory")
|
||||||
|
("tmp-dir", po::value<string>(¶m.tmp_dir)->default_value("/tmp/pdf2htmlEX"), "temporary directory")
|
||||||
("hdpi", po::value<double>(¶m.h_dpi)->default_value(72.0), "horizontal DPI for text")
|
("hdpi", po::value<double>(¶m.h_dpi)->default_value(72.0), "horizontal DPI for text")
|
||||||
("vdpi", po::value<double>(¶m.v_dpi)->default_value(72.0), "vertical DPI for text")
|
("vdpi", po::value<double>(¶m.v_dpi)->default_value(72.0), "vertical DPI for text")
|
||||||
("hdpi2", po::value<double>(¶m.h_dpi2)->default_value(144.0), "horizontal DPI for non-text")
|
("hdpi2", po::value<double>(¶m.h_dpi2)->default_value(144.0), "horizontal DPI for non-text")
|
||||||
@ -165,6 +167,18 @@ int main(int argc, char **argv)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//prepare the directories
|
||||||
|
try
|
||||||
|
{
|
||||||
|
create_directories(param.dest_dir);
|
||||||
|
create_directories(param.tmp_dir);
|
||||||
|
}
|
||||||
|
catch (const filesystem_error& err)
|
||||||
|
{
|
||||||
|
cerr << err.what() << endl;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
// read config file
|
// read config file
|
||||||
globalParams = new GlobalParams();
|
globalParams = new GlobalParams();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user