1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-10-05 19:41:40 +00:00

+ quiet parameter

This commit is contained in:
Marc Sanfacon 2013-12-27 13:52:07 -05:00
parent 42fea5b1ad
commit defc1738be
6 changed files with 56 additions and 42 deletions

View File

@ -158,7 +158,7 @@ endif()
include(CheckCXXCompilerFlag) include(CheckCXXCompilerFlag)
check_cxx_compiler_flag("${CMAKE_CXX_FLAGS}" CXX0X_SUPPORT) check_cxx_compiler_flag("${CMAKE_CXX_FLAGS}" CXX0X_SUPPORT)
if(NOT CXX0X_SUPPORT) if(NOT CXX0X_SUPPORT)
message(FATAL_ERROR "Error: you compiler does not support C++0x, please update it.") message(FATAL_ERROR "Error: your compiler does not support C++0x, please update it.")
endif() endif()

View File

@ -168,7 +168,7 @@ string HTMLRenderer::dump_embedded_font (GfxFont * font, FontInfo & info)
} }
catch(int) catch(int)
{ {
cerr << "Someting wrong when trying to dump font " << hex << fn_id << dec << endl; cerr << "Something wrong when trying to dump font " << hex << fn_id << dec << endl;
} }
obj2.free(); obj2.free();
@ -895,7 +895,7 @@ const FontInfo * HTMLRenderer::install_font(GfxFont * font)
install_embedded_font(font, new_font_info); install_embedded_font(font, new_font_info);
break; break;
case gfxFontLocResident: case gfxFontLocResident:
std::cerr << "Warning: Base 14 fonts should not be specially handled now. Please report a bug!" << std::endl; cerr << "Warning: Base 14 fonts should not be specially handled now. Please report a bug!" << std::endl;
/* fall through */ /* fall through */
case gfxFontLocExternal: case gfxFontLocExternal:
install_external_font(font, new_font_info); install_external_font(font, new_font_info);

View File

@ -110,11 +110,15 @@ void HTMLRenderer::process(PDFDoc *doc)
for(int i = param.first_page; i <= param.last_page ; ++i) for(int i = param.first_page; i <= param.last_page ; ++i)
{ {
if (param.max_size != -1 && tmp_files.get_total_size() > param.max_size * 1024) { if (param.max_size != -1 && tmp_files.get_total_size() > param.max_size * 1024) {
cerr << "Stop processing, reach max size\n"; if (!param.quiet) {
cerr << "Stop processing, reach max size\n";
}
break; break;
} }
cerr << "Working: " << (i-param.first_page) << "/" << page_count << '\r' << flush; if (!param.quiet) {
cerr << "Working: " << (i-param.first_page) << "/" << page_count << '\r' << flush;
}
if(param.split_pages) if(param.split_pages)
{ {
@ -147,9 +151,11 @@ void HTMLRenderer::process(PDFDoc *doc)
f_curpage = nullptr; f_curpage = nullptr;
} }
} }
if(page_count >= 0) if (!param.quiet) {
cerr << "Working: " << page_count << "/" << page_count; if (page_count >= 0)
cerr << endl; cerr << "Working: " << page_count << "/" << page_count;
cerr << endl;
}
//////////////////////// ////////////////////////
// Process Outline // Process Outline
@ -164,7 +170,9 @@ void HTMLRenderer::process(PDFDoc *doc)
bg_renderer = nullptr; bg_renderer = nullptr;
} }
cerr << endl; if (!param.quiet) {
cerr << endl;
}
} }
void HTMLRenderer::setDefaultCTM(double *ctm) void HTMLRenderer::setDefaultCTM(double *ctm)

View File

@ -72,6 +72,7 @@ struct Param
std::string data_dir; std::string data_dir;
std::string basetmp_dir; std::string basetmp_dir;
int css_draw; int css_draw;
int quiet;
int debug; int debug;
std::string input_filename, output_filename; std::string input_filename, output_filename;

View File

@ -45,7 +45,9 @@ void Preprocessor::process(PDFDoc * doc)
int page_count = (param.last_page - param.first_page + 1); int page_count = (param.last_page - param.first_page + 1);
for(int i = param.first_page; i <= param.last_page ; ++i) for(int i = param.first_page; i <= param.last_page ; ++i)
{ {
cerr << "Preprocessing: " << (i-param.first_page) << "/" << page_count << '\r' << flush; if (!param.quiet) {
cerr << "Preprocessing: " << (i-param.first_page) << "/" << page_count << '\r' << flush;
}
doc->displayPage(this, i, DEFAULT_DPI, DEFAULT_DPI, doc->displayPage(this, i, DEFAULT_DPI, DEFAULT_DPI,
0, 0,
@ -54,9 +56,11 @@ void Preprocessor::process(PDFDoc * doc)
false, // printing false, // printing
nullptr, nullptr, nullptr, nullptr); nullptr, nullptr, nullptr, nullptr);
} }
if(page_count >= 0) if (!param.quiet) {
cerr << "Preprocessing: " << page_count << "/" << page_count; if(page_count >= 0)
cerr << endl; cerr << "Preprocessing: " << page_count << "/" << page_count;
cerr << endl;
}
} }
void Preprocessor::drawChar(GfxState *state, double x, double y, void Preprocessor::drawChar(GfxState *state, double x, double y,

View File

@ -214,6 +214,7 @@ void parse_options (int argc, char **argv)
.add("data-dir", &param.data_dir, param.data_dir, "specify data directory") .add("data-dir", &param.data_dir, param.data_dir, "specify data directory")
// TODO: css drawings are hidden on print, for annot links, need to fix it for other drawings // TODO: css drawings are hidden on print, for annot links, need to fix it for other drawings
// .add("css-draw", &param.css_draw, 0, "[experimental and unsupported] CSS drawing") // .add("css-draw", &param.css_draw, 0, "[experimental and unsupported] CSS drawing")
.add("quiet", &param.quiet, 0, "do not output information")
.add("debug", &param.debug, 0, "print debugging information") .add("debug", &param.debug, 0, "print debugging information")
// meta // meta