diff --git a/DjVuFile/DjVuFileImplementation.cpp b/DjVuFile/DjVuFileImplementation.cpp index 6df752e6ae..5d4991a471 100644 --- a/DjVuFile/DjVuFileImplementation.cpp +++ b/DjVuFile/DjVuFileImplementation.cpp @@ -275,14 +275,8 @@ BYTE* CDjVuFileImplementation::GetInfo() sRes += "x"; version = std::to_string(nH); sRes += version.substr(0, version.length() - 4); - sRes += "\","; - - sRes += "\"NumberOfPages\":"; + sRes += "\",\"NumberOfPages\":"; sRes += std::to_string(GetPagesCount()); - sRes += ","; - - if (sRes[sRes.size() - 1] == ',') - sRes.pop_back(); sRes += "}"; oRes.WriteString((BYTE*)sRes.c_str(), sRes.length()); diff --git a/PdfReader/PdfReader.cpp b/PdfReader/PdfReader.cpp index 22fb2b6155..b8db66de53 100644 --- a/PdfReader/PdfReader.cpp +++ b/PdfReader/PdfReader.cpp @@ -489,42 +489,30 @@ return 0; DICT_LOOKUP_DATE(info, obj1, "CreationDate"); DICT_LOOKUP_DATE(info, obj1, "ModDate"); - - std::string version = std::to_string(GetVersion()); - sRes += "\"Version\":"; - sRes += version.substr(0, version.length() - 5); - sRes += ","; - - double nW = 0; - double nH = 0; - double nDpi = 0; - GetPageInfo(0, &nW, &nH, &nDpi, &nDpi); - sRes += "\"PageSize\":\""; - version = std::to_string(nW); - sRes += version.substr(0, version.length() - 4); - sRes += "x"; - version = std::to_string(nH); - sRes += version.substr(0, version.length() - 4); - sRes += "\","; - - sRes += "\"NumberOfPages\":"; - sRes += std::to_string(GetPagesCount()); - sRes += ","; - - sRes += "\"FastWebView\":"; - sRes += m_pInternal->m_pPDFDocument->isLinearized() ? "true" : "false"; - sRes += ","; - - sRes += "\"Tagged\":"; - sRes += m_pInternal->m_pPDFDocument->getStructTreeRoot()->isDict() ? "true" : "false"; - sRes += ","; } info.free(); obj1.free(); - if (sRes[sRes.size() - 1] == ',') - sRes.pop_back(); + std::string version = std::to_string(GetVersion()); + sRes += "\"Version\":"; + sRes += version.substr(0, version.length() - 5); + double nW = 0; + double nH = 0; + double nDpi = 0; + GetPageInfo(0, &nW, &nH, &nDpi, &nDpi); + sRes += ",\"PageSize\":\""; + version = std::to_string(nW); + sRes += version.substr(0, version.length() - 4); + sRes += "x"; + version = std::to_string(nH); + sRes += version.substr(0, version.length() - 4); + sRes += "\",\"NumberOfPages\":"; + sRes += std::to_string(GetPagesCount()); + sRes += ",\"FastWebView\":"; + sRes += m_pInternal->m_pPDFDocument->isLinearized() ? "true" : "false"; + sRes += ",\"Tagged\":"; + sRes += m_pInternal->m_pPDFDocument->getStructTreeRoot()->isDict() ? "true" : "false"; sRes += "}"; NSWasm::CData oRes; diff --git a/XpsFile/XpsLib/Document.cpp b/XpsFile/XpsLib/Document.cpp index eadee4abb3..481129f336 100644 --- a/XpsFile/XpsLib/Document.cpp +++ b/XpsFile/XpsLib/Document.cpp @@ -366,6 +366,7 @@ namespace XPS if (wsAttr.find(L"core-properties") != std::wstring::npos) { ReadAttribute(oReader, L"Target", wsCoreFile); + break; } } } @@ -404,14 +405,8 @@ namespace XPS sRes += std::to_string(nW); sRes += "x"; sRes += std::to_string(nH); - sRes += "\","; - - sRes += "\"NumberOfPages\":"; + sRes += "\",\"NumberOfPages\":"; sRes += std::to_string(GetPageCount()); - sRes += ","; - - if (sRes[sRes.size() - 1] == ',') - sRes.pop_back(); sRes += "}"; oRes.WriteString((BYTE*)sRes.c_str(), sRes.length());