1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-07-07 18:30:34 +00:00

new option --printing

This commit is contained in:
Lu Wang 2013-04-30 19:07:55 +08:00
parent e65791e5ae
commit 4d3f4655e5
4 changed files with 33 additions and 22 deletions

View File

@ -43,7 +43,7 @@ If multiple values are specified, the minimum one will be used.
If none is specified, pages will be rendered as 72DPI. If none is specified, pages will be rendered as 72DPI.
.TP .TP
.B --use-cropbox <0|1> (Default: 0) .B --use-cropbox <0|1> (Default: 1)
Use CropBox instead of MediaBox for output. Use CropBox instead of MediaBox for output.
.TP .TP
@ -95,7 +95,7 @@ This switch is useful if you want pages to be loaded separately & dynamically --
.TP .TP
.B --dest-dir <dir> (Default: .) .B --dest-dir <dir> (Default: .)
Specify destination folder Specify destination folder.
.TP .TP
.B --css-filename <filename> (Default: <none>) .B --css-filename <filename> (Default: <none>)
@ -109,10 +109,6 @@ Specify the filename of the generated outline file, if not embedded.
If it's empty, the file name will be determined automatically. If it's empty, the file name will be determined automatically.
.TP
.B --fallback <0|1> (Deafult: 0)
Output in fallback mode, for better accuracy and browser compatibility, but the size becomes larger.
.TP .TP
.B --process-nontext <0|1> (Default: 1) .B --process-nontext <0|1> (Default: 1)
Whether to process non-text objects (as images) Whether to process non-text objects (as images)
@ -121,6 +117,14 @@ Whether to process non-text objects (as images)
.B --process-outline <0|1> (Default: 1) .B --process-outline <0|1> (Default: 1)
Whether to show outline in the generated HTML Whether to show outline in the generated HTML
.TP
.B --printing <0|1> (Default: 1)
Enable printing support. Disabling this option may reduce the size of CSS.
.TP
.B --fallback <0|1> (Deafult: 0)
Output in fallback mode, for better accuracy and browser compatibility, but the size becomes larger.
.SS Fonts .SS Fonts
.TP .TP
@ -148,6 +152,8 @@ Decompose ligatures. For example 'fi' -> 'f''i'.
.B --remove-unused-glyph <0|1> (Default: 1) .B --remove-unused-glyph <0|1> (Default: 1)
If set to 1, remove unused glyphs in embedded fonts in order to reduce the file size. If set to 1, remove unused glyphs in embedded fonts in order to reduce the file size.
Try turning it off if you encounter segmentation fault or debris-like fonts.
.TP .TP
.B --auto-hint <0|1> (Default: 0) .B --auto-hint <0|1> (Default: 0)
If set to 1, hints will be generated for the fonts using fontforge. If set to 1, hints will be generated for the fonts using fontforge.

View File

@ -460,22 +460,25 @@ void HTMLRenderer::dump_css (void)
all_manager.bgimage_size .dump_css(f_css.fs); all_manager.bgimage_size .dump_css(f_css.fs);
// print css // print css
double ps = print_scale(); if(param.printing)
f_css.fs << CSS::PRINT_ONLY << "{" << endl; {
all_manager.transform_matrix.dump_print_css(f_css.fs, ps); double ps = print_scale();
all_manager.vertical_align .dump_print_css(f_css.fs, ps); f_css.fs << CSS::PRINT_ONLY << "{" << endl;
all_manager.letter_space .dump_print_css(f_css.fs, ps); all_manager.transform_matrix.dump_print_css(f_css.fs, ps);
all_manager.stroke_color .dump_print_css(f_css.fs, ps); all_manager.vertical_align .dump_print_css(f_css.fs, ps);
all_manager.word_space .dump_print_css(f_css.fs, ps); all_manager.letter_space .dump_print_css(f_css.fs, ps);
all_manager.whitespace .dump_print_css(f_css.fs, ps); all_manager.stroke_color .dump_print_css(f_css.fs, ps);
all_manager.fill_color .dump_print_css(f_css.fs, ps); all_manager.word_space .dump_print_css(f_css.fs, ps);
all_manager.font_size .dump_print_css(f_css.fs, ps); all_manager.whitespace .dump_print_css(f_css.fs, ps);
all_manager.bottom .dump_print_css(f_css.fs, ps); all_manager.fill_color .dump_print_css(f_css.fs, ps);
all_manager.height .dump_print_css(f_css.fs, ps); all_manager.font_size .dump_print_css(f_css.fs, ps);
all_manager.width .dump_print_css(f_css.fs, ps); all_manager.bottom .dump_print_css(f_css.fs, ps);
all_manager.left .dump_print_css(f_css.fs, ps); all_manager.height .dump_print_css(f_css.fs, ps);
all_manager.bgimage_size .dump_print_css(f_css.fs, ps); all_manager.width .dump_print_css(f_css.fs, ps);
f_css.fs << "}" << endl; all_manager.left .dump_print_css(f_css.fs, ps);
all_manager.bgimage_size .dump_print_css(f_css.fs, ps);
f_css.fs << "}" << endl;
}
} }
void HTMLRenderer::embed_file(ostream & out, const string & path, const string & type, bool copy) void HTMLRenderer::embed_file(ostream & out, const string & path, const string & type, bool copy)

View File

@ -32,6 +32,7 @@ struct Param
std::string outline_filename; std::string outline_filename;
int process_nontext; int process_nontext;
int process_outline; int process_outline;
int printing;
int fallback; int fallback;
// fonts // fonts

View File

@ -77,6 +77,7 @@ void parse_options (int argc, char **argv)
.add("outline-filename", &param.outline_filename, "", "filename of the generated outline file") .add("outline-filename", &param.outline_filename, "", "filename of the generated outline file")
.add("process-nontext", &param.process_nontext, 1, "render graphics in addition to text") .add("process-nontext", &param.process_nontext, 1, "render graphics in addition to text")
.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("fallback", &param.fallback, 0, "output in fallback mode") .add("fallback", &param.fallback, 0, "output in fallback mode")
// fonts // fonts