1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-10-05 19:41:40 +00:00

Merge pull request #96 from iapain/process-outline-disable-error

process_outline 0 was trying to write manifest which did not exists.
This commit is contained in:
Lu Wang 2013-02-22 01:27:40 -08:00
commit d3b935d1b3

View File

@ -348,8 +348,12 @@ void HTMLRenderer::pre_process(PDFDoc * doc)
void HTMLRenderer::post_process(void) void HTMLRenderer::post_process(void)
{ {
dump_css(); dump_css();
// close files // close files if they opened
// it's better to brace single liner LLVM complains
if (param->process_outline)
{
f_outline.fs.close(); f_outline.fs.close();
}
f_pages.fs.close(); f_pages.fs.close();
f_css.fs.close(); f_css.fs.close();
@ -406,18 +410,21 @@ void HTMLRenderer::post_process(void)
embed_file(output, f_css.path, ".css", false); embed_file(output, f_css.path, ".css", false);
} }
else if (line == "$outline") else if (line == "$outline")
{
if (param->process_outline)
{ {
ifstream fin(f_outline.path, ifstream::binary); ifstream fin(f_outline.path, ifstream::binary);
if(!fin) if(!fin)
throw "Cannot open read the pages"; throw "Cannot open outline for reading";
output << fin.rdbuf(); output << fin.rdbuf();
output.clear(); // output will set fail big if fin is empty output.clear(); // output will set fail big if fin is empty
} }
}
else if (line == "$pages") else if (line == "$pages")
{ {
ifstream fin(f_pages.path, ifstream::binary); ifstream fin(f_pages.path, ifstream::binary);
if(!fin) if(!fin)
throw "Cannot open read the pages"; throw "Cannot open pages for reading";
output << fin.rdbuf(); output << fin.rdbuf();
output.clear(); // output will set fail big if fin is empty output.clear(); // output will set fail big if fin is empty
} }