1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-12-22 13:00:08 +00:00
This commit is contained in:
Lu Wang 2014-01-11 16:25:09 +08:00
parent ae7c8e8d9c
commit 1cd9f00955
6 changed files with 26 additions and 26 deletions

1
TODO
View File

@ -1,6 +1,5 @@
save width in Textline, create new <div> in the middle save width in Textline, create new <div> in the middle
add async to <script>
link in outline: dest-detail vs hashtag link in outline: dest-detail vs hashtag
split js files split js files

View File

@ -82,13 +82,6 @@ This switch is useful if you want pages to be loaded separately & dynamically --
Also see --page-filename. Also see --page-filename.
.TP
.B --tmp-file-size-limit <limit> (Default: -1)
This limits the total size of the temporary files which will also limit the total size of the output file.
This is an estimate and it will stop after a page, once the total temporary files size is greater than this number.
-1 means no limit and is the default.
.TP .TP
.B --dest-dir <dir> (Default: .) .B --dest-dir <dir> (Default: .)
Specify destination folder. Specify destination folder.
@ -149,6 +142,14 @@ Enable printing support. Disabling this option may reduce the size of CSS.
.B --fallback <0|1> (Deafult: 0) .B --fallback <0|1> (Deafult: 0)
Output in fallback mode, for better accuracy and browser compatibility, but the size becomes larger. Output in fallback mode, for better accuracy and browser compatibility, but the size becomes larger.
.TP
.B --tmp-file-size-limit <limit> (Default: -1)
This limits the total size (in KB) of the temporary files which will also limit the total size of the output file.
This is an estimate and it will stop after a page, once the total temporary files size is greater than this number.
-1 means no limit and is the default.
.SS Fonts .SS Fonts
.TP .TP

View File

@ -31,7 +31,6 @@ struct Param
int embed_javascript; int embed_javascript;
int embed_outline; int embed_outline;
int split_pages; int split_pages;
int tmp_file_size_limit;
std::string dest_dir; std::string dest_dir;
std::string css_filename; std::string css_filename;
std::string page_filename; std::string page_filename;
@ -40,6 +39,7 @@ struct Param
int process_outline; int process_outline;
int printing; int printing;
int fallback; int fallback;
int tmp_file_size_limit;
// fonts // fonts
int embed_external_font; int embed_external_font;

View File

@ -46,6 +46,20 @@ void TmpFiles::add( const string & fn)
cerr << "Add new temporary file: " << fn << endl; cerr << "Add new temporary file: " << fn << endl;
} }
// Return the total size of the temporary files in bytes
double TmpFiles::get_total_size() const
{
double total_size = 0;
struct STAT st;
for(auto iter = tmp_files.begin(); iter != tmp_files.end(); ++iter) {
STAT(iter->c_str(), &st);
total_size += st.st_size;
}
return total_size;
}
void TmpFiles::clean() void TmpFiles::clean()
{ {
if(!param.clean_tmp) if(!param.clean_tmp)
@ -64,18 +78,5 @@ void TmpFiles::clean()
cerr << "Remove temporary directory: " << param.tmp_dir << endl; cerr << "Remove temporary directory: " << param.tmp_dir << endl;
} }
// Return the total size of the temporary files in bytes
double TmpFiles::get_total_size() const
{
double total_size = 0;
struct STAT st;
for(auto iter = tmp_files.begin(); iter != tmp_files.end(); ++iter) {
STAT(iter->c_str(), &st);
total_size += st.st_size;
}
return total_size;
}
} // namespace pdf2htmlEX } // namespace pdf2htmlEX

View File

@ -169,7 +169,6 @@ void parse_options (int argc, char **argv)
.add("embed-image", &param.embed_image, 1, "embed image files into output") .add("embed-image", &param.embed_image, 1, "embed image files into output")
.add("embed-javascript", &param.embed_javascript, 1, "embed JavaScript files into output") .add("embed-javascript", &param.embed_javascript, 1, "embed JavaScript files into output")
.add("embed-outline", &param.embed_outline, 1, "embed outlines into output") .add("embed-outline", &param.embed_outline, 1, "embed outlines into output")
.add("tmp-file-size-limit", &param.tmp_file_size_limit, -1, "Limit the temporary file output size, in KB (-1 for no limit). This is only an estimate, the output may be bigger")
.add("split-pages", &param.split_pages, 0, "split pages into separate files") .add("split-pages", &param.split_pages, 0, "split pages into separate files")
.add("dest-dir", &param.dest_dir, ".", "specify destination directory") .add("dest-dir", &param.dest_dir, ".", "specify destination directory")
.add("css-filename", &param.css_filename, "", "filename of the generated css file") .add("css-filename", &param.css_filename, "", "filename of the generated css file")
@ -179,6 +178,7 @@ void parse_options (int argc, char **argv)
.add("process-outline", &param.process_outline, 1, "show outline in HTML") .add("process-outline", &param.process_outline, 1, "show outline in HTML")
.add("printing", &param.printing, 1, "enable printing support") .add("printing", &param.printing, 1, "enable printing support")
.add("fallback", &param.fallback, 0, "output in fallback mode") .add("fallback", &param.fallback, 0, "output in fallback mode")
.add("tmp-file-size-limit", &param.tmp_file_size_limit, -1, "Maximum size (in KB) used by temporary files, -1 for no limit.")
// fonts // fonts
.add("embed-external-font", &param.embed_external_font, 1, "embed local match for external fonts") .add("embed-external-font", &param.embed_external_font, 1, "embed local match for external fonts")
@ -384,9 +384,8 @@ int main(int argc, char **argv)
//prepare the directories //prepare the directories
prepare_directories(); prepare_directories();
if(param.debug) { if(param.debug)
cerr << "temporary dir: " << (param.tmp_dir) << endl; cerr << "temporary dir: " << (param.tmp_dir) << endl;
}
try try
{ {

View File

@ -59,7 +59,7 @@ void ffw_init(int debug)
if ( default_encoding==NULL ) if ( default_encoding==NULL )
default_encoding=FindOrMakeEncoding("ISO8859-1"); default_encoding=FindOrMakeEncoding("ISO8859-1");
if ( default_encoding==NULL ) if ( default_encoding==NULL )
default_encoding=&custom; /* In case iconv is broken */ default_encoding=&custom; /* In case iconv is broken */
if(!debug) if(!debug)
{ {