diff --git a/utils/HtmlOutputDev.cc b/utils/HtmlOutputDev.cc index dbf677f..22acbd7 100644 --- a/utils/HtmlOutputDev.cc +++ b/utils/HtmlOutputDev.cc @@ -27,6 +27,7 @@ // Copyright (C) 2009 Reece Dunn // Copyright (C) 2010 Adrian Johnson // Copyright (C) 2010 Hib Eris +// Copyright (C) 2010 Raphael Monrouzeau // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -641,6 +642,16 @@ void HtmlPage::dumpAsXML(FILE* f,int page){ delete fontCSStyle; } + // Loop over the list of image names on this page + int listlen=HtmlOutputDev::imgList->getLength(); + for (int i = 0; i < listlen; i++) { + GooString *fName= (GooString *)HtmlOutputDev::imgList->del(0); + fprintf(f,"%s\n",fName->getCString()); + delete fName; + } + HtmlOutputDev::imgNum=1; + + // Loop over the preprocessed text output commands on this page GooString *str, *str1 = NULL; for(HtmlString *tmp=yxStrings;tmp;tmp=tmp->yxNext){ if (tmp->htext){ @@ -759,26 +770,33 @@ void HtmlPage::dump(FILE *f, int pageNum) } else { - fprintf(f,"",pageNum); - // Loop over the list of image names on this page - int listlen=HtmlOutputDev::imgList->getLength(); - for (int i = 0; i < listlen; i++) { - GooString *fName= (GooString *)HtmlOutputDev::imgList->del(0); - fprintf(f,"
\n",fName->getCString()); - delete fName; + if (xml) + { + dumpAsXML(f, pageNum); } - HtmlOutputDev::imgNum=1; - - GooString* str; - for(HtmlString *tmp=yxStrings;tmp;tmp=tmp->yxNext){ - if (tmp->htext){ - str=new GooString(tmp->htext); - fputs(str->getCString(),f); - delete str; - fputs("
\n",f); + else + { + fprintf(f,"",pageNum); + // Loop over the list of image names on this page + int listlen=HtmlOutputDev::imgList->getLength(); + for (int i = 0; i < listlen; i++) { + GooString *fName= (GooString *)HtmlOutputDev::imgList->del(0); + fprintf(f,"
\n",fName->getCString()); + delete fName; + } + HtmlOutputDev::imgNum=1; + + GooString* str; + for(HtmlString *tmp=yxStrings;tmp;tmp=tmp->yxNext){ + if (tmp->htext){ + str=new GooString(tmp->htext); + fputs(str->getCString(),f); + delete str; + fputs("
\n",f); + } } + fputs("
\n",f); } - fputs("
\n",f); } } diff --git a/utils/pdf2xml.dtd b/utils/pdf2xml.dtd index 1afa4fe..2a5ed22 100644 --- a/utils/pdf2xml.dtd +++ b/utils/pdf2xml.dtd @@ -26,3 +26,4 @@ > + diff --git a/utils/pdftohtml.cc b/utils/pdftohtml.cc index 3c74c6e..aea28ce 100644 --- a/utils/pdftohtml.cc +++ b/utils/pdftohtml.cc @@ -256,7 +256,7 @@ int main(int argc, char *argv[]) { if (complexMode) { //noframes=gFalse; stout=gFalse; - } + } if (stout) { noframes=gTrue; @@ -264,8 +264,10 @@ int main(int argc, char *argv[]) { } if (xml) - { - complexMode = gTrue; + { + // complexMode is not anymore activated by default in xml + // output mode. + //complexMode = gTrue; noframes = gTrue; noMerge = gTrue; }