mirror of
https://github.com/pdf2htmlEX/pdf2htmlEX.git
synced 2024-12-22 13:00:08 +00:00
fallback mode
This commit is contained in:
parent
72e010acf2
commit
bd1c9c138f
@ -87,6 +87,10 @@ 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)
|
||||||
|
@ -164,11 +164,12 @@ span { /* text blocks within a line */
|
|||||||
color:transparent;
|
color:transparent;
|
||||||
z-index:-1;
|
z-index:-1;
|
||||||
}
|
}
|
||||||
|
/* selection background should not be opaque, for fallback mode */
|
||||||
::selection{
|
::selection{
|
||||||
background: rgba(127,255,255,1);
|
background: rgba(127,255,255,0.4);
|
||||||
}
|
}
|
||||||
::-moz-selection{
|
::-moz-selection{
|
||||||
background: rgba(127,255,255,1);
|
background: rgba(127,255,255,0.4);
|
||||||
}
|
}
|
||||||
.@CSS_PAGE_DATA_CN@ { /* info for Javascript */
|
.@CSS_PAGE_DATA_CN@ { /* info for Javascript */
|
||||||
display:none;
|
display:none;
|
||||||
|
@ -20,10 +20,12 @@ void SplashBackgroundRenderer::drawChar(GfxState *state, double x, double y,
|
|||||||
CharCode code, int nBytes, Unicode *u, int uLen)
|
CharCode code, int nBytes, Unicode *u, int uLen)
|
||||||
{
|
{
|
||||||
// draw characters as image when
|
// draw characters as image when
|
||||||
// - there is special filling method
|
// - in fallback mode
|
||||||
|
// - OR there is special filling method
|
||||||
// - OR using a writing mode font
|
// - OR using a writing mode font
|
||||||
// - OR using a Type 3 font
|
// - OR using a Type 3 font
|
||||||
if(( (state->getFont())
|
if((param->fallback)
|
||||||
|
|| ( (state->getFont())
|
||||||
&& ( (state->getFont()->getWMode())
|
&& ( (state->getFont()->getWMode())
|
||||||
|| (state->getFont()->getType() == fontType3)
|
|| (state->getFont()->getType() == fontType3)
|
||||||
)
|
)
|
||||||
@ -42,7 +44,7 @@ void SplashBackgroundRenderer::render_page(PDFDoc * doc, int pageno, const strin
|
|||||||
{
|
{
|
||||||
doc->displayPage(this, pageno, param->h_dpi, param->v_dpi,
|
doc->displayPage(this, pageno, param->h_dpi, param->v_dpi,
|
||||||
0,
|
0,
|
||||||
(param->use_cropbox == 0),
|
(!(param->use_cropbox)),
|
||||||
false, false,
|
false, false,
|
||||||
nullptr, nullptr, &annot_cb, nullptr);
|
nullptr, nullptr, &annot_cb, nullptr);
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ void HTMLRenderer::process(PDFDoc *doc)
|
|||||||
doc->displayPage(this, i,
|
doc->displayPage(this, i,
|
||||||
text_zoom_factor() * DEFAULT_DPI, text_zoom_factor() * DEFAULT_DPI,
|
text_zoom_factor() * DEFAULT_DPI, text_zoom_factor() * DEFAULT_DPI,
|
||||||
0,
|
0,
|
||||||
(param->use_cropbox == 0),
|
(!(param->use_cropbox)),
|
||||||
false, false,
|
false, false,
|
||||||
nullptr, nullptr, nullptr, nullptr);
|
nullptr, nullptr, nullptr, nullptr);
|
||||||
|
|
||||||
|
@ -346,7 +346,7 @@ void HTMLRenderer::check_state_change(GfxState * state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// fill color
|
// fill color
|
||||||
if(all_changed || fill_color_changed)
|
if((!(param->fallback)) && (all_changed || fill_color_changed))
|
||||||
{
|
{
|
||||||
// * PDF Spec. Table 106 – Text rendering modes
|
// * PDF Spec. Table 106 – Text rendering modes
|
||||||
static const char FILL[8] = { true, false, true, false, true, false, true, false };
|
static const char FILL[8] = { true, false, true, false, true, false, true, false };
|
||||||
@ -369,7 +369,7 @@ void HTMLRenderer::check_state_change(GfxState * state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// stroke color
|
// stroke color
|
||||||
if(all_changed || stroke_color_changed)
|
if((!(param->fallback)) && (all_changed || stroke_color_changed))
|
||||||
{
|
{
|
||||||
// * PDF Spec. Table 106 – Text rendering modes
|
// * PDF Spec. Table 106 – Text rendering modes
|
||||||
static const char STROKE[8] = { false, true, true, false, false, true, true, false };
|
static const char STROKE[8] = { false, true, true, false, false, true, true, false };
|
||||||
|
@ -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 fallback;
|
||||||
|
|
||||||
// fonts
|
// fonts
|
||||||
int embed_base_font;
|
int embed_base_font;
|
||||||
|
@ -75,6 +75,7 @@ void parse_options (int argc, char **argv)
|
|||||||
.add("outline-filename", ¶m.outline_filename, "", "filename of the generated outline file")
|
.add("outline-filename", ¶m.outline_filename, "", "filename of the generated outline file")
|
||||||
.add("process-nontext", ¶m.process_nontext, 1, "render graphics in addition to text")
|
.add("process-nontext", ¶m.process_nontext, 1, "render graphics in addition to text")
|
||||||
.add("process-outline", ¶m.process_outline, 1, "show outline in HTML")
|
.add("process-outline", ¶m.process_outline, 1, "show outline in HTML")
|
||||||
|
.add("fallback", ¶m.fallback, 0, "output in fallback mode")
|
||||||
|
|
||||||
// fonts
|
// fonts
|
||||||
.add("embed-base-font", ¶m.embed_base_font, 0, "embed local match for standard 14 fonts")
|
.add("embed-base-font", ¶m.embed_base_font, 0, "embed local match for standard 14 fonts")
|
||||||
|
Loading…
Reference in New Issue
Block a user