mirror of
https://github.com/pdf2htmlEX/pdf2htmlEX.git
synced 2024-12-22 13:00:08 +00:00
cleanup a bit, output css only once
This commit is contained in:
parent
5223541c1f
commit
f8404691ed
@ -170,7 +170,8 @@ protected:
|
||||
void process_outline_items(GooList * items);
|
||||
|
||||
void process_form(std::ostream & out);
|
||||
|
||||
void dump_form_css(std::ostream & out);
|
||||
|
||||
void set_stream_flags (std::ostream & out);
|
||||
|
||||
void dump_css(void);
|
||||
|
@ -24,7 +24,6 @@ void HTMLRenderer::process_form(ostream & out)
|
||||
{
|
||||
FormPageWidgets * widgets = cur_catalog->getPage(pageNum)->getFormWidgets();
|
||||
int num = widgets->getNumWidgets();
|
||||
std::ostringstream derp;
|
||||
|
||||
for(int i = 0; i < num; i++)
|
||||
{
|
||||
@ -61,25 +60,14 @@ void HTMLRenderer::process_form(ostream & out)
|
||||
<< " style=\"opacity:0.0; position: absolute; left: " << std::to_string(x1) <<
|
||||
"px; bottom: " << std::to_string(y1) << "px;" <<
|
||||
"width: " << std::to_string(width) << "px; height: " << std::to_string(height) <<
|
||||
"px; font-size: 20px; \" class=\"checkbox-" <<
|
||||
"px; font-size: 20px; \" class=\"checkbox checkbox-" <<
|
||||
std::to_string(pageNum) << "\">X</div>" << endl;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//output, at the end, the necessary css
|
||||
//output, at the end, the necessary js
|
||||
if(num > 0) {
|
||||
//this is usable by the whole document and as such should be in dump_css
|
||||
out << "<style>" <<
|
||||
".text_input {" <<
|
||||
"border: none; " <<
|
||||
"background-color: rgba(255, 255, 255, 0.0);" <<
|
||||
"}" << endl <<
|
||||
".checkbox-" << std::to_string(pageNum) << ":hover {" <<
|
||||
"cursor: pointer;" <<
|
||||
"}" <<
|
||||
"</style>" << endl;
|
||||
|
||||
//this is currently page specific
|
||||
out << "<script type=\"text/javascript\">" << endl <<
|
||||
"var checkboxes = document.getElementsByClassName(\"checkbox-" <<
|
||||
@ -96,8 +84,18 @@ void HTMLRenderer::process_form(ostream & out)
|
||||
"});" << endl <<
|
||||
"}" << endl <<
|
||||
"</script>" << endl;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void HTMLRenderer::dump_form_css(ostream & out)
|
||||
{
|
||||
out << ".text_input {" <<
|
||||
"border: none; " <<
|
||||
"background-color: rgba(255, 255, 255, 0.0);" <<
|
||||
"}" << endl <<
|
||||
".checkbox:hover {" <<
|
||||
"cursor: pointer;" <<
|
||||
"}" << endl;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -395,6 +395,12 @@ void HTMLRenderer::pre_process(PDFDoc * doc)
|
||||
void HTMLRenderer::post_process(void)
|
||||
{
|
||||
dump_css();
|
||||
|
||||
if (param.include_forms)
|
||||
{
|
||||
dump_form_css(f_css.fs);
|
||||
}
|
||||
|
||||
// close files if they opened
|
||||
// it's better to brace single liner LLVM complains
|
||||
if (param.process_outline)
|
||||
|
Loading…
Reference in New Issue
Block a user