diff --git a/Pdf4QtLib/sources/pdfcms.cpp b/Pdf4QtLib/sources/pdfcms.cpp index 13e2440..109916c 100644 --- a/Pdf4QtLib/sources/pdfcms.cpp +++ b/Pdf4QtLib/sources/pdfcms.cpp @@ -29,6 +29,14 @@ #include #pragma warning(pop) + +#ifdef Q_OS_WIN +#define NOMINMAX +#include +#include +#pragma comment(lib, "Mscms") +#endif + #include namespace pdf @@ -1723,11 +1731,19 @@ PDFColorProfileIdentifiers PDFCMSManager::getExternalProfilesImpl() const PDFColorProfileIdentifiers result; QStringList directories(m_settings.profileDirectory); - QDir applicationDirectory(QApplication::applicationDirPath()); - if (applicationDirectory.cd("colorprofiles")) + +#ifdef Q_OS_WIN + std::array buffer = { }; + DWORD bufferSize = DWORD(buffer.size() * sizeof(WCHAR)); + if (GetColorDirectoryW(NULL, buffer.data(), &bufferSize)) { - directories << applicationDirectory.absolutePath(); + const DWORD charactersWithNull = bufferSize / sizeof(WCHAR); + const DWORD charactersWithoutNull = bufferSize > 0 ? charactersWithNull - 1 : 0; + + QString directory = QString::fromWCharArray(buffer.data(), int(charactersWithoutNull)); + directories << QDir::fromNativeSeparators(directory); } +#endif for (const QString& directory : directories) { diff --git a/Pdf4QtLib/sources/pdfdocumentmanipulator.cpp b/Pdf4QtLib/sources/pdfdocumentmanipulator.cpp index ae4cc3e..5dd2fff 100644 --- a/Pdf4QtLib/sources/pdfdocumentmanipulator.cpp +++ b/Pdf4QtLib/sources/pdfdocumentmanipulator.cpp @@ -79,8 +79,22 @@ PDFOperationResult PDFDocumentManipulator::assemble(const AssembledPages& pages) // manipulating a single document). if (!m_flags.testFlag(SingleDocument)) { + PDFInteger lastDocumentIndex = pages.front().documentIndex; + std::vector documentPartPageCounts = { 0 }; + + for (const AssembledPage& page : pages) + { + if (page.documentIndex == lastDocumentIndex) + { + ++documentPartPageCounts.back(); + } + else + { + documentPartPageCounts.push_back(1); + lastDocumentIndex = page.documentIndex; + } + } - std::vector documentPartPageCounts; documentBuilder.createDocumentParts(documentPartPageCounts); } diff --git a/Pdf4QtViewer/pdfprogramcontroller.cpp b/Pdf4QtViewer/pdfprogramcontroller.cpp index 6564487..4375d8f 100644 --- a/Pdf4QtViewer/pdfprogramcontroller.cpp +++ b/Pdf4QtViewer/pdfprogramcontroller.cpp @@ -2107,7 +2107,6 @@ void PDFProgramController::onActionDeveloperCreateInstaller() // CoreLib package addStartMenuShortcut("pdf4qt_framework", "maintenancetool", tr("PDF4QT Maintenance Tool")); addComponentMeta("pdf4qt_framework", tr("Framework (Core libraries)"), tr("Framework libraries and other data files required to run all other programs."), pdf::PDF_LIBRARY_VERSION, "pdf4qt_framework", true, true, true); - addDirectoryContent("pdf4qt_framework", "colorprofiles"); addDirectoryContent("pdf4qt_framework", "iconengines"); addDirectoryContent("pdf4qt_framework", "imageformats"); addDirectoryContent("pdf4qt_framework", "platforms");