" << endl;
diff --git a/src/HTMLRenderer/image.cc b/src/HTMLRenderer/image.cc
index cc70d17..5a16528 100644
--- a/src/HTMLRenderer/image.cc
+++ b/src/HTMLRenderer/image.cc
@@ -16,12 +16,14 @@ const int *int_p_NULL = nullptr;
#include "HTMLRenderer.h"
#include "namespace.h"
+using namespace boost::gil;
+
void HTMLRenderer::drawImage(GfxState * state, Object * ref, Stream * str, int width, int height, GfxImageColorMap * colorMap, GBool interpolate, int *maskColors, GBool inlineImg)
{
if(maskColors)
return;
- boost::gil::rgb8_image_t img(width, height);
+ rgb8_image_t img(width, height);
auto imgview = view(img);
auto loc = imgview.xy_at(0,0);
@@ -36,7 +38,7 @@ void HTMLRenderer::drawImage(GfxState * state, Object * ref, Stream * str, int w
GfxRGB rgb;
colorMap->getRGB(p, &rgb);
- *loc = boost::gil::rgb8_pixel_t(colToByte(rgb.r), colToByte(rgb.g), colToByte(rgb.b));
+ *loc = rgb8_pixel_t(colToByte(rgb.r), colToByte(rgb.g), colToByte(rgb.b));
p += colorMap->getNumPixelComps();
@@ -46,7 +48,7 @@ void HTMLRenderer::drawImage(GfxState * state, Object * ref, Stream * str, int w
loc = imgview.xy_at(0, i+1);
}
- boost::gil::png_write_view((boost::format("i%|1$x|.png")%image_count).str(), imgview);
+ png_write_view((format("i%|1$x|.png")%image_count).str(), imgview);
img_stream->close();
delete img_stream;
@@ -55,7 +57,7 @@ void HTMLRenderer::drawImage(GfxState * state, Object * ref, Stream * str, int w
double * ctm = state->getCTM();
ctm[4] = ctm[5] = 0.0;
- html_fout << boost::format("
") % image_count % install_transform_matrix(ctm) % state->getCurX() % state->getCurY() % width % height << endl;
+ html_fout << format("
") % image_count % install_transform_matrix(ctm) % state->getCurX() % state->getCurY() % width % height << endl;
++ image_count;
diff --git a/src/HTMLRenderer/install.cc b/src/HTMLRenderer/install.cc
index 7efde5f..5b4c695 100644
--- a/src/HTMLRenderer/install.cc
+++ b/src/HTMLRenderer/install.cc
@@ -38,7 +38,7 @@ long long HTMLRenderer::install_font(GfxFont * font)
if(param->debug)
{
- cerr << "Install font: (" << (font->getID()->num) << ' ' << (font->getID()->gen) << ") -> " << boost::format("f%|1$x|")%new_fn_id << endl;
+ cerr << "Install font: (" << (font->getID()->num) << ' ' << (font->getID()->gen) << ") -> " << format("f%|1$x|")%new_fn_id << endl;
}
if(font->getType() == fontType3) {
@@ -117,9 +117,9 @@ void HTMLRenderer::install_embedded_font(GfxFont * font, const string & suffix,
* generate an encoding file and let fontforge handle it.
*/
- string fn = (boost::format("f%|1$x|") % fn_id).str();
+ string fn = (format("f%|1$x|") % fn_id).str();
- fontscript_fout << boost::format("Open(\"%1%/%2%%3%\",1)") % TMP_DIR % fn % suffix << endl;
+ fontscript_fout << format("Open(\"%1%\", 1)") % (tmp_dir / (fn + suffix)) << endl;
auto ctu = font->getToUnicode();
int * code2GID = nullptr;
@@ -141,7 +141,7 @@ void HTMLRenderer::install_embedded_font(GfxFont * font, const string & suffix,
}
else
{
- fontscript_fout << boost::format("Reencode(\"original\")") << endl;
+ fontscript_fout << format("Reencode(\"original\")") << endl;
int len;
// code2GID has been stored for embedded CID fonts
code2GID = dynamic_cast
(font)->getCodeToGIDMap(nullptr, &len);
@@ -150,7 +150,7 @@ void HTMLRenderer::install_embedded_font(GfxFont * font, const string & suffix,
if(maxcode > 0)
{
- ofstream map_fout((boost::format("%1%/%2%.encoding") % TMP_DIR % fn).str().c_str());
+ ofstream map_fout(tmp_dir / (fn + ".encoding"));
int cnt = 0;
for(int i = 0; i <= maxcode; ++i)
{
@@ -160,24 +160,24 @@ void HTMLRenderer::install_embedded_font(GfxFont * font, const string & suffix,
if(n > 0)
{
++cnt;
- map_fout << boost::format("0x%|1$X|") % (code2GID ? code2GID[i] : i);
+ map_fout << format("0x%|1$X|") % (code2GID ? code2GID[i] : i);
for(int j = 0; j < n; ++j)
- map_fout << boost::format(" 0x%|1$X|") % u[j];
- map_fout << boost::format(" # 0x%|1$X|") % i << endl;
+ map_fout << format(" 0x%|1$X|") % u[j];
+ map_fout << format(" # 0x%|1$X|") % i << endl;
}
}
if(cnt > 0)
{
- fontscript_fout << boost::format("LoadEncodingFile(\"%1%/%2%.encoding\", \"%2%\")") % TMP_DIR % fn << endl;
- fontscript_fout << boost::format("Reencode(\"%1%\", 1)") % fn << endl;
+ fontscript_fout << format("LoadEncodingFile(\"%1%\", \"%2%\")") % (tmp_dir / (fn+".encoding")) % fn << endl;
+ fontscript_fout << format("Reencode(\"%1%\", 1)") % fn << endl;
}
}
ctu->decRefCnt();
}
- fontscript_fout << boost::format("Generate(\"%1%.ttf\")") % fn << endl;
+ fontscript_fout << format("Generate(\"%1%.ttf\")") % (dest_dir / fn) << endl;
export_remote_font(fn_id, ".ttf", "truetype", font);
}
diff --git a/src/HTMLRenderer/namespace.h b/src/HTMLRenderer/namespace.h
index 8250550..018cc94 100644
--- a/src/HTMLRenderer/namespace.h
+++ b/src/HTMLRenderer/namespace.h
@@ -18,6 +18,7 @@ using std::make_pair;
using boost::filesystem::ifstream;
using boost::filesystem::ofstream;
using boost::filesystem::path;
+using boost::format;
#endif // NAMESPACE_H__
diff --git a/src/HTMLRenderer/text.cc b/src/HTMLRenderer/text.cc
index d903fca..0ccf6a9 100644
--- a/src/HTMLRenderer/text.cc
+++ b/src/HTMLRenderer/text.cc
@@ -113,7 +113,7 @@ string HTMLRenderer::dump_embedded_font (GfxFont * font, long long fn_id)
}
obj.streamReset();
- outf.open((boost::format("%1%/f%|2$x|%3%")%TMP_DIR%fn_id%suffix).str().c_str(), ofstream::binary);
+ outf.open(tmp_dir / (format("f%|1$x|%2%")%fn_id%suffix).str(), ofstream::binary);
while((len = obj.streamGetChars(1024, (Guchar*)buf)) > 0)
{
outf.write(buf, len);
@@ -162,7 +162,7 @@ void HTMLRenderer::drawString(GfxState * state, GooString * s)
{
double w;
auto wid = install_whitespace(target, w);
- html_fout << boost::format(" ") % wid;
+ html_fout << format(" ") % wid;
draw_tx += w / draw_scale;
}
}
@@ -179,11 +179,11 @@ void HTMLRenderer::drawString(GfxState * state, GooString * s)
// classes
html_fout << "transform(state->getCurX(), state->getCurY(), &x, &y);
- html_fout << boost::format("data-lx=\"%5%\" data-ly=\"%6%\" data-drawscale=\"%4%\" data-x=\"%1%\" data-y=\"%2%\" data-hs=\"%3%")
+ html_fout << format("data-lx=\"%5%\" data-ly=\"%6%\" data-drawscale=\"%4%\" data-x=\"%1%\" data-y=\"%2%\" data-hs=\"%3%")
%x%y%(state->getHorizScaling())%draw_scale%state->getLineX()%state->getLineY();
#endif
}
diff --git a/src/Param.h b/src/Param.h
index 934c579..ffeda91 100644
--- a/src/Param.h
+++ b/src/Param.h
@@ -15,6 +15,9 @@ struct Param
{
std::string owner_password, user_password;
std::string input_filename, output_filename;
+
+ std::string dest_dir;
+
int first_page, last_page;
double h_dpi, v_dpi;
diff --git a/src/pdf2htmlEX.cc b/src/pdf2htmlEX.cc
index 84b15a4..f697c0d 100644
--- a/src/pdf2htmlEX.cc
+++ b/src/pdf2htmlEX.cc
@@ -121,6 +121,7 @@ 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)")
+ ("dest-dir", po::value(¶m.dest_dir)->default_value("."), "destination directory")
("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")