mirror of
https://github.com/pdf2htmlEX/pdf2htmlEX.git
synced 2024-12-22 04:50:09 +00:00
Improve help texts for --svg-node-count-limit and --svg-embed-bitmap; rename --svg-nodes-limit to --svg-node-count-limit.
This commit is contained in:
parent
5681fe11c0
commit
fdbc70401f
@ -248,6 +248,16 @@ If set to 1, pdf2htmlEX will try to reduce the number of HTML elements used for
|
||||
.B --bg-format <format> (Default: png)
|
||||
Specify the background image format. Run `pdf2htmlEX -v` to check all supported formats.
|
||||
|
||||
.TP
|
||||
.B --svg-node-count-limit <limit> (Default: -1)
|
||||
If node count in a svg background image exceeds this limit, fall back this page to bitmap background; negative value means no limit.
|
||||
This option is only useful when '--bg-format svg' is specified. Note that node count in svg is just calculated approximately.
|
||||
|
||||
.TP
|
||||
.B --svg-embed-bitmap <0|1> (Default: 1)
|
||||
Whether embed bitmaps in svg background image. 1: embed bitmaps in svg background; 0: dump bitmaps to external files if possible.
|
||||
JPEG images in a PDF are most possibly dumped. This option is only useful when '--bg-format svg' is specified.
|
||||
|
||||
.SS PDF Protection
|
||||
|
||||
.TP
|
||||
|
@ -44,7 +44,7 @@ BackgroundRenderer * BackgroundRenderer::getBackgroundRenderer(const std::string
|
||||
|
||||
BackgroundRenderer * BackgroundRenderer::getFallbackBackgroundRenderer(HTMLRenderer * html_renderer, const Param & param)
|
||||
{
|
||||
if (param.bg_format == "svg" && param.svg_nodes_limit > 0)
|
||||
if (param.bg_format == "svg" && param.svg_node_count_limit >= 0)
|
||||
return new SplashBackgroundRenderer("", html_renderer, param);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ bool CairoBackgroundRenderer::render_page(PDFDoc * doc, int pageno)
|
||||
}
|
||||
|
||||
//check node count in the svg file, fall back to bitmap_renderer if necessary.
|
||||
if (param.svg_nodes_limit > 0)
|
||||
if (param.svg_node_count_limit >= 0)
|
||||
{
|
||||
int n = 0;
|
||||
char c;
|
||||
@ -140,7 +140,7 @@ bool CairoBackgroundRenderer::render_page(PDFDoc * doc, int pageno)
|
||||
{
|
||||
if (c == '<')
|
||||
++n;
|
||||
if (n > param.svg_nodes_limit)
|
||||
if (n > param.svg_node_count_limit)
|
||||
{
|
||||
html_renderer->tmp_files.add(fn);
|
||||
return false;
|
||||
@ -149,8 +149,8 @@ bool CairoBackgroundRenderer::render_page(PDFDoc * doc, int pageno)
|
||||
}
|
||||
|
||||
// the svg file is actually used, so add its bitmaps' ref count.
|
||||
for (auto i = bitmaps_in_current_page.begin(); i != bitmaps_in_current_page.end(); i++)
|
||||
++bitmaps_ref_count[*i];
|
||||
for (auto itr = bitmaps_in_current_page.begin(); itr != bitmaps_in_current_page.end(); itr++)
|
||||
++bitmaps_ref_count[*itr];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ struct Param
|
||||
|
||||
// background image
|
||||
std::string bg_format;
|
||||
int svg_nodes_limit;
|
||||
int svg_node_count_limit;
|
||||
int svg_embed_bitmap;
|
||||
|
||||
// encryption
|
||||
|
@ -190,10 +190,9 @@ void parse_options (int argc, char **argv)
|
||||
|
||||
// background image
|
||||
.add("bg-format", ¶m.bg_format, "png", "specify background image format")
|
||||
.add("svg-nodes-limit", ¶m.svg_nodes_limit, 0, "if node count in a svg background image exceeds this limit,"
|
||||
" fall back to bitmap background. 0 or negative means no limit.")
|
||||
.add("svg-embed-bitmap", ¶m.svg_embed_bitmap, 1, "embed bitmaps in svg files or save them as external files"
|
||||
" (even if 0 is specified, some bitmaps may still be embedded)")
|
||||
.add("svg-node-count-limit", ¶m.svg_node_count_limit, -1, "if node count in a svg background image exceeds this limit,"
|
||||
" fall back this page to bitmap background; negative value means no limit.")
|
||||
.add("svg-embed-bitmap", ¶m.svg_embed_bitmap, 1, "1: embed bitmaps in svg background; 0: dump bitmaps to external files if possible.")
|
||||
|
||||
// encryption
|
||||
.add("owner-password,o", ¶m.owner_password, "", "owner password (for encrypted files)", true)
|
||||
|
Loading…
Reference in New Issue
Block a user