From d743821ec3b71e00af5dc5541d4e7bf5b003c55e Mon Sep 17 00:00:00 2001 From: Akira Kakuto Date: Sun, 24 Apr 2022 03:42:26 +0000 Subject: xpdf 4.04 git-svn-id: svn://tug.org/texlive/trunk@63119 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/libs/xpdf/ChangeLog | 5 + Build/source/libs/xpdf/TLpatches/ChangeLog | 4 + Build/source/libs/xpdf/TLpatches/TL-Changes | 2 +- Build/source/libs/xpdf/TLpatches/patch-bunched | 196 ++-- Build/source/libs/xpdf/configure | 20 +- Build/source/libs/xpdf/version.ac | 2 +- Build/source/libs/xpdf/xpdf-src/ANNOUNCE | 4 +- Build/source/libs/xpdf/xpdf-src/CHANGES | 70 ++ Build/source/libs/xpdf/xpdf-src/CMakeLists.txt | 8 +- Build/source/libs/xpdf/xpdf-src/INSTALL | 8 +- Build/source/libs/xpdf/xpdf-src/README | 7 +- Build/source/libs/xpdf/xpdf-src/cmake-config.txt | 97 +- Build/source/libs/xpdf/xpdf-src/doc/pdfdetach.1 | 13 +- Build/source/libs/xpdf/xpdf-src/doc/pdfdetach.cat | 12 +- Build/source/libs/xpdf/xpdf-src/doc/pdffonts.1 | 13 +- Build/source/libs/xpdf/xpdf-src/doc/pdffonts.cat | 12 +- Build/source/libs/xpdf/xpdf-src/doc/pdfimages.1 | 17 +- Build/source/libs/xpdf/xpdf-src/doc/pdfimages.cat | 18 +- Build/source/libs/xpdf/xpdf-src/doc/pdfinfo.1 | 12 +- Build/source/libs/xpdf/xpdf-src/doc/pdfinfo.cat | 12 +- Build/source/libs/xpdf/xpdf-src/doc/pdftohtml.1 | 41 +- Build/source/libs/xpdf/xpdf-src/doc/pdftohtml.cat | 53 +- Build/source/libs/xpdf/xpdf-src/doc/pdftopng.1 | 17 +- Build/source/libs/xpdf/xpdf-src/doc/pdftopng.cat | 18 +- Build/source/libs/xpdf/xpdf-src/doc/pdftoppm.1 | 17 +- Build/source/libs/xpdf/xpdf-src/doc/pdftoppm.cat | 18 +- Build/source/libs/xpdf/xpdf-src/doc/pdftops.1 | 16 +- Build/source/libs/xpdf/xpdf-src/doc/pdftops.cat | 18 +- Build/source/libs/xpdf/xpdf-src/doc/pdftotext.1 | 20 +- Build/source/libs/xpdf/xpdf-src/doc/pdftotext.cat | 24 +- Build/source/libs/xpdf/xpdf-src/doc/xpdf.1 | 52 +- Build/source/libs/xpdf/xpdf-src/doc/xpdf.cat | 45 +- Build/source/libs/xpdf/xpdf-src/doc/xpdfrc.5 | 49 +- Build/source/libs/xpdf/xpdf-src/doc/xpdfrc.cat | 201 ++-- .../source/libs/xpdf/xpdf-src/fofi/CMakeLists.txt | 2 + Build/source/libs/xpdf/xpdf-src/fofi/FoFiType1C.cc | 16 +- Build/source/libs/xpdf/xpdf-src/goo/CMakeLists.txt | 2 + Build/source/libs/xpdf/xpdf-src/goo/gfile.cc | 48 +- Build/source/libs/xpdf/xpdf-src/goo/gfile.h | 17 + .../libs/xpdf/xpdf-src/splash/CMakeLists.txt | 2 + Build/source/libs/xpdf/xpdf-src/splash/Splash.cc | 407 +++++++- Build/source/libs/xpdf/xpdf-src/splash/Splash.h | 11 +- .../libs/xpdf/xpdf-src/splash/SplashState.cc | 74 +- .../source/libs/xpdf/xpdf-src/splash/SplashState.h | 19 +- Build/source/libs/xpdf/xpdf-src/xpdf/AcroForm.cc | 13 +- Build/source/libs/xpdf/xpdf-src/xpdf/Annot.cc | 5 + .../source/libs/xpdf/xpdf-src/xpdf/CMakeLists.txt | 21 +- Build/source/libs/xpdf/xpdf-src/xpdf/Catalog.cc | 2 +- .../libs/xpdf/xpdf-src/xpdf/CharCodeToUnicode.cc | 40 +- .../libs/xpdf/xpdf-src/xpdf/CharCodeToUnicode.h | 5 + Build/source/libs/xpdf/xpdf-src/xpdf/Gfx.cc | 126 ++- Build/source/libs/xpdf/xpdf-src/xpdf/Gfx.h | 1 + Build/source/libs/xpdf/xpdf-src/xpdf/GfxFont.cc | 206 +++- Build/source/libs/xpdf/xpdf-src/xpdf/GfxFont.h | 11 +- Build/source/libs/xpdf/xpdf-src/xpdf/GfxState.cc | 308 ++++-- Build/source/libs/xpdf/xpdf-src/xpdf/GfxState.h | 4 + .../source/libs/xpdf/xpdf-src/xpdf/GlobalParams.cc | 82 +- .../source/libs/xpdf/xpdf-src/xpdf/GlobalParams.h | 14 + Build/source/libs/xpdf/xpdf-src/xpdf/HTMLGen.cc | 622 ++++++++---- Build/source/libs/xpdf/xpdf-src/xpdf/HTMLGen.h | 23 +- .../source/libs/xpdf/xpdf-src/xpdf/JBIG2Stream.cc | 93 +- Build/source/libs/xpdf/xpdf-src/xpdf/JBIG2Stream.h | 2 + Build/source/libs/xpdf/xpdf-src/xpdf/JPXStream.cc | 232 +++-- Build/source/libs/xpdf/xpdf-src/xpdf/JPXStream.h | 5 + Build/source/libs/xpdf/xpdf-src/xpdf/OutputDev.h | 8 +- Build/source/libs/xpdf/xpdf-src/xpdf/PDFCore.cc | 33 +- Build/source/libs/xpdf/xpdf-src/xpdf/PDFDoc.cc | 42 +- Build/source/libs/xpdf/xpdf-src/xpdf/PDFDoc.h | 4 + .../source/libs/xpdf/xpdf-src/xpdf/PSOutputDev.cc | 12 +- Build/source/libs/xpdf/xpdf-src/xpdf/PSOutputDev.h | 3 + Build/source/libs/xpdf/xpdf-src/xpdf/Page.cc | 62 +- Build/source/libs/xpdf/xpdf-src/xpdf/Page.h | 2 +- Build/source/libs/xpdf/xpdf-src/xpdf/Parser.cc | 143 ++- .../libs/xpdf/xpdf-src/xpdf/PreScanOutputDev.cc | 11 +- .../libs/xpdf/xpdf-src/xpdf/PreScanOutputDev.h | 8 +- .../libs/xpdf/xpdf-src/xpdf/SecurityHandler.cc | 19 +- .../libs/xpdf/xpdf-src/xpdf/SplashOutputDev.cc | 151 ++- .../libs/xpdf/xpdf-src/xpdf/SplashOutputDev.h | 8 +- Build/source/libs/xpdf/xpdf-src/xpdf/Stream.cc | 180 ++-- Build/source/libs/xpdf/xpdf-src/xpdf/Stream.h | 15 + .../libs/xpdf/xpdf-src/xpdf/TextOutputDev.cc | 881 +++++++++++++---- .../source/libs/xpdf/xpdf-src/xpdf/TextOutputDev.h | 25 +- Build/source/libs/xpdf/xpdf-src/xpdf/TileMap.cc | 22 +- .../libs/xpdf/xpdf-src/xpdf/UnicodeMapTables.h | 6 +- .../libs/xpdf/xpdf-src/xpdf/UnicodeRemapping.cc | 33 +- .../libs/xpdf/xpdf-src/xpdf/UnicodeRemapping.h | 2 + .../libs/xpdf/xpdf-src/xpdf/UnicodeTypeTable.cc | 1026 ++++++++++++++++++-- .../libs/xpdf/xpdf-src/xpdf/UnicodeTypeTable.h | 8 +- Build/source/libs/xpdf/xpdf-src/xpdf/WebFont.cc | 73 +- Build/source/libs/xpdf/xpdf-src/xpdf/WebFont.h | 11 + Build/source/libs/xpdf/xpdf-src/xpdf/XFAScanner.cc | 6 +- Build/source/libs/xpdf/xpdf-src/xpdf/XRef.cc | 41 +- Build/source/libs/xpdf/xpdf-src/xpdf/XRef.h | 5 + Build/source/libs/xpdf/xpdf-src/xpdf/config.h | 16 +- Build/source/libs/xpdf/xpdf-src/xpdf/pdfdetach.cc | 4 + Build/source/libs/xpdf/xpdf-src/xpdf/pdffonts.cc | 4 + Build/source/libs/xpdf/xpdf-src/xpdf/pdfimages.cc | 10 + Build/source/libs/xpdf/xpdf-src/xpdf/pdfinfo.cc | 4 + Build/source/libs/xpdf/xpdf-src/xpdf/pdftohtml.cc | 88 +- Build/source/libs/xpdf/xpdf-src/xpdf/pdftopng.cc | 28 +- Build/source/libs/xpdf/xpdf-src/xpdf/pdftoppm.cc | 24 +- Build/source/libs/xpdf/xpdf-src/xpdf/pdftops.cc | 13 + Build/source/libs/xpdf/xpdf-src/xpdf/pdftotext.cc | 19 +- .../xpdf/xpdf-src/xpdf/winLongPath.exe.manifest | 15 + 104 files changed, 5030 insertions(+), 1569 deletions(-) create mode 100644 Build/source/libs/xpdf/xpdf-src/xpdf/winLongPath.exe.manifest (limited to 'Build/source/libs/xpdf') diff --git a/Build/source/libs/xpdf/ChangeLog b/Build/source/libs/xpdf/ChangeLog index 981ef4a53cf..ad36056044e 100644 --- a/Build/source/libs/xpdf/ChangeLog +++ b/Build/source/libs/xpdf/ChangeLog @@ -1,3 +1,8 @@ +2022-04-24 Akira Kakuto + + * Import xpdf-4.04. + * version.ac: Adjust. + 2021-05-10 Karl Berry * xpdf-src/xpdf/Error.cc (error): label error messages diff --git a/Build/source/libs/xpdf/TLpatches/ChangeLog b/Build/source/libs/xpdf/TLpatches/ChangeLog index c0fed972499..1b2e8497313 100644 --- a/Build/source/libs/xpdf/TLpatches/ChangeLog +++ b/Build/source/libs/xpdf/TLpatches/ChangeLog @@ -1,3 +1,7 @@ +2022-04-24 Akira Kakuto + + * patch-bunched: Adjust. + 2021-02-01 Akira Kakuto * patch-bunched: Adjust. diff --git a/Build/source/libs/xpdf/TLpatches/TL-Changes b/Build/source/libs/xpdf/TLpatches/TL-Changes index c0b5e4aeb54..aab26569f98 100644 --- a/Build/source/libs/xpdf/TLpatches/TL-Changes +++ b/Build/source/libs/xpdf/TLpatches/TL-Changes @@ -1,4 +1,4 @@ -Changes applied to the xpdf-4.03/ tree as obtained from: +Changes applied to the xpdf-4.04/ tree as obtained from: http://www.xpdfreader.com/download.html Removed: diff --git a/Build/source/libs/xpdf/TLpatches/patch-bunched b/Build/source/libs/xpdf/TLpatches/patch-bunched index 07b3f05a983..bb36d99d8f7 100644 --- a/Build/source/libs/xpdf/TLpatches/patch-bunched +++ b/Build/source/libs/xpdf/TLpatches/patch-bunched @@ -1,6 +1,6 @@ -diff -ur xpdf-4.03/goo/gfile.cc xpdf-src/goo/gfile.cc ---- xpdf-4.03/goo/gfile.cc Thu Jan 28 07:23:51 2021 -+++ xpdf-src/goo/gfile.cc Mon Feb 01 13:13:50 2021 +diff -ur xpdf-4.04/goo/gfile.cc xpdf-src/goo/gfile.cc +--- xpdf-4.04/goo/gfile.cc Tue Apr 19 06:11:23 2022 ++++ xpdf-src/goo/gfile.cc Sun Apr 24 10:45:35 2022 @@ -7,6 +7,9 @@ // Copyright 1996-2003 Glyph & Cog, LLC // @@ -11,19 +11,7 @@ diff -ur xpdf-4.03/goo/gfile.cc xpdf-src/goo/gfile.cc #include -@@ -56,7 +59,11 @@ - char *s; - GString *ret; - -+#ifdef _WIN32 -+ if ((s = getenv("USERPROFILE"))) -+#else - if ((s = getenv("HOME"))) -+#endif - ret = new GString(s); - else - ret = new GString("."); -@@ -405,6 +412,7 @@ +@@ -429,6 +432,7 @@ #endif } @@ -31,7 +19,7 @@ diff -ur xpdf-4.03/goo/gfile.cc xpdf-src/goo/gfile.cc GBool openTempFile(GString **name, FILE **f, const char *mode, const char *ext) { #if defined(_WIN32) -@@ -519,10 +527,11 @@ +@@ -543,6 +547,7 @@ return gTrue; #endif } @@ -39,29 +27,24 @@ diff -ur xpdf-4.03/goo/gfile.cc xpdf-src/goo/gfile.cc GBool createDir(char *path, int mode) { #ifdef _WIN32 -- return !mkdir(path); -+ return !_mkdir(path); - #else - return !mkdir(path, mode); - #endif -@@ -602,6 +611,8 @@ +@@ -626,6 +631,8 @@ FILE *openFile(const char *path, const char *mode) { #if defined(_WIN32) + return fopen(path, mode); +#if 0 - wchar_t wPath[_MAX_PATH + 1]; + wchar_t wPath[winMaxLongPath + 1]; wchar_t wMode[8]; int i; -@@ -613,6 +624,7 @@ +@@ -637,6 +644,7 @@ wMode[i] = (wchar_t)0; - readWindowsShortcut(wPath, _MAX_PATH + 1); + readWindowsShortcut(wPath, winMaxLongPath + 1); return _wfopen(wPath, wMode); +#endif /* 0 */ #elif defined(VMS) return fopen(path, mode, "ctx=stm"); #else -@@ -620,6 +632,7 @@ +@@ -644,6 +652,7 @@ #endif } @@ -69,7 +52,7 @@ diff -ur xpdf-4.03/goo/gfile.cc xpdf-src/goo/gfile.cc #ifdef _WIN32 void readWindowsShortcut(wchar_t *wPath, size_t wPathSize) { size_t n = wcslen(wPath); -@@ -665,11 +678,11 @@ +@@ -689,11 +698,15 @@ wcscpy(wPath, target); } #endif @@ -77,13 +60,15 @@ diff -ur xpdf-4.03/goo/gfile.cc xpdf-src/goo/gfile.cc int makeDir(const char *path, int mode) { #ifdef _WIN32 -- wchar_t wPath[_MAX_PATH + 1]; -- return _wmkdir(fileNameToUCS2(path, wPath, sizeof(wPath) / sizeof(wchar_t))); ++ /* + wchar_t wPath[winMaxLongPath + 1]; + return _wmkdir(fileNameToUCS2(path, wPath, winMaxLongPath + 1)); ++ */ + return _mkdir(path); #else return mkdir(path, (mode_t)mode); #endif -@@ -728,6 +741,7 @@ +@@ -752,6 +765,7 @@ #endif } @@ -91,28 +76,29 @@ diff -ur xpdf-4.03/goo/gfile.cc xpdf-src/goo/gfile.cc void fixCommandLine(int *argc, char **argv[]) { #ifdef _WIN32 int argcw; -@@ -753,3 +767,4 @@ +@@ -777,3 +791,4 @@ LocalFree(argvw); #endif } +#endif /* !PDF_PARSER_ONLY */ -diff -ur xpdf-4.03/goo/gfile.h xpdf-src/goo/gfile.h ---- xpdf-4.03/goo/gfile.h Thu Jan 28 07:23:51 2021 -+++ xpdf-src/goo/gfile.h Mon Feb 01 13:14:50 2021 -@@ -91,12 +91,6 @@ +diff -ur xpdf-4.04/goo/gfile.h xpdf-src/goo/gfile.h +--- xpdf-4.04/goo/gfile.h Tue Apr 19 06:11:23 2022 ++++ xpdf-src/goo/gfile.h Sun Apr 24 10:48:58 2022 +@@ -100,11 +100,13 @@ // UCS-2 and calls _wfopen(). On other OSes, this simply calls fopen(). extern FILE *openFile(const char *path, const char *mode); --#ifdef _WIN32 --// If [wPath] is a Windows shortcut (.lnk file), read the target path --// and store it back into [wPath]. --extern void readWindowsShortcut(wchar_t *wPath, size_t wPathSize); --#endif -- ++#if 0 + #ifdef _WIN32 + // If [wPath] is a Windows shortcut (.lnk file), read the target path + // and store it back into [wPath]. + extern void readWindowsShortcut(wchar_t *wPath, size_t wPathSize); + #endif ++#endif /* 0 */ + // Create a directory. On Windows, this converts the path from UTF-8 // to UCS-2 and calls _wmkdir(), ignoring the mode argument. On other - // OSes, this simply calls mkdir(). -@@ -130,6 +124,8 @@ +@@ -139,6 +141,8 @@ // On Windows, this gets the Unicode command line and converts it to // UTF-8. On other systems, this is a nop. @@ -121,20 +107,30 @@ diff -ur xpdf-4.03/goo/gfile.h xpdf-src/goo/gfile.h +#endif /* !PDF_PARSER_ONLY */ #endif -diff -ur xpdf-4.03/xpdf/GlobalParams.cc xpdf-src/xpdf/GlobalParams.cc ---- xpdf-4.03/xpdf/GlobalParams.cc Thu Jan 28 07:23:51 2021 -+++ xpdf-src/xpdf/GlobalParams.cc Mon Feb 01 12:20:24 2021 -@@ -5,6 +5,9 @@ - // Copyright 2001-2003 Glyph & Cog, LLC - // - //======================================================================== -+// Modified for TeX Live by Peter Breitenlohner -+// See top-level ChangeLog for a list of all modifications -+//======================================================================== - - #include - -@@ -44,8 +47,12 @@ +diff -ur xpdf-4.04/xpdf/Error.cc xpdf-src/xpdf/Error.cc +--- xpdf-4.04/xpdf/Error.cc Tue Apr 19 06:11:23 2022 ++++ xpdf-src/xpdf/Error.cc Sun Apr 24 11:27:58 2022 +@@ -77,11 +77,14 @@ + (*errorCbk)(errorCbkData, category, (int)pos, sanitized->getCString()); + } else { + fflush(stdout); ++ /* Label the error messages for pdftex's use as libxpdf. ++ It would be cleaner to use the callback feature, but seems ++ like too much trouble at this late date. */ + if (pos >= 0) { +- fprintf(stderr, "%s (%d): %s\n", ++ fprintf(stderr, "\nlibxpdf: %s (%d): %s\n", + errorCategoryNames[category], (int)pos, sanitized->getCString()); + } else { +- fprintf(stderr, "%s: %s\n", ++ fprintf(stderr, "\nlibxpdf: %s: %s\n", + errorCategoryNames[category], sanitized->getCString()); + } + fflush(stderr); +diff -ur xpdf-4.04/xpdf/GlobalParams.cc xpdf-src/xpdf/GlobalParams.cc +--- xpdf-4.04/xpdf/GlobalParams.cc Tue Apr 19 06:11:23 2022 ++++ xpdf-src/xpdf/GlobalParams.cc Sun Apr 24 11:07:30 2022 +@@ -44,8 +44,12 @@ #include "GlobalParams.h" #ifdef _WIN32 @@ -149,7 +145,7 @@ diff -ur xpdf-4.03/xpdf/GlobalParams.cc xpdf-src/xpdf/GlobalParams.cc #endif #if MULTITHREADED -@@ -787,6 +794,7 @@ +@@ -794,6 +798,7 @@ f = NULL; fileName = NULL; if (cfgFileName && cfgFileName[0]) { @@ -157,7 +153,7 @@ diff -ur xpdf-4.03/xpdf/GlobalParams.cc xpdf-src/xpdf/GlobalParams.cc fileName = new GString(cfgFileName); if (!(f = fopen(fileName->getCString(), "r"))) { delete fileName; -@@ -819,6 +827,7 @@ +@@ -826,6 +831,7 @@ parseFile(fileName, f); delete fileName; fclose(f); @@ -165,7 +161,7 @@ diff -ur xpdf-4.03/xpdf/GlobalParams.cc xpdf-src/xpdf/GlobalParams.cc } } -@@ -2358,8 +2367,11 @@ +@@ -2378,8 +2384,11 @@ base14->fontNum, displayFontTab[i].obliqueFactor)); } else { @@ -177,9 +173,9 @@ diff -ur xpdf-4.03/xpdf/GlobalParams.cc xpdf-src/xpdf/GlobalParams.cc } } } -diff -ur xpdf-4.03/xpdf/GlobalParams.h xpdf-src/xpdf/GlobalParams.h ---- xpdf-4.03/xpdf/GlobalParams.h Thu Jan 28 07:23:51 2021 -+++ xpdf-src/xpdf/GlobalParams.h Mon Feb 01 12:23:07 2021 +diff -ur xpdf-4.04/xpdf/GlobalParams.h xpdf-src/xpdf/GlobalParams.h +--- xpdf-4.04/xpdf/GlobalParams.h Tue Apr 19 06:11:23 2022 ++++ xpdf-src/xpdf/GlobalParams.h Sun Apr 24 11:08:50 2022 @@ -5,6 +5,9 @@ // Copyright 2001-2003 Glyph & Cog, LLC // @@ -199,9 +195,9 @@ diff -ur xpdf-4.03/xpdf/GlobalParams.h xpdf-src/xpdf/GlobalParams.h ~GlobalParams(); -diff -ur xpdf-4.03/xpdf/PDFDoc.cc xpdf-src/xpdf/PDFDoc.cc ---- xpdf-4.03/xpdf/PDFDoc.cc Thu Jan 28 07:23:51 2021 -+++ xpdf-src/xpdf/PDFDoc.cc Mon Feb 01 13:01:20 2021 +diff -ur xpdf-4.04/xpdf/PDFDoc.cc xpdf-src/xpdf/PDFDoc.cc +--- xpdf-4.04/xpdf/PDFDoc.cc Tue Apr 19 06:11:23 2022 ++++ xpdf-src/xpdf/PDFDoc.cc Sun Apr 24 11:19:50 2022 @@ -114,6 +114,7 @@ ok = setup(ownerPassword, userPassword); } @@ -210,7 +206,7 @@ diff -ur xpdf-4.03/xpdf/PDFDoc.cc xpdf-src/xpdf/PDFDoc.cc #ifdef _WIN32 PDFDoc::PDFDoc(wchar_t *fileNameA, int fileNameLen, GString *ownerPassword, GString *userPassword, PDFCore *coreA) { -@@ -161,23 +162,29 @@ +@@ -161,23 +162,28 @@ ok = setup(ownerPassword, userPassword); } #endif @@ -218,29 +214,29 @@ diff -ur xpdf-4.03/xpdf/PDFDoc.cc xpdf-src/xpdf/PDFDoc.cc PDFDoc::PDFDoc(char *fileNameA, GString *ownerPassword, GString *userPassword, PDFCore *coreA) { -+/* ++#if 0 #ifdef _WIN32 OSVERSIONINFO version; #endif -+*/ ++#endif /* 0 */ Object obj; -+/* ++#if 0 #ifdef _WIN32 Unicode u; int i, j; #endif -+*/ - +- ++#endif /* 0 */ init(coreA); fileName = new GString(fileNameA); #if defined(_WIN32) +#if 0 - wchar_t wPath[MAX_PATH + 1]; + wchar_t wPath[winMaxLongPath + 1]; i = 0; j = 0; -@@ -197,8 +204,11 @@ +@@ -197,8 +203,11 @@ if (version.dwPlatformId == VER_PLATFORM_WIN32_NT) { file = _wfopen(fileNameU, wfopenReadMode); } else { @@ -252,34 +248,34 @@ diff -ur xpdf-4.03/xpdf/PDFDoc.cc xpdf-src/xpdf/PDFDoc.cc #elif defined(VMS) file = fopen(fileName->getCString(), fopenReadMode, "ctx=stm"); #else -@@ -603,6 +613,7 @@ +@@ -608,6 +617,7 @@ GBool ret; // NB: _wfopen is only available in NT -+/* ++#if 0 version.dwOSVersionInfoSize = sizeof(version); GetVersionEx(&version); if (version.dwPlatformId == VER_PLATFORM_WIN32_NT) { -@@ -612,12 +623,15 @@ +@@ -617,12 +627,15 @@ path2w[i] = 0; f = _wfopen(path2w, L"wb"); } else { -+*/ - for (i = 0; i < pathLen && i < _MAX_PATH; ++i) { ++#endif /* 0 */ + for (i = 0; i < pathLen && i < MAX_PATH; ++i) { path2c[i] = (char)path[i]; } path2c[i] = 0; f = fopen(path2c, "wb"); -+/* ++#if 0 } -+*/ ++#endif /* 0 */ if (!f) { return gFalse; } -diff -ur xpdf-4.03/xpdf/Page.cc xpdf-src/xpdf/Page.cc ---- xpdf-4.03/xpdf/Page.cc Thu Jan 28 07:23:51 2021 -+++ xpdf-src/xpdf/Page.cc Mon Feb 01 12:31:27 2021 -@@ -485,9 +485,9 @@ +diff -ur xpdf-4.04/xpdf/Page.cc xpdf-src/xpdf/Page.cc +--- xpdf-4.04/xpdf/Page.cc Tue Apr 19 06:11:23 2022 ++++ xpdf-src/xpdf/Page.cc Sun Apr 24 11:22:49 2022 +@@ -531,9 +531,9 @@ delete links; } @@ -290,16 +286,16 @@ diff -ur xpdf-4.03/xpdf/Page.cc xpdf-src/xpdf/Page.cc GfxState *state; int i; -@@ -504,5 +504,5 @@ +@@ -550,5 +550,5 @@ ctm[i] = state->getCTM()[i]; } delete state; -} #endif +} -diff -ur xpdf-4.03/xpdf/config.h xpdf-src/xpdf/config.h ---- xpdf-4.03/xpdf/config.h Thu Jan 28 07:23:52 2021 -+++ xpdf-src/xpdf/config.h Mon Feb 01 12:34:28 2021 +diff -ur xpdf-4.04/xpdf/config.h xpdf-src/xpdf/config.h +--- xpdf-4.04/xpdf/config.h Tue Apr 19 06:11:23 2022 ++++ xpdf-src/xpdf/config.h Sun Apr 24 11:24:23 2022 @@ -80,11 +80,6 @@ // popen //------------------------------------------------------------------------ @@ -312,23 +308,3 @@ diff -ur xpdf-4.03/xpdf/config.h xpdf-src/xpdf/config.h #if defined(VMS) || defined(VMCMS) || defined(DOS) || defined(OS2) || defined(__EMX__) || defined(_WIN32) || defined(__DJGPP__) #define POPEN_READ_MODE "rb" #else -diff -ur xpdf-4.03/xpdf/Error.cc xpdf-src/xpdf/Error.cc ---- xpdf-4.03/xpdf/Error.cc Thu Jan 28 07:23:52 2021 -+++ xpdf-src/xpdf/Error.cc Mon Feb 01 12:34:28 2021 -@@ -77,11 +77,14 @@ - (*errorCbk)(errorCbkData, category, (int)pos, sanitized->getCString()); - } else { - fflush(stdout); -+ /* Label the error messages for pdftex's use as libxpdf. -+ It would be cleaner to use the callback feature, but seems -+ like too much trouble at this late date. */ - if (pos >= 0) { -- fprintf(stderr, "%s (%d): %s\n", -+ fprintf(stderr, "\nlibxpdf: %s (%d): %s\n", - errorCategoryNames[category], (int)pos, sanitized->getCString()); - } else { -- fprintf(stderr, "%s: %s\n", -+ fprintf(stderr, "\nlibxpdf: %s: %s\n", - errorCategoryNames[category], sanitized->getCString()); - } - fflush(stderr); diff --git a/Build/source/libs/xpdf/configure b/Build/source/libs/xpdf/configure index fe781453b03..2a2d1b60d43 100755 --- a/Build/source/libs/xpdf/configure +++ b/Build/source/libs/xpdf/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.71 for xpdf (TeX Live) 4.03. +# Generated by GNU Autoconf 2.71 for xpdf (TeX Live) 4.04. # # Report bugs to . # @@ -610,8 +610,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='xpdf (TeX Live)' PACKAGE_TARNAME='xpdf--tex-live-' -PACKAGE_VERSION='4.03' -PACKAGE_STRING='xpdf (TeX Live) 4.03' +PACKAGE_VERSION='4.04' +PACKAGE_STRING='xpdf (TeX Live) 4.04' PACKAGE_BUGREPORT='tex-k@tug.org' PACKAGE_URL='' @@ -1324,7 +1324,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures xpdf (TeX Live) 4.03 to adapt to many kinds of systems. +\`configure' configures xpdf (TeX Live) 4.04 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1391,7 +1391,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of xpdf (TeX Live) 4.03:";; + short | recursive ) echo "Configuration of xpdf (TeX Live) 4.04:";; esac cat <<\_ACEOF @@ -1495,7 +1495,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -xpdf (TeX Live) configure 4.03 +xpdf (TeX Live) configure 4.04 generated by GNU Autoconf 2.71 Copyright (C) 2021 Free Software Foundation, Inc. @@ -1752,7 +1752,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by xpdf (TeX Live) $as_me 4.03, which was +It was created by xpdf (TeX Live) $as_me 4.04, which was generated by GNU Autoconf 2.71. Invocation command line was $ $0$ac_configure_args_raw @@ -4511,7 +4511,7 @@ fi # Define the identity of the package. PACKAGE='xpdf--tex-live-' - VERSION='4.03' + VERSION='4.04' # Some tools Automake needs. @@ -7419,7 +7419,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by xpdf (TeX Live) $as_me 4.03, which was +This file was extended by xpdf (TeX Live) $as_me 4.04, which was generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -7491,7 +7491,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ -xpdf (TeX Live) config.status 4.03 +xpdf (TeX Live) config.status 4.04 configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" diff --git a/Build/source/libs/xpdf/version.ac b/Build/source/libs/xpdf/version.ac index 64e2f3e635e..9e02a92b491 100644 --- a/Build/source/libs/xpdf/version.ac +++ b/Build/source/libs/xpdf/version.ac @@ -8,4 +8,4 @@ dnl dnl -------------------------------------------------------- dnl dnl m4-include this file to define the current xpdf version -m4_define([xpdf_version], [4.03]) +m4_define([xpdf_version], [4.04]) diff --git a/Build/source/libs/xpdf/xpdf-src/ANNOUNCE b/Build/source/libs/xpdf/xpdf-src/ANNOUNCE index e070ad95d5b..c20dcaf47ae 100644 --- a/Build/source/libs/xpdf/xpdf-src/ANNOUNCE +++ b/Build/source/libs/xpdf/xpdf-src/ANNOUNCE @@ -1,4 +1,4 @@ -Subject: ANNOUNCE: Xpdf 4.03 - a PDF viewer and related tools +Subject: ANNOUNCE: Xpdf 4.04 - a PDF viewer and related tools Glyph & Cog, LLC is pleased to announce a new version of Xpdf, the open source Portable Document Format (PDF) viewer. The Xpdf project @@ -10,7 +10,7 @@ non-graphical components (pdftops, pdftotext, etc.) run on Linux, Unix, Windows, MacOSX, and pretty much any other system with a decent C++ compiler. -4.03 is primarily a bug fix release. There are some new features: +4.04 is primarily a bug fix release. There are some new features: * XpdfReader improvements: - Implemented selection extension via shift-click, and word/line diff --git a/Build/source/libs/xpdf/xpdf-src/CHANGES b/Build/source/libs/xpdf/xpdf-src/CHANGES index f2dccc095fd..564aff32b4f 100644 --- a/Build/source/libs/xpdf/xpdf-src/CHANGES +++ b/Build/source/libs/xpdf/xpdf-src/CHANGES @@ -2740,3 +2740,73 @@ Check for invalid AcroForm ListBox field top index. [Thanks to Chengbin for the bug report.] Check for invalid mesh shading parameters. [Thanks to Chengbin for the bug report.] + +4.04 (2022-apr-18) +------------------ +When closing a file, save the current page number in ~/.xpdf.pages, + and restore it next time the file is opened. This can be disabled + with "savePageNumbers no" in your xpdfrc file. +Allow the tab list to be reordered, using drag-and-drop. +Added a document information dialog, with metadata and fonts, to xpdf. +Pdftohtml now generates HTML links for URI links anchored on text. +Added the useTrueTypeUnicodeMapping xpdfrc setting. +Added the 'enableXFA' xpdfrc setting back: if set to 'no', xpdf will + not read an XFA form, meaning all form info comes from the AcroForm. +Add support for long paths on Windows 10. +Added the "-formfields" option to pdftohtml. +Added the "-embedbackground" and "-embedfonts" options to pdftohtml. +Added the "-vstretch" option to pdftohtml. +Added the "-verbose" flag to pdfimages, pdftohtml, pdftopng, pdftoppm, + pdftops, and pdftotext. +Added the showAttachmentsPane, showLayersPane, and showOutlinePane + commands. +Added the 'openFile2' command to xpdf. +Added the showMenuBar, hideMenuBar, and toggleMenuBar commands to + xpdf. +Rearrange file names in the tab list to "foo.pdf [/full/path/]", to + improve the usability of the (narrow) tab list. +Added the 'imageMaskAntialias' xpdfrc setting. +Added the '-table' switch to pdftohtml. +Fixed a couple of progression order bugs in the JPEG 2000 decoder. + [Thanks to shellway for the bug reports.] +Fixed a problem with subsampled pixel index computations in the JPEG + 2000 decoder. [Thanks to shellway for the bug report.] +Fixed a couple of memory leaks triggered by fuzzed PDF files. [Thanks + to shellway for the bug report.] +Changed pdftohtml to generate spans with 'class=' instead of 'id=', so + there aren't duplicate ids. Also removed the unused id in the + background img element. +Optimized SplashOutputDev::drawTilingPattern for the case where the + tile is much larger than the area being drawn (i.e., the clipping + bbox). In this case, we can render just the needed portion of the + tile. +Added a missing zero check for precinct size in the JPEG 2000 decoder. + [Thanks to shellway for the bug report.] +Added a missing null check in the XFA form scanner. [Thanks to Taolaw + for the bug report.] +Deal with xref streams that include a free entry with gen=0xffffffff. +Fixed a problematic corner case in looking up XObject resources. + [Thanks to shellway for the bug report.] +The unicodeRemapping config command wasn't correctly handling unsorted + remapping files. +Improved handling of RTL text in the text extractor. +Extended the saveTabState/loadTabState commands to save/restore + display mode, zoom, rotation, and scroll position for each tab. +Added support for Qt6. +Added a missing bounds check on stream DecodeParms arrays. [Thanks to + minipython for the bug report.] +Fixed an integer overflow check in XRef::readXRefTable. [Thanks to + yangshufan for the bug report.] +The builtin Latin1 encoding was mapping 'endash' instead of + 'softhyphen' to 0xad. [Thanks to Jach Fong for the bug report.] +Fixed a bug in PSOutputDev::checkPageSlice() when built without + SPLASH_CMYK. [Thanks to irfanariq for the bug report.] +Added missing array length and type checks in Gfx::doForm(). [Thanks + to shaohua for the bug report.] +Fixed an integer overflow security hole in the JBIG2 decoder. +Substitute Helvetica for undefined fonts and bad font objects. +Added an integer overflow check in JPXStream. (JPXStream issue) + [Thanks to Shin Ando @ Ricera Security for the bug report.] +The DCT (JPEG) decoder was allowing the 'interleaved' flag to be + changed after the first scan of the image. (CVE-2022-24106) [Thanks + to Shin Ando @ Ricera Security for the bug report.] diff --git a/Build/source/libs/xpdf/xpdf-src/CMakeLists.txt b/Build/source/libs/xpdf/xpdf-src/CMakeLists.txt index a99cd253231..90cefe33dac 100644 --- a/Build/source/libs/xpdf/xpdf-src/CMakeLists.txt +++ b/Build/source/libs/xpdf/xpdf-src/CMakeLists.txt @@ -4,11 +4,11 @@ # # CMake script for the Xpdf package. # -# Copyright 2015 Glyph & Cog, LLC +# Copyright 2021 Glyph & Cog, LLC # #======================================================================== -cmake_minimum_required(VERSION 2.8.8) +cmake_minimum_required(VERSION 2.8.12) project(xpdf) @@ -28,8 +28,8 @@ if (NOT PNG_FOUND) message(WARNING "Couldn't find libpng -- will not build pdftopng or pdftohtml.") endif () -if (NOT QT4_FOUND AND NOT Qt5Widgets_FOUND) - message(WARNING "Couldn't find Qt4 or Qt5 -- will not build xpdf.") +if (NOT QT4_FOUND AND NOT Qt5Widgets_FOUND AND NOT Qt6Widgets_FOUND) + message(WARNING "Couldn't find Qt4/5/6 -- will not build xpdf.") endif () if (NOT MULTITHREADED) diff --git a/Build/source/libs/xpdf/xpdf-src/INSTALL b/Build/source/libs/xpdf/xpdf-src/INSTALL index 5a7eb6423f4..57ff61f2156 100644 --- a/Build/source/libs/xpdf/xpdf-src/INSTALL +++ b/Build/source/libs/xpdf/xpdf-src/INSTALL @@ -1,11 +1,11 @@ Xpdf ==== -version 4.03 -2021-jan-28 +version 4.04 +2022-apr-18 The Xpdf software and documentation are -copyright 1996-2021 Glyph & Cog, LLC. +copyright 1996-2022 Glyph & Cog, LLC. Email: xpdf@xpdfreader.com WWW: http://www.xpdfreader.com/ @@ -33,7 +33,7 @@ different systems. - CMake 2.8.8 or newer - FreeType 2.0.5 or newer - - Qt 4.8.x or 5.x (for xpdf only) + - Qt 5.x or 6.x (for xpdf only) - libpng (for pdftoppm and pdftohtml) - zlib (for pdftoppm and pdftohtml) diff --git a/Build/source/libs/xpdf/xpdf-src/README b/Build/source/libs/xpdf/xpdf-src/README index e5a114262f0..026460dd24b 100644 --- a/Build/source/libs/xpdf/xpdf-src/README +++ b/Build/source/libs/xpdf/xpdf-src/README @@ -1,11 +1,11 @@ Xpdf ==== -version 4.03 -2021-jan-28 +version 4.04 +2022-apr-18 The Xpdf software and documentation are -copyright 1996-2021 Glyph & Cog, LLC. +copyright 1996-2022 Glyph & Cog, LLC. Email: xpdf@xpdfreader.com WWW: http://www.xpdfreader.com/ @@ -154,6 +154,7 @@ Xpdf uses the following libraries: * libpng [http://www.libpng.com/pub/png/libpng.html] (used by pdftohtml and pdftopng) * zlib [http://zlib.net/] (used by pdftohtml) +* Qt [https://www.qt.io/] Acknowledgments diff --git a/Build/source/libs/xpdf/xpdf-src/cmake-config.txt b/Build/source/libs/xpdf/xpdf-src/cmake-config.txt index e4b3650fcb3..f9339b9fc81 100644 --- a/Build/source/libs/xpdf/xpdf-src/cmake-config.txt +++ b/Build/source/libs/xpdf/xpdf-src/cmake-config.txt @@ -4,7 +4,7 @@ # # CMake script to do misc cmake config and platform-specific config. # -# Copyright 2015 Glyph & Cog, LLC +# Copyright 2021 Glyph & Cog, LLC # #======================================================================== @@ -25,38 +25,32 @@ include(GNUInstallDirs) enable_language(CXX) -#--- set default C/C++ compiler flags for Unix -# and add a 'Profiling' build mode +#--- add a 'Profiling' build mode if (CMAKE_GENERATOR STREQUAL "Unix Makefiles") - if (CYGWIN) - set(PIC_FLAG "") - elseif (CMAKE_HOST_SYSTEM_NAME MATCHES "AIX") - set(PIC_FLAG "-qPIC") - else () - set(PIC_FLAG "-fPIC") - endif () - set(CMAKE_C_FLAGS_DEBUG "-g -O -Wall ${PIC_FLAG}") - set(CMAKE_CXX_FLAGS_DEBUG "-g -O -Wall ${PIC_FLAG}") - set(CMAKE_EXE_LINKER_FLAGS_DEBUG "-g -O -Wall ${PIC_FLAG}") - set(CMAKE_C_FLAGS_RELEASE "-O3 -Wall ${PIC_FLAG}") - set(CMAKE_CXX_FLAGS_RELEASE "-O3 -Wall ${PIC_FLAG}") - set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-O2 -Wall ${PIC_FLAG}") - set(CMAKE_C_FLAGS_PROFILING "-g -pg -O -Wall ${PIC_FLAG}" - CACHE STRING "C compiler flags for profiling mode") - set(CMAKE_CXX_FLAGS_PROFILING "-g -pg -O -Wall ${PIC_FLAG}" - CACHE STRING "C++ compiler flags for profiling mode") - set(CMAKE_EXE_LINKER_FLAGS_PROFILING "-g -pg -O -Wall ${PIC_FLAG}" - CACHE STRING "linker flags for profiling mode") + set(CMAKE_C_FLAGS_PROFILING "-g -pg -O -Wall" + CACHE STRING "C compiler flags for profiling mode" + FORCE) + set(CMAKE_CXX_FLAGS_PROFILING "-g -pg -O -Wall" + CACHE STRING "C++ compiler flags for profiling mode" + FORCE) + set(CMAKE_EXE_LINKER_FLAGS_PROFILING "-g -pg -O -Wall" + CACHE STRING "linker flags for profiling mode" + FORCE) + set(CMAKE_SHARED_LINKER_FLAGS_PROFILING "-g -pg -O -Wall" + CACHE STRING "shared linker flags for profiling mode" + FORCE) mark_as_advanced( CMAKE_C_FLAGS_PROFILING CMAKE_CXX_FLAGS_PROFILING - CMAKE_EXE_LINKER_FLAGS_PROFILING) + CMAKE_EXE_LINKER_FLAGS_PROFILING + CMAKE_SHARED_LINKER_FLAGS_PROFILING) set(CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING - "Choose build mode - options are: None Debug Release RelWithDebInfo MinSizeRel Profiling") + "Choose build mode - options are: None Debug Release RelWithDebInfo MinSizeRel Profiling" + FORCE) endif () #--- set default C/C++ compiler flags for Windows -if (WIN32) +if (MSVC) option(USE_MT_IN_DEBUG "use /MT instead of /MTd in debug builds" OFF) foreach (var CMAKE_C_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELEASE @@ -108,7 +102,7 @@ option(XPDFRC_DATADIR "directory to use for the DATADIR xpdfrc variable" "") if (XPDFRC_DATADIR) set(XPDFRC_DATADIR_DEFINE "#define XPDFRC_DATADIR \"${XPDFRC_DATADIR}\"") else () - set(XPDFRC_DATADIR_DEFINE "/* #undef SYSTEM_XPDFRC */") + set(XPDFRC_DATADIR_DEFINE "/* #undef XPDFRC_DATADIR */") endif () if (WIN32) option(XPDFWIDGET_PRINTING "include printing support in XpdfWidget" OFF) @@ -211,14 +205,20 @@ find_package(PNG) #--- look for Qt -find_package(Qt5Widgets QUIET) -if (Qt5Widgets_FOUND) - find_package(Qt5Network) - find_package(Qt5PrintSupport) +find_package(Qt6Widgets QUIET) +if (Qt6Widgets_FOUND) + find_package(Qt6Network) + find_package(Qt6PrintSupport) else () - find_package(Qt4 COMPONENTS QtCore QtGui QtNetwork) + find_package(Qt5Widgets QUIET) + if (Qt5Widgets_FOUND) + find_package(Qt5Network) + find_package(Qt5PrintSupport) + else () + find_package(Qt4 COMPONENTS QtCore QtGui QtNetwork) + endif () endif () -if(Qt5Widgets_FOUND) +if (Qt5Widgets_FOUND) message(STATUS "Qt5 found") if (XPDFWIDGET_PRINTING) set(QT_INCLUDES "${Qt5Widgets_INCLUDE_DIRS} ${Qt5Network_INCLUDE_DIRS} ${Qt5PrintSupport_INCLUDE_DIRS}") @@ -245,7 +245,34 @@ if(Qt5Widgets_FOUND) endif () # remove "-fPIE" here because we added "-fPIC" above string(REPLACE "-fPIE" "" QT_CFLAGS "${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}") -elseif(QT4_FOUND) +elseif (Qt6Widgets_FOUND) + message(STATUS "Qt6 found") + if (XPDFWIDGET_PRINTING) + set(QT_INCLUDES "${Qt6Widgets_INCLUDE_DIRS} ${Qt6Network_INCLUDE_DIRS} ${Qt6PrintSupport_INCLUDE_DIRS}") + set(QT_DEFINITIONS "${Qt6Widgets_DEFINITIONS} ${Qt6Network_DEFINITIONS} ${Qt6PrintSupport_DEFINITIONS}") + set(QT_LIBRARIES Qt6::Widgets Qt6::Network Qt6::PrintSupport) + else () + set(QT_INCLUDES "${Qt6Widgets_INCLUDE_DIRS} ${Qt6Network_INCLUDE_DIRS}") + set(QT_DEFINITIONS "${Qt6Widgets_DEFINITIONS} ${Qt6Network_DEFINITIONS}") + set(QT_LIBRARIES Qt6::Widgets Qt6::Network) + endif () + if (XPDFWIDGET_PRINTING) + if (APPLE) + set(EXTRA_QT_LIBRARIES "-framework ApplicationServices") + elseif (UNIX) + find_package(Cups) + if (CUPS_FOUND) + set(EXTRA_QT_LIBRARIES ${CUPS_LIBRARIES}) + else () + set (XPDFWIDGET_PRINTING OFF) + endif () + else () + set(EXTRA_QT_LIBRARIES "") + endif () + endif () + # remove "-fPIE" here because we added "-fPIC" above + string(REPLACE "-fPIE" "" QT_CFLAGS "${Qt6Widgets_EXECUTABLE_COMPILE_FLAGS}") +elseif (QT4_FOUND) message(STATUS "Qt4 found") if (XPDFWIDGET_PRINTING) if (APPLE) @@ -261,9 +288,9 @@ elseif(QT4_FOUND) set(EXTRA_QT_LIBRARIES "") endif () endif () -else() +else () message(STATUS "No Qt library found") -endif() +endif () #--- look for libpaper find_library(PAPER_LIBRARY diff --git a/Build/source/libs/xpdf/xpdf-src/doc/pdfdetach.1 b/Build/source/libs/xpdf/xpdf-src/doc/pdfdetach.1 index 7fd3b8a5231..4d00f3722d6 100644 --- a/Build/source/libs/xpdf/xpdf-src/doc/pdfdetach.1 +++ b/Build/source/libs/xpdf/xpdf-src/doc/pdfdetach.1 @@ -1,8 +1,8 @@ -.\" Copyright 2013-2021 Glyph & Cog, LLC -.TH pdfdetach 1 "28 Jan 2021" +.\" Copyright 2013-2022 Glyph & Cog, LLC +.TH pdfdetach 1 "18 Apr 2022" .SH NAME pdfdetach \- Portable Document Format (PDF) document embedded file -extractor (version 4.03) +extractor (version 4.04) .SH SYNOPSIS .B pdfdetach [options] @@ -14,9 +14,8 @@ Document Format (PDF) file. .SH CONFIGURATION FILE Pdfdetach reads a configuration file at startup. It first tries to find the user's private config file, ~/.xpdfrc. If that doesn't -exist, it looks for a system-wide config file, typically -/usr/local/etc/xpdfrc (but this location can be changed when pdfinfo -is built). See the +exist, it looks for a system-wide config file, typically /etc/xpdfrc +(but this location can be changed when pdfinfo is built). See the .BR xpdfrc (5) man page for details. .SH OPTIONS @@ -90,7 +89,7 @@ Error related to PDF permissions. 99 Other error. .SH AUTHOR -The pdfinfo software and documentation are copyright 1996-2021 Glyph & +The pdfinfo software and documentation are copyright 1996-2022 Glyph & Cog, LLC. .SH "SEE ALSO" .BR xpdf (1), diff --git a/Build/source/libs/xpdf/xpdf-src/doc/pdfdetach.cat b/Build/source/libs/xpdf/xpdf-src/doc/pdfdetach.cat index 000eb66e5ae..220bb752467 100644 --- a/Build/source/libs/xpdf/xpdf-src/doc/pdfdetach.cat +++ b/Build/source/libs/xpdf/xpdf-src/doc/pdfdetach.cat @@ -4,7 +4,7 @@ pdfdetach(1) General Commands Manual pdfdetach(1) NAME pdfdetach - Portable Document Format (PDF) document embedded file - extractor (version 4.03) + extractor (version 4.04) SYNOPSIS pdfdetach [options] [PDF-file] @@ -16,9 +16,9 @@ DESCRIPTION CONFIGURATION FILE Pdfdetach reads a configuration file at startup. It first tries to find the user's private config file, ~/.xpdfrc. If that doesn't exist, - it looks for a system-wide config file, typically /usr/local/etc/xpdfrc - (but this location can be changed when pdfinfo is built). See the - xpdfrc(5) man page for details. + it looks for a system-wide config file, typically /etc/xpdfrc (but this + location can be changed when pdfinfo is built). See the xpdfrc(5) man + page for details. OPTIONS Some of the following options can be set with configuration file com- @@ -79,7 +79,7 @@ EXIT CODES 99 Other error. AUTHOR - The pdfinfo software and documentation are copyright 1996-2021 Glyph & + The pdfinfo software and documentation are copyright 1996-2022 Glyph & Cog, LLC. SEE ALSO @@ -89,4 +89,4 @@ SEE ALSO - 28 Jan 2021 pdfdetach(1) + 18 Apr 2022 pdfdetach(1) diff --git a/Build/source/libs/xpdf/xpdf-src/doc/pdffonts.1 b/Build/source/libs/xpdf/xpdf-src/doc/pdffonts.1 index 0192bd3247e..6ee0226e677 100644 --- a/Build/source/libs/xpdf/xpdf-src/doc/pdffonts.1 +++ b/Build/source/libs/xpdf/xpdf-src/doc/pdffonts.1 @@ -1,8 +1,8 @@ -.\" Copyright 1999-2021 Glyph & Cog, LLC -.TH pdffonts 1 "28 Jan 2021" +.\" Copyright 1999-2022 Glyph & Cog, LLC +.TH pdffonts 1 "18 Apr 2022" .SH NAME pdffonts \- Portable Document Format (PDF) font analyzer (version -4.03) +4.04) .SH SYNOPSIS .B pdffonts [options] @@ -84,9 +84,8 @@ CID TrueType (OT) -- OpenType with CID TrueType data .SH CONFIGURATION FILE Pdffonts reads a configuration file at startup. It first tries to find the user's private config file, ~/.xpdfrc. If that doesn't -exist, it looks for a system-wide config file, typically -/usr/local/etc/xpdfrc (but this location can be changed when pdffonts -is built). See the +exist, it looks for a system-wide config file, typically /etc/xpdfrc +(but this location can be changed when pdffonts is built). See the .BR xpdfrc (5) man page for details. .SH OPTIONS @@ -147,7 +146,7 @@ Error related to PDF permissions. 99 Other error. .SH AUTHOR -The pdffonts software and documentation are copyright 1996-2021 Glyph +The pdffonts software and documentation are copyright 1996-2022 Glyph & Cog, LLC. .SH "SEE ALSO" .BR xpdf (1), diff --git a/Build/source/libs/xpdf/xpdf-src/doc/pdffonts.cat b/Build/source/libs/xpdf/xpdf-src/doc/pdffonts.cat index 59f4dd90ca9..77fef55fd64 100644 --- a/Build/source/libs/xpdf/xpdf-src/doc/pdffonts.cat +++ b/Build/source/libs/xpdf/xpdf-src/doc/pdffonts.cat @@ -3,7 +3,7 @@ pdffonts(1) General Commands Manual pdffonts(1) NAME - pdffonts - Portable Document Format (PDF) font analyzer (version 4.03) + pdffonts - Portable Document Format (PDF) font analyzer (version 4.04) SYNOPSIS pdffonts [options] [PDF-file] @@ -53,9 +53,9 @@ DESCRIPTION CONFIGURATION FILE Pdffonts reads a configuration file at startup. It first tries to find the user's private config file, ~/.xpdfrc. If that doesn't exist, it - looks for a system-wide config file, typically /usr/local/etc/xpdfrc - (but this location can be changed when pdffonts is built). See the - xpdfrc(5) man page for details. + looks for a system-wide config file, typically /etc/xpdfrc (but this + location can be changed when pdffonts is built). See the xpdfrc(5) man + page for details. OPTIONS Many of the following options can be set with configuration file com- @@ -105,7 +105,7 @@ EXIT CODES 99 Other error. AUTHOR - The pdffonts software and documentation are copyright 1996-2021 Glyph & + The pdffonts software and documentation are copyright 1996-2022 Glyph & Cog, LLC. SEE ALSO @@ -115,4 +115,4 @@ SEE ALSO - 28 Jan 2021 pdffonts(1) + 18 Apr 2022 pdffonts(1) diff --git a/Build/source/libs/xpdf/xpdf-src/doc/pdfimages.1 b/Build/source/libs/xpdf/xpdf-src/doc/pdfimages.1 index 2d95ac79b66..06a9c1fc85c 100644 --- a/Build/source/libs/xpdf/xpdf-src/doc/pdfimages.1 +++ b/Build/source/libs/xpdf/xpdf-src/doc/pdfimages.1 @@ -1,8 +1,8 @@ -.\" Copyright 1998-2021 Glyph & Cog, LLC -.TH pdfimages 1 "28 Jan 2021" +.\" Copyright 1998-2022 Glyph & Cog, LLC +.TH pdfimages 1 "18 Apr 2022" .SH NAME pdfimages \- Portable Document Format (PDF) image extractor -(version 4.03) +(version 4.04) .SH SYNOPSIS .B pdfimages [options] @@ -29,9 +29,8 @@ color inversion, etc. done by the PDF content stream is ignored. .SH CONFIGURATION FILE Pdfimages reads a configuration file at startup. It first tries to find the user's private config file, ~/.xpdfrc. If that doesn't -exist, it looks for a system-wide config file, typically -/usr/local/etc/xpdfrc (but this location can be changed when pdfimages -is built). See the +exist, it looks for a system-wide config file, typically /etc/xpdfrc +(but this location can be changed when pdfimages is built). See the .BR xpdfrc (5) man page for details. .SH OPTIONS @@ -71,6 +70,10 @@ bypass all security restrictions. .BI \-upw " password" Specify the user password for the PDF file. .TP +.B \-verbose +Print a status message (to stdout) before processing each page. +.RB "[config file: " printStatusInfo ] +.TP .B \-q Don't print any messages or errors. .RB "[config file: " errQuiet ] @@ -102,7 +105,7 @@ Error related to PDF permissions. 99 Other error. .SH AUTHOR -The pdfimages software and documentation are copyright 1998-2021 Glyph +The pdfimages software and documentation are copyright 1998-2022 Glyph & Cog, LLC. .SH "SEE ALSO" .BR xpdf (1), diff --git a/Build/source/libs/xpdf/xpdf-src/doc/pdfimages.cat b/Build/source/libs/xpdf/xpdf-src/doc/pdfimages.cat index 97a0371573b..7361a3bb11c 100644 --- a/Build/source/libs/xpdf/xpdf-src/doc/pdfimages.cat +++ b/Build/source/libs/xpdf/xpdf-src/doc/pdfimages.cat @@ -4,7 +4,7 @@ pdfimages(1) General Commands Manual pdfimages(1) NAME pdfimages - Portable Document Format (PDF) image extractor (version - 4.03) + 4.04) SYNOPSIS pdfimages [options] PDF-file image-root @@ -26,9 +26,9 @@ DESCRIPTION CONFIGURATION FILE Pdfimages reads a configuration file at startup. It first tries to find the user's private config file, ~/.xpdfrc. If that doesn't exist, - it looks for a system-wide config file, typically /usr/local/etc/xpdfrc - (but this location can be changed when pdfimages is built). See the - xpdfrc(5) man page for details. + it looks for a system-wide config file, typically /etc/xpdfrc (but this + location can be changed when pdfimages is built). See the xpdfrc(5) + man page for details. OPTIONS Many of the following options can be set with configuration file com- @@ -65,6 +65,10 @@ OPTIONS -upw password Specify the user password for the PDF file. + -verbose + Print a status message (to stdout) before processing each page. + [config file: printStatusInfo] + -q Don't print any messages or errors. [config file: errQuiet] -v Print copyright and version information. @@ -85,14 +89,14 @@ EXIT CODES 99 Other error. AUTHOR - The pdfimages software and documentation are copyright 1998-2021 Glyph + The pdfimages software and documentation are copyright 1998-2022 Glyph & Cog, LLC. SEE ALSO - xpdf(1), pdftops(1), pdftotext(1), pdftohtml(1), pdfinfo(1), pdf- + xpdf(1), pdftops(1), pdftotext(1), pdftohtml(1), pdfinfo(1), pdf- fonts(1), pdfdetach(1), pdftoppm(1), pdftopng(1), xpdfrc(5) http://www.xpdfreader.com/ - 28 Jan 2021 pdfimages(1) + 18 Apr 2022 pdfimages(1) diff --git a/Build/source/libs/xpdf/xpdf-src/doc/pdfinfo.1 b/Build/source/libs/xpdf/xpdf-src/doc/pdfinfo.1 index f84badc9814..66f3e70bf3a 100644 --- a/Build/source/libs/xpdf/xpdf-src/doc/pdfinfo.1 +++ b/Build/source/libs/xpdf/xpdf-src/doc/pdfinfo.1 @@ -1,8 +1,8 @@ -.\" Copyright 1999-2021 Glyph & Cog, LLC -.TH pdfinfo 1 "28 Jan 2021" +.\" Copyright 1999-2022 Glyph & Cog, LLC +.TH pdfinfo 1 "18 Apr 2022" .SH NAME pdfinfo \- Portable Document Format (PDF) document information -extractor (version 4.03) +extractor (version 4.04) .SH SYNOPSIS .B pdfinfo [options] @@ -74,8 +74,8 @@ metadata (only if requested) .SH CONFIGURATION FILE Pdfinfo reads a configuration file at startup. It first tries to find the user's private config file, ~/.xpdfrc. If that doesn't exist, it -looks for a system-wide config file, typically /usr/local/etc/xpdfrc -(but this location can be changed when pdfinfo is built). See the +looks for a system-wide config file, typically /etc/xpdfrc (but this +location can be changed when pdfinfo is built). See the .BR xpdfrc (5) man page for details. .SH OPTIONS @@ -150,7 +150,7 @@ Error related to PDF permissions. 99 Other error. .SH AUTHOR -The pdfinfo software and documentation are copyright 1996-2021 Glyph & +The pdfinfo software and documentation are copyright 1996-2022 Glyph & Cog, LLC. .SH "SEE ALSO" .BR xpdf (1), diff --git a/Build/source/libs/xpdf/xpdf-src/doc/pdfinfo.cat b/Build/source/libs/xpdf/xpdf-src/doc/pdfinfo.cat index 0478db677c4..05dbc38f18b 100644 --- a/Build/source/libs/xpdf/xpdf-src/doc/pdfinfo.cat +++ b/Build/source/libs/xpdf/xpdf-src/doc/pdfinfo.cat @@ -4,7 +4,7 @@ pdfinfo(1) General Commands Manual pdfinfo(1) NAME pdfinfo - Portable Document Format (PDF) document information extractor - (version 4.03) + (version 4.04) SYNOPSIS pdfinfo [options] [PDF-file] @@ -40,9 +40,9 @@ DESCRIPTION CONFIGURATION FILE Pdfinfo reads a configuration file at startup. It first tries to find the user's private config file, ~/.xpdfrc. If that doesn't exist, it - looks for a system-wide config file, typically /usr/local/etc/xpdfrc - (but this location can be changed when pdfinfo is built). See the - xpdfrc(5) man page for details. + looks for a system-wide config file, typically /etc/xpdfrc (but this + location can be changed when pdfinfo is built). See the xpdfrc(5) man + page for details. OPTIONS Many of the following options can be set with configuration file com- @@ -104,7 +104,7 @@ EXIT CODES 99 Other error. AUTHOR - The pdfinfo software and documentation are copyright 1996-2021 Glyph & + The pdfinfo software and documentation are copyright 1996-2022 Glyph & Cog, LLC. SEE ALSO @@ -114,4 +114,4 @@ SEE ALSO - 28 Jan 2021 pdfinfo(1) + 18 Apr 2022 pdfinfo(1) diff --git a/Build/source/libs/xpdf/xpdf-src/doc/pdftohtml.1 b/Build/source/libs/xpdf/xpdf-src/doc/pdftohtml.1 index 4618a7a77a9..5129f0dd4b9 100644 --- a/Build/source/libs/xpdf/xpdf-src/doc/pdftohtml.1 +++ b/Build/source/libs/xpdf/xpdf-src/doc/pdftohtml.1 @@ -1,8 +1,8 @@ -.\" Copyright 1997-2021 Glyph & Cog, LLC -.TH pdftohtml 1 "28 Jan 2021" +.\" Copyright 1997-2022 Glyph & Cog, LLC +.TH pdftohtml 1 "18 Apr 2022" .SH NAME pdftohtml \- Portable Document Format (PDF) to HTML converter -(version 4.03) +(version 4.04) .SH SYNOPSIS .B pdftohtml [options] @@ -22,9 +22,8 @@ will report an error. .SH CONFIGURATION FILE Pdftohtml reads a configuration file at startup. It first tries to find the user's private config file, ~/.xpdfrc. If that doesn't -exist, it looks for a system-wide config file, typically -/usr/local/etc/xpdfrc (but this location can be changed when pdftohtml -is built). See the +exist, it looks for a system-wide config file, typically /etc/xpdfrc +(but this location can be changed when pdftohtml is built). See the .BR xpdfrc (5) man page for details. .SH OPTIONS @@ -50,11 +49,24 @@ zoom level is controlled by the \'-z' option. Specifying a larger \'-r' value will allow the viewer to zoom in farther without upscaling artifacts in the background. .TP +.BI \-vstretch " number" +Specifies a vertical stretch factor. Setting this to a value greater +than 1.0 will stretch each page vertically, spreading out the lines. +This also stretches the background image to match. +.TP +.B \-embedbackground +Embeds the background image as base64-encoded data directly in the +HTML file, rather than storing it as a separate file. +.TP .B \-nofonts Disable extraction of embedded fonts. By default, pdftohtml extracts TrueType and OpenType fonts. Disabling extraction can work around problems with buggy fonts. .TP +.B \-embedfonts +Embeds any extracted fonts as base64-encoded data directly in the HTML +file, rather than storing them as separate files. +.TP .B \-skipinvisible Don't draw invisible text. By default, invisible text (commonly used in OCR'ed PDF files) is drawn as transparent (alpha=0) HTML text. @@ -67,6 +79,17 @@ on top of the image. This option tells pdftohtml to include the regular text in the background image, and then draw it as transparent (alpha=0) HTML text. .TP +.B \-formfields +Convert AcroForm text and checkbox fields to HTML input elements. +This also removes text (e.g., underscore characters) and erases +background image content (e.g., lines or boxes) in the field areas. +.TP +.B \-table +Use table mode when performing the underlying text extraction. This +will generally produce better output when the PDF content is a +full-page table. NB: This does not generate HTML tables; it just +changes the way text is split up. +.TP .BI \-opw " password" Specify the owner password for the PDF file. Providing this will bypass all security restrictions. @@ -74,6 +97,10 @@ bypass all security restrictions. .BI \-upw " password" Specify the user password for the PDF file. .TP +.B \-verbose +Print a status message (to stdout) before processing each page. +.RB "[config file: " printStatusInfo ] +.TP .B \-q Don't print any messages or errors. .RB "[config file: " errQuiet ] @@ -114,7 +141,7 @@ Error related to PDF permissions. 99 Other error. .SH AUTHOR -The pdftohtml software and documentation are copyright 1996-2021 Glyph +The pdftohtml software and documentation are copyright 1996-2022 Glyph & Cog, LLC. .SH "SEE ALSO" .BR xpdf (1), diff --git a/Build/source/libs/xpdf/xpdf-src/doc/pdftohtml.cat b/Build/source/libs/xpdf/xpdf-src/doc/pdftohtml.cat index 3eea2e32ec1..5ddbfa0c9fb 100644 --- a/Build/source/libs/xpdf/xpdf-src/doc/pdftohtml.cat +++ b/Build/source/libs/xpdf/xpdf-src/doc/pdftohtml.cat @@ -4,7 +4,7 @@ pdftohtml(1) General Commands Manual pdftohtml(1) NAME pdftohtml - Portable Document Format (PDF) to HTML converter (version - 4.03) + 4.04) SYNOPSIS pdftohtml [options] PDF-file HTML-dir @@ -20,9 +20,9 @@ DESCRIPTION CONFIGURATION FILE Pdftohtml reads a configuration file at startup. It first tries to find the user's private config file, ~/.xpdfrc. If that doesn't exist, - it looks for a system-wide config file, typically /usr/local/etc/xpdfrc - (but this location can be changed when pdftohtml is built). See the - xpdfrc(5) man page for details. + it looks for a system-wide config file, typically /etc/xpdfrc (but this + location can be changed when pdftohtml is built). See the xpdfrc(5) + man page for details. OPTIONS Many of the following options can be set with configuration file com- @@ -48,31 +48,60 @@ OPTIONS larger '-r' value will allow the viewer to zoom in farther with- out upscaling artifacts in the background. + -vstretch number + Specifies a vertical stretch factor. Setting this to a value + greater than 1.0 will stretch each page vertically, spreading + out the lines. This also stretches the background image to + match. + + -embedbackground + Embeds the background image as base64-encoded data directly in + the HTML file, rather than storing it as a separate file. + -nofonts Disable extraction of embedded fonts. By default, pdftohtml extracts TrueType and OpenType fonts. Disabling extraction can work around problems with buggy fonts. + -embedfonts + Embeds any extracted fonts as base64-encoded data directly in + the HTML file, rather than storing them as separate files. + -skipinvisible Don't draw invisible text. By default, invisible text (commonly used in OCR'ed PDF files) is drawn as transparent (alpha=0) HTML - text. This option tells pdftohtml to discard invisible text + text. This option tells pdftohtml to discard invisible text entirely. -allinvisible - Treat all text as invisible. By default, regular (non-invisi- - ble) text is not drawn in the background image, and is instead - drawn with HTML on top of the image. This option tells pdfto- - html to include the regular text in the background image, and + Treat all text as invisible. By default, regular (non-invisi- + ble) text is not drawn in the background image, and is instead + drawn with HTML on top of the image. This option tells pdfto- + html to include the regular text in the background image, and then draw it as transparent (alpha=0) HTML text. + -formfields + Convert AcroForm text and checkbox fields to HTML input ele- + ments. This also removes text (e.g., underscore characters) and + erases background image content (e.g., lines or boxes) in the + field areas. + + -table Use table mode when performing the underlying text extraction. + This will generally produce better output when the PDF content + is a full-page table. NB: This does not generate HTML tables; + it just changes the way text is split up. + -opw password - Specify the owner password for the PDF file. Providing this + Specify the owner password for the PDF file. Providing this will bypass all security restrictions. -upw password Specify the user password for the PDF file. + -verbose + Print a status message (to stdout) before processing each page. + [config file: printStatusInfo] + -q Don't print any messages or errors. [config file: errQuiet] -cfg config-file @@ -102,7 +131,7 @@ EXIT CODES 99 Other error. AUTHOR - The pdftohtml software and documentation are copyright 1996-2021 Glyph + The pdftohtml software and documentation are copyright 1996-2022 Glyph & Cog, LLC. SEE ALSO @@ -112,4 +141,4 @@ SEE ALSO - 28 Jan 2021 pdftohtml(1) + 18 Apr 2022 pdftohtml(1) diff --git a/Build/source/libs/xpdf/xpdf-src/doc/pdftopng.1 b/Build/source/libs/xpdf/xpdf-src/doc/pdftopng.1 index bd8f517358f..1193120a54d 100644 --- a/Build/source/libs/xpdf/xpdf-src/doc/pdftopng.1 +++ b/Build/source/libs/xpdf/xpdf-src/doc/pdftopng.1 @@ -1,8 +1,8 @@ -.\" Copyright 2017-2021 Glyph & Cog, LLC -.TH pdftopng 1 "28 Jan 2021" +.\" Copyright 2017-2022 Glyph & Cog, LLC +.TH pdftopng 1 "18 Apr 2022" .SH NAME pdftopng \- Portable Document Format (PDF) to Portable Network Graphics -(PNG) converter (version 4.03) +(PNG) converter (version 4.04) .SH SYNOPSIS .B pdftopng [options] @@ -26,9 +26,8 @@ when converting a single page). .SH CONFIGURATION FILE Pdftopng reads a configuration file at startup. It first tries to find the user's private config file, ~/.xpdfrc. If that doesn't -exist, it looks for a system-wide config file, typically -/usr/local/etc/xpdfrc (but this location can be changed when pdftopng -is built). See the +exist, it looks for a system-wide config file, typically /etc/xpdfrc +(but this location can be changed when pdftopng is built). See the .BR xpdfrc (5) man page for details. .SH OPTIONS @@ -79,6 +78,10 @@ bypass all security restrictions. .BI \-upw " password" Specify the user password for the PDF file. .TP +.B \-verbose +Print a status message (to stdout) before processing each page. +.RB "[config file: " printStatusInfo ] +.TP .B \-q Don't print any messages or errors. .RB "[config file: " errQuiet ] @@ -110,7 +113,7 @@ Error related to PDF permissions. 99 Other error. .SH AUTHOR -The pdftopng software and documentation are copyright 1996-2021 Glyph +The pdftopng software and documentation are copyright 1996-2022 Glyph & Cog, LLC. .SH "SEE ALSO" .BR xpdf (1), diff --git a/Build/source/libs/xpdf/xpdf-src/doc/pdftopng.cat b/Build/source/libs/xpdf/xpdf-src/doc/pdftopng.cat index 7e17c504b4b..10a4408496f 100644 --- a/Build/source/libs/xpdf/xpdf-src/doc/pdftopng.cat +++ b/Build/source/libs/xpdf/xpdf-src/doc/pdftopng.cat @@ -4,7 +4,7 @@ pdftopng(1) General Commands Manual pdftopng(1) NAME pdftopng - Portable Document Format (PDF) to Portable Network Graphics - (PNG) converter (version 4.03) + (PNG) converter (version 4.04) SYNOPSIS pdftopng [options] PDF-file PNG-root @@ -22,9 +22,9 @@ DESCRIPTION CONFIGURATION FILE Pdftopng reads a configuration file at startup. It first tries to find the user's private config file, ~/.xpdfrc. If that doesn't exist, it - looks for a system-wide config file, typically /usr/local/etc/xpdfrc - (but this location can be changed when pdftopng is built). See the - xpdfrc(5) man page for details. + looks for a system-wide config file, typically /etc/xpdfrc (but this + location can be changed when pdftopng is built). See the xpdfrc(5) man + page for details. OPTIONS Many of the following options can be set with configuration file com- @@ -70,6 +70,10 @@ OPTIONS -upw password Specify the user password for the PDF file. + -verbose + Print a status message (to stdout) before processing each page. + [config file: printStatusInfo] + -q Don't print any messages or errors. [config file: errQuiet] -v Print copyright and version information. @@ -90,14 +94,14 @@ EXIT CODES 99 Other error. AUTHOR - The pdftopng software and documentation are copyright 1996-2021 Glyph & + The pdftopng software and documentation are copyright 1996-2022 Glyph & Cog, LLC. SEE ALSO - xpdf(1), pdftops(1), pdftotext(1), pdftohtml(1), pdfinfo(1), pdf- + xpdf(1), pdftops(1), pdftotext(1), pdftohtml(1), pdfinfo(1), pdf- fonts(1), pdfdetach(1), pdftoppm(1), pdfimages(1), xpdfrc(5) http://www.xpdfreader.com/ - 28 Jan 2021 pdftopng(1) + 18 Apr 2022 pdftopng(1) diff --git a/Build/source/libs/xpdf/xpdf-src/doc/pdftoppm.1 b/Build/source/libs/xpdf/xpdf-src/doc/pdftoppm.1 index 23b5b06980c..d485b2bc48f 100644 --- a/Build/source/libs/xpdf/xpdf-src/doc/pdftoppm.1 +++ b/Build/source/libs/xpdf/xpdf-src/doc/pdftoppm.1 @@ -1,8 +1,8 @@ -.\" Copyright 2005-2021 Glyph & Cog, LLC -.TH pdftoppm 1 "28 Jan 2021" +.\" Copyright 2005-2022 Glyph & Cog, LLC +.TH pdftoppm 1 "18 Apr 2022" .SH NAME pdftoppm \- Portable Document Format (PDF) to Portable Pixmap (PPM) -converter (version 4.03) +converter (version 4.04) .SH SYNOPSIS .B pdftoppm [options] @@ -28,9 +28,8 @@ when converting a single page). .SH CONFIGURATION FILE Pdftoppm reads a configuration file at startup. It first tries to find the user's private config file, ~/.xpdfrc. If that doesn't -exist, it looks for a system-wide config file, typically -/usr/local/etc/xpdfrc (but this location can be changed when pdftoppm -is built). See the +exist, it looks for a system-wide config file, typically /etc/xpdfrc +(but this location can be changed when pdftoppm is built). See the .BR xpdfrc (5) man page for details. .SH OPTIONS @@ -79,6 +78,10 @@ bypass all security restrictions. .BI \-upw " password" Specify the user password for the PDF file. .TP +.B \-verbose +Print a status message (to stdout) before processing each page. +.RB "[config file: " printStatusInfo ] +.TP .B \-q Don't print any messages or errors. .RB "[config file: " errQuiet ] @@ -110,7 +113,7 @@ Error related to PDF permissions. 99 Other error. .SH AUTHOR -The pdftoppm software and documentation are copyright 1996-2021 Glyph +The pdftoppm software and documentation are copyright 1996-2022 Glyph & Cog, LLC. .SH "SEE ALSO" .BR xpdf (1), diff --git a/Build/source/libs/xpdf/xpdf-src/doc/pdftoppm.cat b/Build/source/libs/xpdf/xpdf-src/doc/pdftoppm.cat index 9621be3c3b0..30d012df246 100644 --- a/Build/source/libs/xpdf/xpdf-src/doc/pdftoppm.cat +++ b/Build/source/libs/xpdf/xpdf-src/doc/pdftoppm.cat @@ -4,7 +4,7 @@ pdftoppm(1) General Commands Manual pdftoppm(1) NAME pdftoppm - Portable Document Format (PDF) to Portable Pixmap (PPM) con- - verter (version 4.03) + verter (version 4.04) SYNOPSIS pdftoppm [options] PDF-file PPM-root @@ -23,9 +23,9 @@ DESCRIPTION CONFIGURATION FILE Pdftoppm reads a configuration file at startup. It first tries to find the user's private config file, ~/.xpdfrc. If that doesn't exist, it - looks for a system-wide config file, typically /usr/local/etc/xpdfrc - (but this location can be changed when pdftoppm is built). See the - xpdfrc(5) man page for details. + looks for a system-wide config file, typically /etc/xpdfrc (but this + location can be changed when pdftoppm is built). See the xpdfrc(5) man + page for details. OPTIONS Many of the following options can be set with configuration file com- @@ -69,6 +69,10 @@ OPTIONS -upw password Specify the user password for the PDF file. + -verbose + Print a status message (to stdout) before processing each page. + [config file: printStatusInfo] + -q Don't print any messages or errors. [config file: errQuiet] -v Print copyright and version information. @@ -89,14 +93,14 @@ EXIT CODES 99 Other error. AUTHOR - The pdftoppm software and documentation are copyright 1996-2021 Glyph & + The pdftoppm software and documentation are copyright 1996-2022 Glyph & Cog, LLC. SEE ALSO - xpdf(1), pdftops(1), pdftotext(1), pdftohtml(1), pdfinfo(1), pdf- + xpdf(1), pdftops(1), pdftotext(1), pdftohtml(1), pdfinfo(1), pdf- fonts(1), pdfdetach(1), pdftopng(1), pdfimages(1), xpdfrc(5) http://www.xpdfreader.com/ - 28 Jan 2021 pdftoppm(1) + 18 Apr 2022 pdftoppm(1) diff --git a/Build/source/libs/xpdf/xpdf-src/doc/pdftops.1 b/Build/source/libs/xpdf/xpdf-src/doc/pdftops.1 index e23425d5bad..028e983aec9 100644 --- a/Build/source/libs/xpdf/xpdf-src/doc/pdftops.1 +++ b/Build/source/libs/xpdf/xpdf-src/doc/pdftops.1 @@ -1,8 +1,8 @@ -.\" Copyright 1996-2021 Glyph & Cog, LLC -.TH pdftops 1 "28 Jan 2021" +.\" Copyright 1996-2022 Glyph & Cog, LLC +.TH pdftops 1 "18 Apr 2022" .SH NAME pdftops \- Portable Document Format (PDF) to PostScript converter -(version 4.03) +(version 4.04) .SH SYNOPSIS .B pdftops [options] @@ -31,8 +31,8 @@ is \'-', the PostScript is sent to stdout. .SH CONFIGURATION FILE Pdftops reads a configuration file at startup. It first tries to find the user's private config file, ~/.xpdfrc. If that doesn't exist, it -looks for a system-wide config file, typically /usr/local/etc/xpdfrc -(but this location can be changed when pdftops is built). See the +looks for a system-wide config file, typically /etc/xpdfrc (but this +location can be changed when pdftops is built). See the .BR xpdfrc (5) man page for details. .SH OPTIONS @@ -200,6 +200,10 @@ bypass all security restrictions. .BI \-upw " password" Specify the user password for the PDF file. .TP +.B \-verbose +Print a status message (to stdout) before processing each page. +.RB "[config file: " printStatusInfo ] +.TP .B \-q Don't print any messages or errors. .RB "[config file: " errQuiet ] @@ -236,7 +240,7 @@ Error related to PDF permissions. 99 Other error. .SH AUTHOR -The pdftops software and documentation are copyright 1996-2021 Glyph & +The pdftops software and documentation are copyright 1996-2022 Glyph & Cog, LLC. .SH "SEE ALSO" .BR xpdf (1), diff --git a/Build/source/libs/xpdf/xpdf-src/doc/pdftops.cat b/Build/source/libs/xpdf/xpdf-src/doc/pdftops.cat index c985d686fea..ed1c8b718cc 100644 --- a/Build/source/libs/xpdf/xpdf-src/doc/pdftops.cat +++ b/Build/source/libs/xpdf/xpdf-src/doc/pdftops.cat @@ -4,7 +4,7 @@ pdftops(1) General Commands Manual pdftops(1) NAME pdftops - Portable Document Format (PDF) to PostScript converter (ver- - sion 4.03) + sion 4.04) SYNOPSIS pdftops [options] [PDF-file [PS-file]] @@ -21,9 +21,9 @@ DESCRIPTION CONFIGURATION FILE Pdftops reads a configuration file at startup. It first tries to find the user's private config file, ~/.xpdfrc. If that doesn't exist, it - looks for a system-wide config file, typically /usr/local/etc/xpdfrc - (but this location can be changed when pdftops is built). See the - xpdfrc(5) man page for details. + looks for a system-wide config file, typically /etc/xpdfrc (but this + location can be changed when pdftops is built). See the xpdfrc(5) man + page for details. OPTIONS Many of the following options can be set with configuration file com- @@ -177,6 +177,10 @@ OPTIONS -upw password Specify the user password for the PDF file. + -verbose + Print a status message (to stdout) before processing each page. + [config file: printStatusInfo] + -q Don't print any messages or errors. [config file: errQuiet] -cfg config-file @@ -201,14 +205,14 @@ EXIT CODES 99 Other error. AUTHOR - The pdftops software and documentation are copyright 1996-2021 Glyph & + The pdftops software and documentation are copyright 1996-2022 Glyph & Cog, LLC. SEE ALSO - xpdf(1), pdftotext(1), pdftohtml(1), pdfinfo(1), pdffonts(1), pdfde- + xpdf(1), pdftotext(1), pdftohtml(1), pdfinfo(1), pdffonts(1), pdfde- tach(1), pdftoppm(1), pdftopng(1), pdfimages(1), xpdfrc(5) http://www.xpdfreader.com/ - 28 Jan 2021 pdftops(1) + 18 Apr 2022 pdftops(1) diff --git a/Build/source/libs/xpdf/xpdf-src/doc/pdftotext.1 b/Build/source/libs/xpdf/xpdf-src/doc/pdftotext.1 index d1e81d01f25..e5e7d655bda 100644 --- a/Build/source/libs/xpdf/xpdf-src/doc/pdftotext.1 +++ b/Build/source/libs/xpdf/xpdf-src/doc/pdftotext.1 @@ -1,8 +1,8 @@ -.\" Copyright 1997-2021 Glyph & Cog, LLC -.TH pdftotext 1 "28 Jan 2021" +.\" Copyright 1997-2022 Glyph & Cog, LLC +.TH pdftotext 1 "18 Apr 2022" .SH NAME pdftotext \- Portable Document Format (PDF) to text converter -(version 4.03) +(version 4.04) .SH SYNOPSIS .B pdftotext [options] @@ -28,9 +28,8 @@ is \'-', the text is sent to stdout. .SH CONFIGURATION FILE Pdftotext reads a configuration file at startup. It first tries to find the user's private config file, ~/.xpdfrc. If that doesn't -exist, it looks for a system-wide config file, typically -/usr/local/etc/xpdfrc (but this location can be changed when pdftotext -is built). See the +exist, it looks for a system-wide config file, typically /etc/xpdfrc +(but this location can be changed when pdftotext is built). See the .BR xpdfrc (5) man page for details. .SH OPTIONS @@ -124,7 +123,8 @@ Sets the end-of-line convention to use for text output. .RB "[config file: " textEOL ] .TP .B \-nopgbrk -Don't insert page breaks (form feed characters) between pages. +Don't insert a page breaks (form feed character) at the end of each +page. .RB "[config file: " textPageBreaks ] .TP .B \-bom @@ -158,6 +158,10 @@ bypass all security restrictions. .BI \-upw " password" Specify the user password for the PDF file. .TP +.B \-verbose +Print a status message (to stdout) before processing each page. +.RB "[config file: " printStatusInfo ] +.TP .B \-q Don't print any messages or errors. .RB "[config file: " errQuiet ] @@ -201,7 +205,7 @@ Error related to PDF permissions. 99 Other error. .SH AUTHOR -The pdftotext software and documentation are copyright 1996-2021 Glyph +The pdftotext software and documentation are copyright 1996-2022 Glyph & Cog, LLC. .SH "SEE ALSO" .BR xpdf (1), diff --git a/Build/source/libs/xpdf/xpdf-src/doc/pdftotext.cat b/Build/source/libs/xpdf/xpdf-src/doc/pdftotext.cat index d4a001d7c63..face2575a3f 100644 --- a/Build/source/libs/xpdf/xpdf-src/doc/pdftotext.cat +++ b/Build/source/libs/xpdf/xpdf-src/doc/pdftotext.cat @@ -4,7 +4,7 @@ pdftotext(1) General Commands Manual pdftotext(1) NAME pdftotext - Portable Document Format (PDF) to text converter (version - 4.03) + 4.04) SYNOPSIS pdftotext [options] [PDF-file [text-file]] @@ -19,9 +19,9 @@ DESCRIPTION CONFIGURATION FILE Pdftotext reads a configuration file at startup. It first tries to find the user's private config file, ~/.xpdfrc. If that doesn't exist, - it looks for a system-wide config file, typically /usr/local/etc/xpdfrc - (but this location can be changed when pdftotext is built). See the - xpdfrc(5) man page for details. + it looks for a system-wide config file, typically /etc/xpdfrc (but this + location can be changed when pdftotext is built). See the xpdfrc(5) + man page for details. OPTIONS Many of the following options can be set with configuration file com- @@ -101,8 +101,8 @@ OPTIONS file: textEOL] -nopgbrk - Don't insert page breaks (form feed characters) between pages. - [config file: textPageBreaks] + Don't insert a page breaks (form feed character) at the end of + each page. [config file: textPageBreaks] -bom Insert a Unicode byte order marker (BOM) at the start of the text output. @@ -134,6 +134,10 @@ OPTIONS -upw password Specify the user password for the PDF file. + -verbose + Print a status message (to stdout) before processing each page. + [config file: printStatusInfo] + -q Don't print any messages or errors. [config file: errQuiet] -cfg config-file @@ -145,11 +149,11 @@ OPTIONS -v Print copyright and version information, then exit. - -h Print usage information, then exit. (-help and --help are + -h Print usage information, then exit. (-help and --help are equivalent.) BUGS - Some PDF files contain fonts whose encodings have been mangled beyond + Some PDF files contain fonts whose encodings have been mangled beyond recognition. There is no way (short of OCR) to extract text from these files. @@ -167,7 +171,7 @@ EXIT CODES 99 Other error. AUTHOR - The pdftotext software and documentation are copyright 1996-2021 Glyph + The pdftotext software and documentation are copyright 1996-2022 Glyph & Cog, LLC. SEE ALSO @@ -177,4 +181,4 @@ SEE ALSO - 28 Jan 2021 pdftotext(1) + 18 Apr 2022 pdftotext(1) diff --git a/Build/source/libs/xpdf/xpdf-src/doc/xpdf.1 b/Build/source/libs/xpdf/xpdf-src/doc/xpdf.1 index 7cf06315f88..2eaa95af69b 100644 --- a/Build/source/libs/xpdf/xpdf-src/doc/xpdf.1 +++ b/Build/source/libs/xpdf/xpdf-src/doc/xpdf.1 @@ -1,7 +1,7 @@ -.\" Copyright 1996-2021 Glyph & Cog, LLC -.TH xpdf 1 "28 Jan 2021" +.\" Copyright 1996-2022 Glyph & Cog, LLC +.TH xpdf 1 "18 Apr 2022" .SH NAME -xpdf \- Portable Document Format (PDF) file viewer (version 4.03) +xpdf \- Portable Document Format (PDF) file viewer (version 4.04) .SH SYNOPSIS .B xpdf [options] @@ -61,8 +61,8 @@ xpdf .SH CONFIGURATION FILE Xpdf reads a configuration file at startup. It first tries to find the user's private config file, ~/.xpdfrc. If that doesn't exist, it -looks for a system-wide config file, typically /usr/local/etc/xpdfrc -(but this location can be changed when xpdf is built). See the +looks for a system-wide config file, typically /etc/xpdfrc (but this +location can be changed when xpdf is built). See the .BR xpdfrc (5) man page for details. .SH OPTIONS @@ -551,6 +551,9 @@ Go to the specified page. .BI help Open the help URL. .TP +.B hideMenuBar +Hide the menu bar. +.TP .B hideToolbar Hide the toolbar. .TP @@ -591,6 +594,25 @@ Open the error window. .BI openFile( file ) Open the specified file in the current tab. .TP +.BI openFile2( file, page, dest, passwd, location ) +Open the specified file. If +.I dest +is not empty, go to the specified named destination. Else, if +.I page +is not empty, go to the specified page number. If +.I password +is not empty, it is used as the PDF password. If +.I location +is "win", open the file in a new window; if it is "tab", open in a new +tab; if it is "check", open in the current tab, but only if the +specified PDF file isn't already open; else open in the current tab. +Any/all of the arguments, other than +.IR file , +can be empty strings. For example: +.nf +openFile2(test.pdf,7,,,tab) +.fi +.TP .BI openFileAtDest( file, dest ) Open the specified file in the current tab at the specified named destination. @@ -787,9 +809,24 @@ Set the selection to the word at the current mouse position. .BI setSelection( pg , ulx , uly , lrx , lry ) Set the selection to the specified coordinates on the specified page. .TP +.B showAttachmentsPane +Shows the attachments in the outline/layers/attachments pane. +.TP +.B showDocumentInfo +Open the document information dialog. +.TP .B showKeyBindings Open the key bindings dialog. .TP +.B showLayersPane +Shows the layers in the outline/layers/attachments pane. +.TP +.B showMenuBar +Show the menu bar. +.TP +.B showOutlinePane +Shows the outline in the outline/layers/attachments pane. +.TP .B showToolbar Show the toolbar. .TP @@ -826,6 +863,9 @@ Toggle between continuous and single page view modes. .B toggleFullScreenMode Toggle between full-screen and window modes. .TP +.B toggleMenuBar +Toggle the menu bar between shown and hidden. +.TP .B toggleSelectMode Toggle between block and linear selection mode. .TP @@ -908,7 +948,7 @@ Error related to PDF permissions. 99 Other error. .SH AUTHOR -The xpdf software and documentation are copyright 1996-2021 Glyph & +The xpdf software and documentation are copyright 1996-2022 Glyph & Cog, LLC. .SH "SEE ALSO" .BR pdftops (1), diff --git a/Build/source/libs/xpdf/xpdf-src/doc/xpdf.cat b/Build/source/libs/xpdf/xpdf-src/doc/xpdf.cat index 3b71667f055..ba20911962d 100644 --- a/Build/source/libs/xpdf/xpdf-src/doc/xpdf.cat +++ b/Build/source/libs/xpdf/xpdf-src/doc/xpdf.cat @@ -3,7 +3,7 @@ xpdf(1) General Commands Manual xpdf(1) NAME - xpdf - Portable Document Format (PDF) file viewer (version 4.03) + xpdf - Portable Document Format (PDF) file viewer (version 4.04) SYNOPSIS xpdf [options] [PDF-file [:page | +dest]] ... @@ -44,9 +44,9 @@ DESCRIPTION CONFIGURATION FILE Xpdf reads a configuration file at startup. It first tries to find the user's private config file, ~/.xpdfrc. If that doesn't exist, it looks - for a system-wide config file, typically /usr/local/etc/xpdfrc (but - this location can be changed when xpdf is built). See the xpdfrc(5) - man page for details. + for a system-wide config file, typically /etc/xpdfrc (but this location + can be changed when xpdf is built). See the xpdfrc(5) man page for + details. OPTIONS The following command line options are available. All command line @@ -500,6 +500,9 @@ COMMANDS help Open the help URL. + hideMenuBar + Hide the menu bar. + hideToolbar Hide the toolbar. @@ -538,6 +541,18 @@ COMMANDS openFile(file) Open the specified file in the current tab. + openFile2(file,page,dest,passwd,location) + Open the specified file. If dest is not empty, go to the speci- + fied named destination. Else, if page is not empty, go to the + specified page number. If password is not empty, it is used as + the PDF password. If location is "win", open the file in a new + window; if it is "tab", open in a new tab; if it is "check", + open in the current tab, but only if the specified PDF file + isn't already open; else open in the current tab. Any/all of + the arguments, other than file, can be empty strings. For exam- + ple: + openFile2(test.pdf,7,,,tab) + openFileAtDest(file,dest) Open the specified file in the current tab at the specified named destination. @@ -711,9 +726,24 @@ COMMANDS Set the selection to the specified coordinates on the specified page. + showAttachmentsPane + Shows the attachments in the outline/layers/attachments pane. + + showDocumentInfo + Open the document information dialog. + showKeyBindings Open the key bindings dialog. + showLayersPane + Shows the layers in the outline/layers/attachments pane. + + showMenuBar + Show the menu bar. + + showOutlinePane + Shows the outline in the outline/layers/attachments pane. + showToolbar Show the toolbar. @@ -748,6 +778,9 @@ COMMANDS toggleFullScreenMode Toggle between full-screen and window modes. + toggleMenuBar + Toggle the menu bar between shown and hidden. + toggleSelectMode Toggle between block and linear selection mode. @@ -825,7 +858,7 @@ EXIT CODES 99 Other error. AUTHOR - The xpdf software and documentation are copyright 1996-2021 Glyph & + The xpdf software and documentation are copyright 1996-2022 Glyph & Cog, LLC. SEE ALSO @@ -835,4 +868,4 @@ SEE ALSO - 28 Jan 2021 xpdf(1) + 18 Apr 2022 xpdf(1) diff --git a/Build/source/libs/xpdf/xpdf-src/doc/xpdfrc.5 b/Build/source/libs/xpdf/xpdf-src/doc/xpdfrc.5 index 07639316ec7..1c47e2ebb29 100644 --- a/Build/source/libs/xpdf/xpdf-src/doc/xpdfrc.5 +++ b/Build/source/libs/xpdf/xpdf-src/doc/xpdfrc.5 @@ -1,17 +1,22 @@ -.\" Copyright 2002-2021 Glyph & Cog, LLC -.TH xpdfrc 5 "28 Jan 2021" +.\" Copyright 2002-2022 Glyph & Cog, LLC +.TH xpdfrc 5 "18 Apr 202" .SH NAME -xpdfrc \- configuration file for Xpdf tools (version 4.03) +xpdfrc \- configuration file for Xpdf tools (version 4.04) .SH DESCRIPTION -All of the Xpdf tools read a single configuration file. If you have a +All of the Xpdf tools read a single configuration file. +.PP +On Linux/Unix/MacOS: if you have a .I .xpdfrc file in your home directory, it will be read. Otherwise, a system-wide configuration file will be read from -.IR /usr/local/etc/xpdfrc , +.IR /etc/xpdfrc , if it exists. (This is its default location; depending on build -options, it may be placed elsewhere.) On Win32 systems, the +options, it may be placed elsewhere.) +.PP +On Windows: the file must be named .I xpdfrc -file should be placed in the same directory as the executables. +(no leading dot, no extension), and must be placed in the same +directory as the executable (pdftotext.exe, xpdf.exe, etc.) .PP The xpdfrc file consists of a series of configuration options, one per line. Blank lines and lines starting with a \'#' (comments) are @@ -437,6 +442,12 @@ mapExtTrueTypeFontsViaUnicode is set to "no", Xpdf will assume the character codes are GIDs (i.e., use an identity mapping). This defaults to "yes". .TP +.BI useTrueTypeUnicodeMapping " yes | no" +If set to "yes", the Xpdf tools will use the Unicode encoding +information in TrueType fonts (16-bit only), if avaiable, to override +the PDF ToUnicode maps. Otherwise, the ToUnicode maps are always used +when present. This defaults to "no". +.TP .BI dropFont " font-name" Drop all text drawn in the specified font. To drop text drawn in unnamed fonts, use: @@ -468,6 +479,10 @@ anti-aliasing control provided by the old "t1libControl" and Enables or disables anti-aliasing of vector graphics in the PDF rasterizer. This defaults to "yes". .TP +.BR imageMaskAntialias " yes | no" +Enables or disables anti-aliasing of image masks (when downsampling or +upsampling) in the PDF rasterizer. This defaults to "yes". +.TP .BR antialiasPrinting " yes | no" If this is "yes", bitmaps sent to the printer will be antialiased (according to the "antialias" and "vectorAntialias" settings). If @@ -736,10 +751,26 @@ value is "yes". If set to "no", form fields will not be drawn or printed. The default value is "yes". .TP +.BI enableXFA " yes | no" +If an XFA form is present, and this option is set to "yes", Xpdf will +parse the XFA form and use certain XFA information to override +AcroForm information. If set to "no", the XFA form will not be read. +The default value is "yes". +.TP +.BI savePageNumbers " yes | no" +If set to "yes", xpdf will save the current page numbers of all open +files in ~/.xpdf.pages when the files are closed (or when quitting +xpdf). Next time the file is opened, the last-viewed page number will +be restored. The default value is "yes". +.TP .BI printCommands " yes | no" If set to "yes", drawing commands are printed as they're executed (useful for debugging). This defaults to "no". .TP +.BI printStatusInfo +If set to "yes", print a status message (to stdout) before each page +is processed. This defaults to "no". +.TP .BI errQuiet " yes | no" If set to "yes", this suppresses all error and warning messages from all of the Xpdf tools. This defaults to "no". @@ -798,7 +829,7 @@ launchCommand viewer-script .fi .SH FILES .TP -.B /usr/local/etc/xpdfrc +.B /etc/xpdfrc This is the default location for the system-wide configuration file. Depending on build options, it may be placed elsewhere. .TP @@ -806,7 +837,7 @@ Depending on build options, it may be placed elsewhere. This is the user's configuration file. If it exists, it will be read in place of the system-wide file. .SH AUTHOR -The Xpdf software and documentation are copyright 1996-2021 Glyph & +The Xpdf software and documentation are copyright 1996-2022 Glyph & Cog, LLC. .SH "SEE ALSO" .BR xpdf (1), diff --git a/Build/source/libs/xpdf/xpdf-src/doc/xpdfrc.cat b/Build/source/libs/xpdf/xpdf-src/doc/xpdfrc.cat index c43e8005e2b..c38791eaa28 100644 --- a/Build/source/libs/xpdf/xpdf-src/doc/xpdfrc.cat +++ b/Build/source/libs/xpdf/xpdf-src/doc/xpdfrc.cat @@ -3,15 +3,19 @@ xpdfrc(5) File Formats Manual xpdfrc(5) NAME - xpdfrc - configuration file for Xpdf tools (version 4.03) + xpdfrc - configuration file for Xpdf tools (version 4.04) DESCRIPTION - All of the Xpdf tools read a single configuration file. If you have a - .xpdfrc file in your home directory, it will be read. Otherwise, a - system-wide configuration file will be read from /usr/local/etc/xpdfrc, - if it exists. (This is its default location; depending on build - options, it may be placed elsewhere.) On Win32 systems, the xpdfrc - file should be placed in the same directory as the executables. + All of the Xpdf tools read a single configuration file. + + On Linux/Unix/MacOS: if you have a .xpdfrc file in your home directory, + it will be read. Otherwise, a system-wide configuration file will be + read from /etc/xpdfrc, if it exists. (This is its default location; + depending on build options, it may be placed elsewhere.) + + On Windows: the file must be named xpdfrc (no leading dot, no exten- + sion), and must be placed in the same directory as the executable + (pdftotext.exe, xpdf.exe, etc.) The xpdfrc file consists of a series of configuration options, one per line. Blank lines and lines starting with a '#' (comments) are @@ -385,8 +389,14 @@ TEXT CONTROL AND CHARACTER MAPPING character codes are GIDs (i.e., use an identity mapping). This defaults to "yes". + useTrueTypeUnicodeMapping yes | no + If set to "yes", the Xpdf tools will use the Unicode encoding + information in TrueType fonts (16-bit only), if avaiable, to + override the PDF ToUnicode maps. Otherwise, the ToUnicode maps + are always used when present. This defaults to "no". + dropFont font-name - Drop all text drawn in the specified font. To drop text drawn + Drop all text drawn in the specified font. To drop text drawn in unnamed fonts, use: dropFont "" @@ -395,114 +405,119 @@ TEXT CONTROL AND CHARACTER MAPPING RASTERIZER SETTINGS enableFreeType yes | no - Enables or disables use of FreeType (a TrueType / Type 1 font + Enables or disables use of FreeType (a TrueType / Type 1 font rasterizer). This is only relevant if the Xpdf tools were built with FreeType support. ("enableFreeType" replaces the old "freetypeControl" option.) This option defaults to "yes". disableFreeTypeHinting yes | no - If this is set to "yes", FreeType hinting will be forced off. + If this is set to "yes", FreeType hinting will be forced off. This option defaults to "no". antialias yes | no - Enables or disables font anti-aliasing in the PDF rasterizer. + Enables or disables font anti-aliasing in the PDF rasterizer. This option affects all font rasterizers. ("antialias" replaces the anti-aliasing control provided by the old "t1libControl" and "freetypeControl" options.) This default to "yes". vectorAntialias yes | no - Enables or disables anti-aliasing of vector graphics in the PDF + Enables or disables anti-aliasing of vector graphics in the PDF rasterizer. This defaults to "yes". + imageMaskAntialias yes | no + Enables or disables anti-aliasing of image masks (when downsam- + pling or upsampling) in the PDF rasterizer. This defaults to + "yes". + antialiasPrinting yes | no - If this is "yes", bitmaps sent to the printer will be - antialiased (according to the "antialias" and "vectorAntialias" - settings). If this is "no", printed bitmaps will not be + If this is "yes", bitmaps sent to the printer will be + antialiased (according to the "antialias" and "vectorAntialias" + settings). If this is "no", printed bitmaps will not be antialiased. This defaults to "no". strokeAdjust yes | no | cad - Sets the stroke adjustment mode. If set to "no", no stroke + Sets the stroke adjustment mode. If set to "no", no stroke adjustment will be done. If set to "yes", normal stroke adjust- - ment will be done: horizontal and vertical lines will be moved - by up to half a pixel to make them look cleaner when vector + ment will be done: horizontal and vertical lines will be moved + by up to half a pixel to make them look cleaner when vector anti-aliasing is enabled. If set to "cad", a slightly different stroke adjustment algorithm will be used to ensure that lines of the same original width will always have the same adjusted width - (at the expense of allowing gaps and overlaps between adjacent + (at the expense of allowing gaps and overlaps between adjacent lines). This defaults to "yes". forceAccurateTiling yes | no - If this is set to "yes", the TilingType is forced to 2 (no dis- - tortion) for all tiling patterns, regardless of the setting in + If this is set to "yes", the TilingType is forced to 2 (no dis- + tortion) for all tiling patterns, regardless of the setting in the pattern dictionary. This defaults to "no". screenType dispersed | clustered | stochasticClustered - Sets the halftone screen type, which will be used when generat- - ing a monochrome (1-bit) bitmap. The three options are dis- - persed-dot dithering, clustered-dot dithering (with a round dot - and 45-degree screen angle), and stochastic clustered-dot - dithering. By default, "stochasticClustered" is used for reso- + Sets the halftone screen type, which will be used when generat- + ing a monochrome (1-bit) bitmap. The three options are dis- + persed-dot dithering, clustered-dot dithering (with a round dot + and 45-degree screen angle), and stochastic clustered-dot + dithering. By default, "stochasticClustered" is used for reso- lutions of 300 dpi and higher, and "dispersed" is used for reso- lutions lower then 300 dpi. screenSize integer - Sets the size of the (square) halftone screen threshold matrix. - By default, this is 4 for dispersed-dot dithering, 10 for clus- - tered-dot dithering, and 100 for stochastic clustered-dot + Sets the size of the (square) halftone screen threshold matrix. + By default, this is 4 for dispersed-dot dithering, 10 for clus- + tered-dot dithering, and 100 for stochastic clustered-dot dithering. screenDotRadius integer - Sets the halftone screen dot radius. This is only used when - screenType is set to stochasticClustered, and it defaults to 2. - In clustered-dot mode, the dot radius is half of the screen + Sets the halftone screen dot radius. This is only used when + screenType is set to stochasticClustered, and it defaults to 2. + In clustered-dot mode, the dot radius is half of the screen size. Dispersed-dot dithering doesn't have a dot radius. screenGamma float Sets the halftone screen gamma correction parameter. Gamma val- - ues greater than 1 make the output brighter; gamma values less + ues greater than 1 make the output brighter; gamma values less than 1 make it darker. The default value is 1. screenBlackThreshold float - When halftoning, all values below this threshold are forced to + When halftoning, all values below this threshold are forced to solid black. This parameter is a floating point value between 0 (black) and 1 (white). The default value is 0. screenWhiteThreshold float - When halftoning, all values above this threshold are forced to + When halftoning, all values above this threshold are forced to solid white. This parameter is a floating point value between 0 (black) and 1 (white). The default value is 1. minLineWidth float - Set the minimum line width, in device pixels. This affects the - rasterizer only, not the PostScript converter (except when it - uses rasterization to handle transparency). The default value + Set the minimum line width, in device pixels. This affects the + rasterizer only, not the PostScript converter (except when it + uses rasterization to handle transparency). The default value is 0 (no minimum). enablePathSimplification yes | no - If set to "yes", simplify paths by removing points where it - won't make a significant difference to the shape. The default + If set to "yes", simplify paths by removing points where it + won't make a significant difference to the shape. The default value is "no". overprintPreview yes | no If set to "yes", generate overprint preview output, honoring the - OP/op/OPM settings in the PDF file. Ignored for non-CMYK out- + OP/op/OPM settings in the PDF file. Ignored for non-CMYK out- put. The default value is "no". VIEWER SETTINGS These settings only apply to the Xpdf GUI PDF viewer. initialZoom percentage | page | width - Sets the initial zoom factor. A number specifies a zoom per- - centage, where 100 means 72 dpi. You may also specify 'page', - to fit the page to the window size, or 'width', to fit the page + Sets the initial zoom factor. A number specifies a zoom per- + centage, where 100 means 72 dpi. You may also specify 'page', + to fit the page to the window size, or 'width', to fit the page width to the window width. defaultFitZoom percentage If xpdf is started with fit-page or fit-width zoom and no window - geometry, it will calculate a desired window size based on the - PDF page size and this defaultFitZoom value. I.e., the window - size will be chosen such that exactly one page will fit in the - window at this zoom factor (which must be a percentage). The + geometry, it will calculate a desired window size based on the + PDF page size and this defaultFitZoom value. I.e., the window + size will be chosen such that exactly one page will fit in the + window at this zoom factor (which must be a percentage). The default value is based on the screen resolution. initialDisplayMode single | continuous | sideBySideSingle | sideBySide- @@ -515,23 +530,23 @@ VIEWER SETTINGS "no", xpdf opens with the toolbar hidden. The default is "yes". initialSidebarState yes | no - If set to "yes", xpdf opens with the sidebar (tabs, outline, - etc.) visible. If set to "no", xpdf opens with the sidebar + If set to "yes", xpdf opens with the sidebar (tabs, outline, + etc.) visible. If set to "no", xpdf opens with the sidebar collapsed. The default is "yes". initialSidebarWidth width - Sets the initial sidebar width, in pixels. This is only rele- - vant if initialSidebarState is "yes". The default value is + Sets the initial sidebar width, in pixels. This is only rele- + vant if initialSidebarState is "yes". The default value is zero, which tells xpdf to use an internal default size. initialSelectMode block | linear - Sets the initial selection mode. The default setting is "lin- + Sets the initial selection mode. The default setting is "lin- ear". paperColor color Set the "paper color", i.e., the background of the page display. - The color can be #RRGGBB (hexadecimal) or a named color. This - option will not work well with PDF files that do things like + The color can be #RRGGBB (hexadecimal) or a named color. This + option will not work well with PDF files that do things like filling in white behind the text. matteColor color @@ -540,7 +555,7 @@ VIEWER SETTINGS a named color. fullScreenMatteColor color - Set the matte color for full-screen mode. The color can be + Set the matte color for full-screen mode. The color can be #RRGGBB (hexadecimal) or a named color. selectionColor color @@ -548,14 +563,14 @@ VIEWER SETTINGS or a named color. reverseVideoInvertImages yes | no - If set to "no", xpdf's reverse-video mode inverts text and vec- - tor graphic content, but not images. If set to "yes", xpdf + If set to "no", xpdf's reverse-video mode inverts text and vec- + tor graphic content, but not images. If set to "yes", xpdf inverts images as well. The default is "no". popupMenuCmd title command ... - Add a command to the popup menu. Title is the text to be dis- - played in the menu. Command is an Xpdf command (see the COM- - MANDS section of the xpdf(1) man page for details). Multiple + Add a command to the popup menu. Title is the text to be dis- + played in the menu. Command is an Xpdf command (see the COM- + MANDS section of the xpdf(1) man page for details). Multiple commands are separated by whitespace. maxTileWidth pixels @@ -563,11 +578,11 @@ VIEWER SETTINGS ing pages. This defaults to 1500. maxTileHeight pixels - Set the maximum height of tiles to be used by xpdf when raster- + Set the maximum height of tiles to be used by xpdf when raster- izing pages. This defaults to 1500. tileCacheSize tiles - Set the maximum number of tiles to be cached by xpdf when ras- + Set the maximum number of tiles to be cached by xpdf when ras- terizing pages. This defaults to 10. workerThreads numThreads @@ -575,16 +590,16 @@ VIEWER SETTINGS izing pages. This defaults to 1. launchCommand command - Sets the command executed when you click on a "launch"-type - link. The intent is for the command to be a program/script - which determines the file type and runs the appropriate viewer. - The command line will consist of the file to be launched, fol- - lowed by any parameters specified with the link. Do not use - "%s" in "command". By default, this is unset, and Xpdf will + Sets the command executed when you click on a "launch"-type + link. The intent is for the command to be a program/script + which determines the file type and runs the appropriate viewer. + The command line will consist of the file to be launched, fol- + lowed by any parameters specified with the link. Do not use + "%s" in "command". By default, this is unset, and Xpdf will simply try to execute the file (after prompting the user). movieCommand command - Sets the command executed when you click on a movie annotation. + Sets the command executed when you click on a movie annotation. The string "%s" will be replaced with the movie file name. This has no default value. @@ -592,7 +607,7 @@ VIEWER SETTINGS Sets the default printer used in the viewer's print dialog. bind modifiers-key context command ... - Add a key or mouse button binding. Modifiers can be zero or + Add a key or mouse button binding. Modifiers can be zero or more of: shift- @@ -628,14 +643,14 @@ VIEWER SETTINGS overLink / offLink (mouse over link or not) scrLockOn / scrLockOff (scroll lock on/off) - The context string can include only one of each pair in the + The context string can include only one of each pair in the above list. - Command is an Xpdf command (see the COMMANDS section of the - xpdf(1) man page for details). Multiple commands are separated + Command is an Xpdf command (see the COMMANDS section of the + xpdf(1) man page for details). Multiple commands are separated by whitespace. - The bind command replaces any existing binding, but only if it + The bind command replaces any existing binding, but only if it was defined for the exact same modifiers, key, and context. All tokens (modifiers, key, context, commands) are case-sensitive. @@ -653,10 +668,10 @@ VIEWER SETTINGS See the xpdf(1) man page for more examples. unbind modifiers-key context - Removes a key binding established with the bind command. This - is most useful to remove default key bindings before establish- - ing new ones (e.g., if the default key binding is given for - "any" context, and you want to create new key bindings for mul- + Removes a key binding established with the bind command. This + is most useful to remove default key bindings before establish- + ing new ones (e.g., if the default key binding is given for + "any" context, and you want to create new key bindings for mul- tiple contexts). tabStateFile path @@ -665,17 +680,33 @@ VIEWER SETTINGS MISCELLANEOUS SETTINGS drawAnnotations yes | no - If set to "no", annotations will not be drawn or printed. The + If set to "no", annotations will not be drawn or printed. The default value is "yes". drawFormFields yes | no - If set to "no", form fields will not be drawn or printed. The + If set to "no", form fields will not be drawn or printed. The default value is "yes". + enableXFA yes | no + If an XFA form is present, and this option is set to "yes", Xpdf + will parse the XFA form and use certain XFA information to over- + ride AcroForm information. If set to "no", the XFA form will + not be read. The default value is "yes". + + savePageNumbers yes | no + If set to "yes", xpdf will save the current page numbers of all + open files in ~/.xpdf.pages when the files are closed (or when + quitting xpdf). Next time the file is opened, the last-viewed + page number will be restored. The default value is "yes". + printCommands yes | no - If set to "yes", drawing commands are printed as they're exe- + If set to "yes", drawing commands are printed as they're exe- cuted (useful for debugging). This defaults to "no". + printStatusInfo + If set to "yes", print a status message (to stdout) before each + page is processed. This defaults to "no". + errQuiet yes | no If set to "yes", this suppresses all error and warning messages from all of the Xpdf tools. This defaults to "no". @@ -733,7 +764,7 @@ EXAMPLES FILES - /usr/local/etc/xpdfrc + /etc/xpdfrc This is the default location for the system-wide configuration file. Depending on build options, it may be placed elsewhere. @@ -742,7 +773,7 @@ FILES read in place of the system-wide file. AUTHOR - The Xpdf software and documentation are copyright 1996-2021 Glyph & + The Xpdf software and documentation are copyright 1996-2022 Glyph & Cog, LLC. SEE ALSO @@ -752,4 +783,4 @@ SEE ALSO - 28 Jan 2021 xpdfrc(5) + 18 Apr 202 xpdfrc(5) diff --git a/Build/source/libs/xpdf/xpdf-src/fofi/CMakeLists.txt b/Build/source/libs/xpdf/xpdf-src/fofi/CMakeLists.txt index 076cfafb247..fd61b25903c 100644 --- a/Build/source/libs/xpdf/xpdf-src/fofi/CMakeLists.txt +++ b/Build/source/libs/xpdf/xpdf-src/fofi/CMakeLists.txt @@ -20,6 +20,8 @@ add_library(fofi_objs OBJECT FoFiType1.cc FoFiType1C.cc ) +set_property(TARGET fofi_objs + PROPERTY POSITION_INDEPENDENT_CODE True) add_library(fofi $ diff --git a/Build/source/libs/xpdf/xpdf-src/fofi/FoFiType1C.cc b/Build/source/libs/xpdf/xpdf-src/fofi/FoFiType1C.cc index b4f0a061be9..b6a13390b40 100644 --- a/Build/source/libs/xpdf/xpdf-src/fofi/FoFiType1C.cc +++ b/Build/source/libs/xpdf/xpdf-src/fofi/FoFiType1C.cc @@ -405,7 +405,9 @@ void FoFiType1C::convertToType1(char *psName, const char **newEncoding, eexecWrite(&eb, "/password 5839 def\n"); if (privateDicts[0].nBlueValues) { eexecWrite(&eb, "/BlueValues ["); - for (i = 0; i < privateDicts[0].nBlueValues; ++i) { + // number of entries must be even + int n = privateDicts[0].nBlueValues & ~1; + for (i = 0; i < n; ++i) { buf = GString::format("{0:s}{1:d}", i > 0 ? " " : "", privateDicts[0].blueValues[i]); eexecWrite(&eb, buf->getCString()); @@ -415,7 +417,9 @@ void FoFiType1C::convertToType1(char *psName, const char **newEncoding, } if (privateDicts[0].nOtherBlues) { eexecWrite(&eb, "/OtherBlues ["); - for (i = 0; i < privateDicts[0].nOtherBlues; ++i) { + // number of entries must be even + int n = privateDicts[0].nOtherBlues & ~1; + for (i = 0; i < n; ++i) { buf = GString::format("{0:s}{1:d}", i > 0 ? " " : "", privateDicts[0].otherBlues[i]); eexecWrite(&eb, buf->getCString()); @@ -425,7 +429,9 @@ void FoFiType1C::convertToType1(char *psName, const char **newEncoding, } if (privateDicts[0].nFamilyBlues) { eexecWrite(&eb, "/FamilyBlues ["); - for (i = 0; i < privateDicts[0].nFamilyBlues; ++i) { + // number of entries must be even + int n = privateDicts[0].nFamilyBlues & ~1; + for (i = 0; i < n; ++i) { buf = GString::format("{0:s}{1:d}", i > 0 ? " " : "", privateDicts[0].familyBlues[i]); eexecWrite(&eb, buf->getCString()); @@ -435,7 +441,9 @@ void FoFiType1C::convertToType1(char *psName, const char **newEncoding, } if (privateDicts[0].nFamilyOtherBlues) { eexecWrite(&eb, "/FamilyOtherBlues ["); - for (i = 0; i < privateDicts[0].nFamilyOtherBlues; ++i) { + // number of entries must be even + int n = privateDicts[0].nFamilyOtherBlues & ~1; + for (i = 0; i < n; ++i) { buf = GString::format("{0:s}{1:d}", i > 0 ? " " : "", privateDicts[0].familyOtherBlues[i]); eexecWrite(&eb, buf->getCString()); diff --git a/Build/source/libs/xpdf/xpdf-src/goo/CMakeLists.txt b/Build/source/libs/xpdf/xpdf-src/goo/CMakeLists.txt index 0a1c56b0ebd..f3f6932eaed 100644 --- a/Build/source/libs/xpdf/xpdf-src/goo/CMakeLists.txt +++ b/Build/source/libs/xpdf/xpdf-src/goo/CMakeLists.txt @@ -22,6 +22,8 @@ add_library(goo_objs OBJECT parseargs.c Trace.cc ) +set_property(TARGET goo_objs + PROPERTY POSITION_INDEPENDENT_CODE True) add_library(goo $ diff --git a/Build/source/libs/xpdf/xpdf-src/goo/gfile.cc b/Build/source/libs/xpdf/xpdf-src/goo/gfile.cc index 570f4e7ab13..c2e7512e188 100644 --- a/Build/source/libs/xpdf/xpdf-src/goo/gfile.cc +++ b/Build/source/libs/xpdf/xpdf-src/goo/gfile.cc @@ -54,16 +54,23 @@ GString *getHomeDir() { //---------- VMS ---------- return new GString("SYS$LOGIN:"); -#elif defined(__EMX__) || defined(_WIN32) - //---------- OS/2+EMX and Win32 ---------- +#elif defined(_WIN32) + //---------- Win32 ---------- char *s; GString *ret; -#ifdef _WIN32 if ((s = getenv("USERPROFILE"))) -#else + ret = new GString(s); + else + ret = new GString("."); + return ret; + +#elif defined(__EMX__) + //---------- OS/2+EMX ---------- + char *s; + GString *ret; + if ((s = getenv("HOME"))) -#endif ret = new GString(s); else ret = new GString("."); @@ -335,11 +342,11 @@ GString *makePathAbsolute(GString *path) { #elif defined(_WIN32) //---------- Win32 ---------- - char buf[_MAX_PATH]; + char buf[MAX_PATH]; char *fp; buf[0] = '\0'; - if (!GetFullPathNameA(path->getCString(), _MAX_PATH, buf, &fp)) { + if (!GetFullPathNameA(path->getCString(), MAX_PATH, buf, &fp)) { path->clear(); return path; } @@ -398,6 +405,19 @@ GString *makePathAbsolute(GString *path) { #endif } +GBool pathIsFile(const char *path) { +#ifdef _WIN32 + wchar_t wPath[winMaxLongPath + 1]; + fileNameToUCS2(path, wPath, winMaxLongPath + 1); + DWORD attr = GetFileAttributesW(wPath); + return attr != INVALID_FILE_ATTRIBUTES && + !(attr & (FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_DEVICE)); +#else + struct stat statBuf; + return stat(path, &statBuf) == 0 && S_ISREG(statBuf.st_mode); +#endif +} + time_t getModTime(char *fileName) { #ifdef _WIN32 //~ should implement this, but it's (currently) only used in xpdf @@ -613,16 +633,16 @@ FILE *openFile(const char *path, const char *mode) { #if defined(_WIN32) return fopen(path, mode); #if 0 - wchar_t wPath[_MAX_PATH + 1]; + wchar_t wPath[winMaxLongPath + 1]; wchar_t wMode[8]; int i; - fileNameToUCS2(path, wPath, sizeof(wPath) / sizeof(wchar_t)); + fileNameToUCS2(path, wPath, winMaxLongPath + 1); for (i = 0; mode[i] && i < sizeof(wMode)/sizeof(wchar_t) - 1; ++i) { wMode[i] = (wchar_t)(mode[i] & 0xff); } wMode[i] = (wchar_t)0; - readWindowsShortcut(wPath, _MAX_PATH + 1); + readWindowsShortcut(wPath, winMaxLongPath + 1); return _wfopen(wPath, wMode); #endif /* 0 */ #elif defined(VMS) @@ -663,8 +683,8 @@ void readWindowsShortcut(wchar_t *wPath, size_t wPathSize) { fprintf(stderr, "IPersistFile.Load failed: 0x%08x\n", hres); exit(1); } - wchar_t target[_MAX_PATH + 1]; - hres = shellLink->GetPath(target, _MAX_PATH + 1, NULL, 0); + wchar_t target[winMaxLongPath + 1]; + hres = shellLink->GetPath(target, winMaxLongPath + 1, NULL, 0); if (FAILED(hres)) { return; } @@ -682,6 +702,10 @@ void readWindowsShortcut(wchar_t *wPath, size_t wPathSize) { int makeDir(const char *path, int mode) { #ifdef _WIN32 + /* + wchar_t wPath[winMaxLongPath + 1]; + return _wmkdir(fileNameToUCS2(path, wPath, winMaxLongPath + 1)); + */ return _mkdir(path); #else return mkdir(path, (mode_t)mode); diff --git a/Build/source/libs/xpdf/xpdf-src/goo/gfile.h b/Build/source/libs/xpdf/xpdf-src/goo/gfile.h index 2075d731a6c..d0d2ad6f9e1 100644 --- a/Build/source/libs/xpdf/xpdf-src/goo/gfile.h +++ b/Build/source/libs/xpdf/xpdf-src/goo/gfile.h @@ -30,6 +30,12 @@ #endif #include "gtypes.h" +// Windows 10 supports long paths - with a registry setting, and only +// with Unicode (...W) functions. +#ifdef _WIN32 +# define winMaxLongPath 32767 +#endif + class GString; //------------------------------------------------------------------------ @@ -55,6 +61,9 @@ extern GBool isAbsolutePath(char *path); // relative) or prepending user's directory (if path starts with '~'). extern GString *makePathAbsolute(GString *path); +// Returns true if [path] exists and is a regular file. +extern GBool pathIsFile(const char *path); + // Get the modification time for . Returns 0 if there is an // error. extern time_t getModTime(char *fileName); @@ -91,6 +100,14 @@ extern wchar_t *fileNameToUCS2(const char *path, wchar_t *out, size_t outSize); // UCS-2 and calls _wfopen(). On other OSes, this simply calls fopen(). extern FILE *openFile(const char *path, const char *mode); +#if 0 +#ifdef _WIN32 +// If [wPath] is a Windows shortcut (.lnk file), read the target path +// and store it back into [wPath]. +extern void readWindowsShortcut(wchar_t *wPath, size_t wPathSize); +#endif +#endif /* 0 */ + // Create a directory. On Windows, this converts the path from UTF-8 // to UCS-2 and calls _wmkdir(), ignoring the mode argument. On other // OSes, this simply calls mkdir(). diff --git a/Build/source/libs/xpdf/xpdf-src/splash/CMakeLists.txt b/Build/source/libs/xpdf/xpdf-src/splash/CMakeLists.txt index f84968cfb2a..4ac14edc459 100644 --- a/Build/source/libs/xpdf/xpdf-src/splash/CMakeLists.txt +++ b/Build/source/libs/xpdf/xpdf-src/splash/CMakeLists.txt @@ -40,6 +40,8 @@ if (HAVE_SPLASH) SplashXPathScanner.cc ${DTYPE_SRCS} ) + set_property(TARGET splash_objs + PROPERTY POSITION_INDEPENDENT_CODE True) add_library(splash $ diff --git a/Build/source/libs/xpdf/xpdf-src/splash/Splash.cc b/Build/source/libs/xpdf/xpdf-src/splash/Splash.cc index 343db796fb2..4afe21b4a25 100644 --- a/Build/source/libs/xpdf/xpdf-src/splash/Splash.cc +++ b/Build/source/libs/xpdf/xpdf-src/splash/Splash.cc @@ -469,6 +469,12 @@ void Splash::pipeRun(SplashPipe *pipe, int x0, int x1, int y, if (pipe->noTransparency && !state->blendFunc) { + //----- handle overprint + + if (overprintMaskPtr) { + *overprintMaskPtr++ = 0xffffffff; + } + //----- result color switch (bitmap->mode) { @@ -650,7 +656,19 @@ void Splash::pipeRun(SplashPipe *pipe, int x0, int x1, int y, // This path is only used when Splash::composite() is called to // composite a non-isolated group onto the backdrop. In this // case, shape is the source (group) alpha. - t = (aDest * 255) / shape - aDest; + // + // In a nested non-isolated group, i.e., if the destination is + // also a non-isolated group (state->inNonIsolatedGroup), we + // need to compute the corrected alpha, because the + // destination is is storing group alpha (same computation as + // blitCorrectedAlpha). + if (alpha0Ptr) { + t = *alpha0Ptr; + t = (Guchar)(aDest + t - div255(aDest * t)); + } else { + t = aDest; + } + t = (t * 255) / shape - t; switch (bitmap->mode) { #if SPLASH_CMYK case splashModeCMYK8: @@ -3916,10 +3934,13 @@ class ImageMaskScaler { public: // Set up a MaskScaler to scale from [srcWidth]x[srcHeight] to - // [scaledWidth]x[scaledHeight]. + // [scaledWidth]x[scaledHeight]. The [interpolate] flag controls + // filtering on upsampling, and the [antialias] flag controls + // filtering on downsampling. ImageMaskScaler(SplashImageMaskSource aSrc, void *aSrcData, int aSrcWidth, int aSrcHeight, - int aScaledWidth, int aScaledHeight, GBool aInterpolate); + int aScaledWidth, int aScaledHeight, + GBool aInterpolate, GBool aAntialias); ~ImageMaskScaler(); @@ -3934,10 +3955,13 @@ public: private: void vertDownscaleHorizDownscale(); + void vertDownscaleHorizDownscaleThresh(); void vertDownscaleHorizUpscaleNoInterp(); void vertDownscaleHorizUpscaleInterp(); + void vertDownscaleHorizUpscaleThresh(); void vertUpscaleHorizDownscaleNoInterp(); void vertUpscaleHorizDownscaleInterp(); + void vertUpscaleHorizDownscaleThresh(); void vertUpscaleHorizUpscaleNoInterp(); void vertUpscaleHorizUpscaleInterp(); @@ -3979,7 +4003,7 @@ private: ImageMaskScaler::ImageMaskScaler(SplashImageMaskSource aSrc, void *aSrcData, int aSrcWidth, int aSrcHeight, int aScaledWidth, int aScaledHeight, - GBool aInterpolate) { + GBool aInterpolate, GBool aAntialias) { tmpBuf0 = NULL; tmpBuf1 = NULL; tmpBuf2 = NULL; @@ -4002,9 +4026,15 @@ ImageMaskScaler::ImageMaskScaler(SplashImageMaskSource aSrc, void *aSrcData, tmpBuf0 = (Guchar *)gmalloc(srcWidth); accBuf = (Guint *)gmallocn(srcWidth, sizeof(Guint)); if (scaledWidth <= srcWidth) { - scalingFunc = &ImageMaskScaler::vertDownscaleHorizDownscale; + if (!aAntialias) { + scalingFunc = &ImageMaskScaler::vertDownscaleHorizDownscaleThresh; + } else { + scalingFunc = &ImageMaskScaler::vertDownscaleHorizDownscale; + } } else { - if (aInterpolate) { + if (!aAntialias) { + scalingFunc = &ImageMaskScaler::vertDownscaleHorizUpscaleThresh; + } else if (aInterpolate) { scalingFunc = &ImageMaskScaler::vertDownscaleHorizUpscaleInterp; } else { scalingFunc = &ImageMaskScaler::vertDownscaleHorizUpscaleNoInterp; @@ -4016,7 +4046,14 @@ ImageMaskScaler::ImageMaskScaler(SplashImageMaskSource aSrc, void *aSrcData, yq = scaledHeight % srcHeight; yt = 0; yn = 0; - if (aInterpolate) { + if (!aAntialias) { + tmpBuf0 = (Guchar *)gmalloc(srcWidth); + if (scaledWidth <= srcWidth) { + scalingFunc = &ImageMaskScaler::vertUpscaleHorizDownscaleThresh; + } else { + scalingFunc = &ImageMaskScaler::vertUpscaleHorizUpscaleNoInterp; + } + } else if (aInterpolate) { yInvScale = (SplashCoord)srcHeight / (SplashCoord)scaledHeight; tmpBuf0 = (Guchar *)gmalloc(srcWidth); tmpBuf1 = (Guchar *)gmalloc(srcWidth); @@ -4099,6 +4136,43 @@ void ImageMaskScaler::vertDownscaleHorizDownscale() { } } +void ImageMaskScaler::vertDownscaleHorizDownscaleThresh() { + //--- vert downscale + int yStep = yp; + yt += yq; + if (yt >= scaledHeight) { + yt -= scaledHeight; + ++yStep; + } + memset(accBuf, 0, srcWidth * sizeof(Guint)); + for (int i = 0; i < yStep; ++i) { + (*src)(srcData, tmpBuf0); + for (int j = 0; j < srcWidth; ++j) { + accBuf[j] += tmpBuf0[j]; + } + } + + //--- horiz downscale + int acc; + int xt = 0; + int unscaledIdx = 0; + for (int scaledIdx = 0; scaledIdx < scaledWidth; ++scaledIdx) { + int xStep = xp; + xt += xq; + if (xt >= scaledWidth) { + xt -= scaledWidth; + ++xStep; + } + + acc = 0; + for (int i = 0; i < xStep; ++i) { + acc += accBuf[unscaledIdx]; + ++unscaledIdx; + } + line[scaledIdx] = acc > ((xStep * yStep) >> 1) ? (Guchar)255 : (Guchar)0; + } +} + void ImageMaskScaler::vertDownscaleHorizUpscaleNoInterp() { //--- vert downscale int yStep = yp; @@ -4169,6 +4243,40 @@ void ImageMaskScaler::vertDownscaleHorizUpscaleInterp() { } } +void ImageMaskScaler::vertDownscaleHorizUpscaleThresh() { + //--- vert downscale + int yStep = yp; + yt += yq; + if (yt >= scaledHeight) { + yt -= scaledHeight; + ++yStep; + } + memset(accBuf, 0, srcWidth * sizeof(Guint)); + for (int i = 0; i < yStep; ++i) { + (*src)(srcData, tmpBuf0); + for (int j = 0; j < srcWidth; ++j) { + accBuf[j] += tmpBuf0[j]; + } + } + + //--- horiz upscale + int xt = 0; + int scaledIdx = 0; + for (int srcIdx = 0; srcIdx < srcWidth; ++srcIdx) { + int xStep = xp; + xt += xq; + if (xt >= srcWidth) { + xt -= srcWidth; + ++xStep; + } + Guchar buf = accBuf[srcIdx] > (Guint)(yStep >> 1) ? (Guchar)255 : (Guchar)0; + for (int i = 0; i < xStep; ++i) { + line[scaledIdx] = buf; + ++scaledIdx; + } + } +} + void ImageMaskScaler::vertUpscaleHorizDownscaleNoInterp() { //--- vert upscale if (yn == 0) { @@ -4256,6 +4364,40 @@ void ImageMaskScaler::vertUpscaleHorizDownscaleInterp() { } } +void ImageMaskScaler::vertUpscaleHorizDownscaleThresh() { + //--- vert upscale + if (yn == 0) { + yn = yp; + yt += yq; + if (yt >= srcHeight) { + yt -= srcHeight; + ++yn; + } + (*src)(srcData, tmpBuf0); + } + --yn; + + //--- horiz downscale + int acc; + int xt = 0; + int unscaledIdx = 0; + for (int scaledIdx = 0; scaledIdx < scaledWidth; ++scaledIdx) { + int xStep = xp; + xt += xq; + if (xt >= scaledWidth) { + xt -= scaledWidth; + ++xStep; + } + + acc = 0; + for (int i = 0; i < xStep; ++i) { + acc += tmpBuf0[unscaledIdx]; + ++unscaledIdx; + } + line[scaledIdx] = acc > (xStep >> 1) ? (Guchar)255 : (Guchar)0; + } +} + void ImageMaskScaler::vertUpscaleHorizUpscaleNoInterp() { //--- vert upscale if (yn == 0) { @@ -4585,8 +4727,8 @@ SplashError Splash::clipToPath(SplashPath *path, GBool eo) { return state->clipToPath(path, eo); } -void Splash::setSoftMask(SplashBitmap *softMask) { - state->setSoftMask(softMask); +void Splash::setSoftMask(SplashBitmap *softMask, GBool deleteBitmap) { + state->setSoftMask(softMask, deleteBitmap); } void Splash::setInTransparencyGroup(SplashBitmap *groupBackBitmapA, @@ -4608,6 +4750,41 @@ void Splash::forceDeferredInit(int y, int h) { useDestRow(y + h - 1); } +// Check that alpha is 0 in the specified rectangle. +// NB: This doesn't work correctly in a non-isolated group, because +// the rasterizer temporarily stores alpha_g instead of alpha. +GBool Splash::checkTransparentRect(int x, int y, int w, int h) { + if (state->inNonIsolatedGroup) { + return gFalse; + } + + + if (!bitmap->alpha) { + return gFalse; + } + int yy0, yy1; + if (groupDestInitMode == splashGroupDestPreInit) { + yy0 = y; + yy1 = y + h - 1; + } else { + // both splashGroupDestInitZero and splashGroupDestInitCopy set + // alpha to zero, so anything outside of groupDestInit[YMin,YMax] + // will have alpha=0 + yy0 = (y > groupDestInitYMin) ? y : groupDestInitYMin; + yy1 = (y + h - 1 < groupDestInitYMax) ? y + h - 1 : groupDestInitYMax; + } + Guchar *alphaP = &bitmap->alpha[yy0 * bitmap->alphaRowSize + x]; + for (int yy = yy0; yy <= yy1; ++yy) { + for (int xx = 0; xx < w; ++xx) { + if (alphaP[xx] != 0) { + return gFalse; + } + } + alphaP += bitmap->getAlphaRowSize(); + } + return gTrue; +} + void Splash::setTransfer(Guchar *red, Guchar *green, Guchar *blue, Guchar *gray) { state->setTransfer(red, green, blue, gray); @@ -5749,7 +5926,8 @@ struct SplashDrawImageMaskRowData { SplashError Splash::fillImageMask(GString *imageTag, SplashImageMaskSource src, void *srcData, int w, int h, SplashCoord *mat, - GBool glyphMode, GBool interpolate) { + GBool glyphMode, GBool interpolate, + GBool antialias) { if (debugMode) { printf("fillImageMask: w=%d h=%d mat=[%.2f %.2f %.2f %.2f %.2f %.2f]\n", w, h, (double)mat[0], (double)mat[1], (double)mat[2], @@ -5763,28 +5941,35 @@ SplashError Splash::fillImageMask(GString *imageTag, //--- compute image bbox, check clipping GBool flipsOnly = splashAbs(mat[1]) <= 0.0001 && splashAbs(mat[2]) <= 0.0001; + GBool rot90Only = splashAbs(mat[0]) <= 0.0001 && splashAbs(mat[3]) <= 0.0001; GBool horizFlip = gFalse; GBool vertFlip = gFalse; int xMin, yMin, xMax, yMax; if (flipsOnly) { horizFlip = mat[0] < 0; vertFlip = mat[3] < 0; + if (horizFlip) { + getImageBounds(mat[0] + mat[4], mat[4], &xMin, &xMax); + } else { + getImageBounds(mat[4], mat[0] + mat[4], &xMin, &xMax); + } if (vertFlip) { - if (horizFlip) { // bottom-up, mirrored - getImageBounds(mat[0] + mat[4], mat[4], &xMin, &xMax); - getImageBounds(mat[3] + mat[5], mat[5], &yMin, &yMax); - } else { // bottom-up - getImageBounds(mat[4], mat[0] + mat[4], &xMin, &xMax); - getImageBounds(mat[3] + mat[5], mat[5], &yMin, &yMax); - } + getImageBounds(mat[3] + mat[5], mat[5], &yMin, &yMax); } else { - if (horizFlip) { // top-down, mirrored - getImageBounds(mat[0] + mat[4], mat[4], &xMin, &xMax); - getImageBounds(mat[5], mat[3] + mat[5], &yMin, &yMax); - } else { // top-down - getImageBounds(mat[4], mat[0] + mat[4], &xMin, &xMax); - getImageBounds(mat[5], mat[3] + mat[5], &yMin, &yMax); - } + getImageBounds(mat[5], mat[3] + mat[5], &yMin, &yMax); + } + } else if (rot90Only) { + horizFlip = mat[2] < 0; + vertFlip = mat[1] < 0; + if (horizFlip) { + getImageBounds(mat[2] + mat[4], mat[4], &xMin, &xMax); + } else { + getImageBounds(mat[4], mat[2] + mat[4], &xMin, &xMax); + } + if (vertFlip) { + getImageBounds(mat[1] + mat[5], mat[5], &yMin, &yMax); + } else { + getImageBounds(mat[5], mat[1] + mat[5], &yMin, &yMax); } } else { int xx = splashRound(mat[4]); // (0,0) @@ -5860,7 +6045,7 @@ SplashError Splash::fillImageMask(GString *imageTag, if (clipRes == splashClipAllInside) { drawRowFunc = &Splash::drawImageMaskRowNoClip; } else { - if (vectorAntialias) { + if (antialias) { drawRowFunc = &Splash::drawImageMaskRowClipAA; } else { drawRowFunc = &Splash::drawImageMaskRowClipNoAA; @@ -5873,7 +6058,7 @@ SplashError Splash::fillImageMask(GString *imageTag, int scaledWidth = xMax - xMin; int scaledHeight = yMax - yMin; ImageMaskScaler scaler(src, srcData, w, h, - scaledWidth, scaledHeight, interpolate); + scaledWidth, scaledHeight, interpolate, antialias); Guchar *tmpLine = NULL; if (horizFlip) { tmpLine = (Guchar *)gmalloc(scaledWidth); @@ -5912,6 +6097,50 @@ SplashError Splash::fillImageMask(GString *imageTag, gfree(tmpLine); } + //--- 90/270 rotation + } else if (rot90Only && !veryLarge) { + if (clipRes != splashClipAllOutside) { + + // scale the mask + int scaledWidth = yMax - yMin; + int scaledHeight = xMax - xMin; + ImageMaskScaler scaler(src, srcData, w, h, + scaledWidth, scaledHeight, interpolate, antialias); + Guchar *scaledMask = (Guchar *)gmallocn(scaledHeight, scaledWidth); + Guchar *ptr = scaledMask; + for (int y = 0; y < scaledHeight; ++y) { + scaler.nextLine(); + memcpy(ptr, scaler.data(), scaledWidth); + ptr += scaledWidth; + } + + // draw it + Guchar *tmpLine = (Guchar *)gmalloc(scaledHeight); + for (int y = 0; y < scaledWidth; ++y) { + if (vertFlip) { + ptr = scaledMask + (scaledWidth - 1 - y); + } else { + ptr = scaledMask + y; + } + if (horizFlip) { + ptr += (scaledHeight - 1) * scaledWidth; + for (int x = 0; x < scaledHeight; ++x) { + tmpLine[x] = *ptr; + ptr -= scaledWidth; + } + } else { + for (int x = 0; x < scaledHeight; ++x) { + tmpLine[x] = *ptr; + ptr += scaledWidth; + } + } + (this->*drawRowFunc)(&dd, tmpLine, xMin, yMin + y, scaledHeight); + } + + gfree(tmpLine); + gfree(scaledMask); + } + //--- arbitrary transform } else { // estimate of size of scaled image @@ -5963,7 +6192,7 @@ SplashError Splash::fillImageMask(GString *imageTag, Guchar *scaledMask = (Guchar *)gmallocn(scaledHeight, scaledWidth); if (downscaling) { ImageMaskScaler scaler(src, srcData, w, h, - scaledWidth, scaledHeight, interpolate); + scaledWidth, scaledHeight, interpolate, antialias); Guchar *ptr = scaledMask; for (int y = 0; y < scaledHeight; ++y) { scaler.nextLine(); @@ -5982,7 +6211,7 @@ SplashError Splash::fillImageMask(GString *imageTag, } // draw it - if (interpolate) { + if (interpolate && antialias) { drawImageMaskArbitraryInterp(scaledMask, &dd, drawRowFunc, invMat, scaledWidth, scaledHeight, @@ -6259,28 +6488,35 @@ SplashError Splash::drawImage(GString *imageTag, //--- compute image bbox, check clipping GBool flipsOnly = splashAbs(mat[1]) <= 0.0001 && splashAbs(mat[2]) <= 0.0001; + GBool rot90Only = splashAbs(mat[0]) <= 0.0001 && splashAbs(mat[3]) <= 0.0001; GBool horizFlip = gFalse; GBool vertFlip = gFalse; int xMin, yMin, xMax, yMax; if (flipsOnly) { horizFlip = mat[0] < 0; vertFlip = mat[3] < 0; + if (horizFlip) { + getImageBounds(mat[0] + mat[4], mat[4], &xMin, &xMax); + } else { + getImageBounds(mat[4], mat[0] + mat[4], &xMin, &xMax); + } if (vertFlip) { - if (horizFlip) { // bottom-up, mirrored - getImageBounds(mat[0] + mat[4], mat[4], &xMin, &xMax); - getImageBounds(mat[3] + mat[5], mat[5], &yMin, &yMax); - } else { // bottom-up - getImageBounds(mat[4], mat[0] + mat[4], &xMin, &xMax); - getImageBounds(mat[3] + mat[5], mat[5], &yMin, &yMax); - } + getImageBounds(mat[3] + mat[5], mat[5], &yMin, &yMax); } else { - if (horizFlip) { // top-down, mirrored - getImageBounds(mat[0] + mat[4], mat[4], &xMin, &xMax); - getImageBounds(mat[5], mat[3] + mat[5], &yMin, &yMax); - } else { // top-down - getImageBounds(mat[4], mat[0] + mat[4], &xMin, &xMax); - getImageBounds(mat[5], mat[3] + mat[5], &yMin, &yMax); - } + getImageBounds(mat[5], mat[3] + mat[5], &yMin, &yMax); + } + } else if (rot90Only) { + horizFlip = mat[2] < 0; + vertFlip = mat[1] < 0; + if (horizFlip) { + getImageBounds(mat[2] + mat[4], mat[4], &xMin, &xMax); + } else { + getImageBounds(mat[4], mat[2] + mat[4], &xMin, &xMax); + } + if (vertFlip) { + getImageBounds(mat[1] + mat[5], mat[5], &yMin, &yMax); + } else { + getImageBounds(mat[5], mat[1] + mat[5], &yMin, &yMax); } } else { int xx = splashRound(mat[4]); // (0,0) @@ -6435,6 +6671,83 @@ SplashError Splash::drawImage(GString *imageTag, delete scaler; } + //--- 90/270 rotation + } else if (rot90Only && !veryLarge) { + if (clipRes != splashClipAllOutside) { + + // scale the image + int scaledWidth = yMax - yMin; + int scaledHeight = xMax - xMin; + Guchar *scaledColor, *scaledAlpha; + GBool freeScaledImage; + getScaledImage(imageTag, src, srcData, w, h, nComps, + scaledWidth, scaledHeight, srcMode, srcAlpha, interpolate, + &scaledColor, &scaledAlpha, &freeScaledImage); + + // draw it + Guchar *tmpLine = (Guchar *)gmallocn(scaledHeight, nComps); + Guchar *tmpAlphaLine = NULL; + if (srcAlpha) { + tmpAlphaLine = (Guchar *)gmalloc(scaledHeight); + } + for (int y = 0; y < scaledWidth; ++y) { + Guchar *ptr, *alphaPtr; + if (vertFlip) { + ptr = scaledColor + (scaledWidth - 1 - y) * nComps; + if (srcAlpha) { + alphaPtr = scaledAlpha + (scaledWidth - 1 - y); + } + } else { + ptr = scaledColor + y * nComps; + if (srcAlpha) { + alphaPtr = scaledAlpha + y; + } + } + if (horizFlip) { + ptr += (scaledHeight - 1) * scaledWidth * nComps; + Guchar *q = tmpLine; + for (int x = 0; x < scaledHeight; ++x) { + for (int i = 0; i < nComps; ++i) { + *q++ = ptr[i]; + } + ptr -= scaledWidth * nComps; + } + if (srcAlpha) { + alphaPtr += (scaledHeight - 1) * scaledWidth; + q = tmpAlphaLine; + for (int x = 0; x < scaledHeight; ++x) { + *q++ = *alphaPtr; + alphaPtr -= scaledWidth; + } + } + } else { + Guchar *q = tmpLine; + for (int x = 0; x < scaledHeight; ++x) { + for (int i = 0; i < nComps; ++i) { + *q++ = ptr[i]; + } + ptr += scaledWidth * nComps; + } + if (srcAlpha) { + q = tmpAlphaLine; + for (int x = 0; x < scaledHeight; ++x) { + *q++ = *alphaPtr; + alphaPtr += scaledWidth; + } + } + } + (this->*drawRowFunc)(&dd, tmpLine, tmpAlphaLine, + xMin, yMin + y, scaledHeight); + } + + gfree(tmpLine); + gfree(tmpAlphaLine); + if (freeScaledImage) { + gfree(scaledColor); + gfree(scaledAlpha); + } + } + //--- arbitrary transform } else { // estimate of size of scaled image @@ -6518,14 +6831,13 @@ ImageScaler *Splash::getImageScaler(GString *imageTag, GBool srcAlpha, GBool interpolate) { // Notes: // - // * If the scaled image width or height is greater than 2000, we - // don't cache it. + // * If the scaled image is more than 8 Mpixels, we don't cache it. // // * Caching is done on the third consecutive use (second // consecutive reuse) of an image; this avoids overhead on the // common case of single-use images. - if (scaledWidth < 2000 && scaledHeight < 2000 && + if (scaledWidth < 8000000 / scaledHeight && imageCache->match(imageTag, scaledWidth, scaledHeight, srcMode, srcAlpha, interpolate)) { if (imageCache->colorData) { @@ -6570,13 +6882,12 @@ void Splash::getScaledImage(GString *imageTag, GBool *freeScaledImage) { // Notes: // - // * If the scaled image width or height is greater than 2000, we - // don't cache it. + // * If the scaled image is more than 8 Mpixels, we don't cache it. // // * This buffers the whole image anyway, so there's no reason to // skip caching on the first reuse. - if (scaledWidth >= 2000 || scaledHeight >= 2000) { + if (scaledWidth >= 8000000 / scaledHeight) { int lineSize; if (scaledWidth < INT_MAX / nComps) { lineSize = scaledWidth * nComps; diff --git a/Build/source/libs/xpdf/xpdf-src/splash/Splash.h b/Build/source/libs/xpdf/xpdf-src/splash/Splash.h index d6cc33a5fad..9622b07fc27 100644 --- a/Build/source/libs/xpdf/xpdf-src/splash/Splash.h +++ b/Build/source/libs/xpdf/xpdf-src/splash/Splash.h @@ -182,12 +182,13 @@ public: SplashCoord x1, SplashCoord y1); // NB: uses untransformed coordinates. SplashError clipToPath(SplashPath *path, GBool eo); - void setSoftMask(SplashBitmap *softMask); + void setSoftMask(SplashBitmap *softMask, GBool deleteBitmap = gTrue); void setInTransparencyGroup(SplashBitmap *groupBackBitmapA, int groupBackXA, int groupBackYA, SplashGroupDestInitMode groupDestInitModeA, GBool nonIsolated, GBool knockout); void forceDeferredInit(int y, int h); + GBool checkTransparentRect(int x, int y, int w, int h); void setTransfer(Guchar *red, Guchar *green, Guchar *blue, Guchar *gray); void setOverprintMask(Guint overprintMask); void setEnablePathSimplification(GBool en); @@ -228,11 +229,15 @@ public: // [x' y' 1] = [x y 1] * mat // Note that the Splash y axis points downward, and the image source // is assumed to produce pixels in raster order, starting from the - // top line. + // top line. If [interpolate] is false, no filtering is done when + // upsampling. If [antialias] is false, no filtering is done when + // upsampling (overriding the [interpolate] flag), and threshold + // filtering is done when downsampling. SplashError fillImageMask(GString *imageTag, SplashImageMaskSource src, void *srcData, int w, int h, SplashCoord *mat, - GBool glyphMode, GBool interpolate); + GBool glyphMode, GBool interpolate, + GBool antialias); // Draw an image. This will read lines of pixels from // , starting with the top line. These pixels are assumed to diff --git a/Build/source/libs/xpdf/xpdf-src/splash/SplashState.cc b/Build/source/libs/xpdf/xpdf-src/splash/SplashState.cc index 74421c48a4a..7fc510439b1 100644 --- a/Build/source/libs/xpdf/xpdf-src/splash/SplashState.cc +++ b/Build/source/libs/xpdf/xpdf-src/splash/SplashState.cc @@ -63,6 +63,21 @@ SplashState::SplashState(int width, int height, GBool vectorAntialias, deleteSoftMask = gFalse; inNonIsolatedGroup = gFalse; inKnockoutGroup = gFalse; +#if SPLASH_CMYK + rgbTransferR = (Guchar *)gmalloc(8 * 256); + rgbTransferG = rgbTransferR + 256; + rgbTransferB = rgbTransferG + 256; + grayTransfer = rgbTransferB + 256; + cmykTransferC = grayTransfer + 256; + cmykTransferM = cmykTransferC + 256; + cmykTransferY = cmykTransferM + 256; + cmykTransferK = cmykTransferY + 256; +#else + rgbTransferR = (Guchar *)gmalloc(4 * 256); + rgbTransferG = rgbTransferR + 256; + rgbTransferB = rgbTransferG + 256; + grayTransfer = rgbTransferB + 256; +#endif for (i = 0; i < 256; ++i) { rgbTransferR[i] = (Guchar)i; rgbTransferG[i] = (Guchar)i; @@ -75,6 +90,7 @@ SplashState::SplashState(int width, int height, GBool vectorAntialias, cmykTransferK[i] = (Guchar)i; #endif } + transferIsShared = gFalse; overprintMask = 0xffffffff; enablePathSimplification = gFalse; next = NULL; @@ -110,6 +126,21 @@ SplashState::SplashState(int width, int height, GBool vectorAntialias, deleteSoftMask = gFalse; inNonIsolatedGroup = gFalse; inKnockoutGroup = gFalse; +#if SPLASH_CMYK + rgbTransferR = (Guchar *)gmalloc(8 * 256); + rgbTransferG = rgbTransferR + 256; + rgbTransferB = rgbTransferG + 256; + grayTransfer = rgbTransferB + 256; + cmykTransferC = grayTransfer + 256; + cmykTransferM = cmykTransferC + 256; + cmykTransferY = cmykTransferM + 256; + cmykTransferK = cmykTransferY + 256; +#else + rgbTransferR = (Guchar *)gmalloc(4 * 256); + rgbTransferG = rgbTransferR + 256; + rgbTransferB = rgbTransferG + 256; + grayTransfer = rgbTransferB + 256; +#endif for (i = 0; i < 256; ++i) { rgbTransferR[i] = (Guchar)i; rgbTransferG[i] = (Guchar)i; @@ -122,6 +153,7 @@ SplashState::SplashState(int width, int height, GBool vectorAntialias, cmykTransferK[i] = (Guchar)i; #endif } + transferIsShared = gFalse; overprintMask = 0xffffffff; enablePathSimplification = gFalse; next = NULL; @@ -156,16 +188,17 @@ SplashState::SplashState(SplashState *state) { deleteSoftMask = gFalse; inNonIsolatedGroup = state->inNonIsolatedGroup; inKnockoutGroup = state->inKnockoutGroup; - memcpy(rgbTransferR, state->rgbTransferR, 256); - memcpy(rgbTransferG, state->rgbTransferG, 256); - memcpy(rgbTransferB, state->rgbTransferB, 256); - memcpy(grayTransfer, state->grayTransfer, 256); + rgbTransferR = state->rgbTransferR; + rgbTransferG = state->rgbTransferG; + rgbTransferB = state->rgbTransferB; + grayTransfer = state->grayTransfer; #if SPLASH_CMYK - memcpy(cmykTransferC, state->cmykTransferC, 256); - memcpy(cmykTransferM, state->cmykTransferM, 256); - memcpy(cmykTransferY, state->cmykTransferY, 256); - memcpy(cmykTransferK, state->cmykTransferK, 256); + cmykTransferC = state->cmykTransferC; + cmykTransferM = state->cmykTransferM; + cmykTransferY = state->cmykTransferY; + cmykTransferK = state->cmykTransferK; #endif + transferIsShared = gTrue; overprintMask = state->overprintMask; enablePathSimplification = state->enablePathSimplification; next = NULL; @@ -179,6 +212,9 @@ SplashState::~SplashState() { if (!clipIsShared) { delete clip; } + if (!transferIsShared) { + gfree(rgbTransferR); + } if (deleteSoftMask && softMask) { delete softMask; } @@ -265,12 +301,12 @@ SplashError SplashState::clipToPath(SplashPath *path, GBool eo) { enablePathSimplification, strokeAdjust); } -void SplashState::setSoftMask(SplashBitmap *softMaskA) { +void SplashState::setSoftMask(SplashBitmap *softMaskA, GBool deleteBitmap) { if (deleteSoftMask) { delete softMask; } softMask = softMaskA; - deleteSoftMask = gTrue; + deleteSoftMask = deleteBitmap; } void SplashState::setTransfer(Guchar *red, Guchar *green, Guchar *blue, @@ -279,6 +315,24 @@ void SplashState::setTransfer(Guchar *red, Guchar *green, Guchar *blue, int i; #endif + if (transferIsShared) { +#if SPLASH_CMYK + rgbTransferR = (Guchar *)gmalloc(8 * 256); + rgbTransferG = rgbTransferR + 256; + rgbTransferB = rgbTransferG + 256; + grayTransfer = rgbTransferB + 256; + cmykTransferC = grayTransfer + 256; + cmykTransferM = cmykTransferC + 256; + cmykTransferY = cmykTransferM + 256; + cmykTransferK = cmykTransferY + 256; +#else + rgbTransferR = (Guchar *)gmalloc(4 * 256); + rgbTransferG = rgbTransferR + 256; + rgbTransferB = rgbTransferG + 256; + grayTransfer = rgbTransferB + 256; +#endif + transferIsShared = gFalse; + } memcpy(rgbTransferR, red, 256); memcpy(rgbTransferG, green, 256); memcpy(rgbTransferB, blue, 256); diff --git a/Build/source/libs/xpdf/xpdf-src/splash/SplashState.h b/Build/source/libs/xpdf/xpdf-src/splash/SplashState.h index 38cb1188e94..be64b472333 100644 --- a/Build/source/libs/xpdf/xpdf-src/splash/SplashState.h +++ b/Build/source/libs/xpdf/xpdf-src/splash/SplashState.h @@ -81,7 +81,7 @@ public: SplashError clipToPath(SplashPath *path, GBool eo); // Set the soft mask bitmap. - void setSoftMask(SplashBitmap *softMaskA); + void setSoftMask(SplashBitmap *softMaskA, GBool deleteBitmap = gTrue); // Set the transfer function. void setTransfer(Guchar *red, Guchar *green, Guchar *blue, Guchar *gray); @@ -113,16 +113,17 @@ private: GBool deleteSoftMask; GBool inNonIsolatedGroup; GBool inKnockoutGroup; - Guchar rgbTransferR[256], - rgbTransferG[256], - rgbTransferB[256]; - Guchar grayTransfer[256]; + Guchar *rgbTransferR; + Guchar *rgbTransferG; + Guchar *rgbTransferB; + Guchar *grayTransfer; #if SPLASH_CMYK - Guchar cmykTransferC[256], - cmykTransferM[256], - cmykTransferY[256], - cmykTransferK[256]; + Guchar *cmykTransferC; + Guchar *cmykTransferM; + Guchar *cmykTransferY; + Guchar *cmykTransferK; #endif + GBool transferIsShared; Guint overprintMask; GBool enablePathSimplification; diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/AcroForm.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/AcroForm.cc index b98ca2f0189..7b2b9855669 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/AcroForm.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/AcroForm.cc @@ -18,6 +18,7 @@ #include "gmempp.h" #include "GString.h" #include "GList.h" +#include "GlobalParams.h" #include "Error.h" #include "Object.h" #include "PDFDoc.h" @@ -348,13 +349,15 @@ AcroForm *AcroForm::load(PDFDoc *docA, Catalog *catalog, Object *acroFormObjA) { if (acroFormObjA->isDict()) { acroForm = new AcroForm(docA, acroFormObjA); - if (!acroFormObjA->dictLookup("XFA", &xfaObj)->isNull()) { - acroForm->xfaScanner = XFAScanner::load(&xfaObj); - if (!catalog->getNeedsRendering()) { - acroForm->isStaticXFA = gTrue; + if (globalParams->getEnableXFA()) { + if (!acroFormObjA->dictLookup("XFA", &xfaObj)->isNull()) { + acroForm->xfaScanner = XFAScanner::load(&xfaObj); + if (!catalog->getNeedsRendering()) { + acroForm->isStaticXFA = gTrue; + } } + xfaObj.free(); } - xfaObj.free(); if (acroFormObjA->dictLookup("NeedAppearances", &obj1)->isBool()) { acroForm->needAppearances = obj1.getBool(); diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/Annot.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/Annot.cc index d7229a2fe86..82ef600be73 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/Annot.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/Annot.cc @@ -224,6 +224,11 @@ Annot::Annot(PDFDoc *docA, Dict *dict, Ref *refA) { } } obj1.free(); + // Acrobat ignores borders with unreasonable widths + if (borderWidth > 1 && (borderWidth > xMax - xMin || + borderWidth > yMax - yMin)) { + borderWidth = 0; + } if (dict->lookup("C", &obj1)->isArray() && (obj1.arrayGetLength() == 1 || obj1.arrayGetLength() == 3 || diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/CMakeLists.txt b/Build/source/libs/xpdf/xpdf-src/xpdf/CMakeLists.txt index 7b515d1d036..63a8dec2875 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/CMakeLists.txt +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/CMakeLists.txt @@ -23,6 +23,11 @@ if (HAVE_LCMS) else () set(COLOR_MANAGER_SOURCE "") endif () +if (WIN32) + set(MANIFEST "winLongPath.exe.manifest") +else () + set(MANIFEST "") +endif () add_library(xpdf_objs OBJECT AcroForm.cc @@ -70,10 +75,12 @@ add_library(xpdf_objs OBJECT XRef.cc Zoox.cc ) +set_property(TARGET xpdf_objs + PROPERTY POSITION_INDEPENDENT_CODE True) #--- object files needed by XpdfWidget -if ((QT4_FOUND OR Qt5Widgets_FOUND) +if ((QT4_FOUND OR Qt5Widgets_FOUND OR Qt6Widgets_FOUND) AND HAVE_SPLASH AND MULTITHREADED AND USE_EXCEPTIONS) if (HIGHLIGHTED_REGIONS) @@ -95,6 +102,8 @@ if ((QT4_FOUND OR Qt5Widgets_FOUND) TileMap.cc ${HIGHLIGHT_SRC} ) + set_property(TARGET xpdf_widget_objs + PROPERTY POSITION_INDEPENDENT_CODE True) endif () #--- pdftops @@ -107,6 +116,7 @@ if (HAVE_SPLASH) ShadingImage.cc SplashOutputDev.cc pdftops.cc + ${MANIFEST} ) target_link_libraries(pdftops goo fofi splash ${PAPER_LIBRARY} @@ -121,6 +131,7 @@ else () PreScanOutputDev.cc PSOutputDev.cc pdftops.cc + ${MANIFEST} ) target_link_libraries(pdftops goo fofi ${PAPER_LIBRARY} @@ -137,6 +148,7 @@ add_executable(pdftotext $ TextOutputDev.cc pdftotext.cc + ${MANIFEST} ) target_link_libraries(pdftotext goo fofi ${PAPER_LIBRARY} @@ -157,6 +169,7 @@ if (HAVE_SPLASH AND PNG_FOUND) TextOutputDev.cc WebFont.cc pdftohtml.cc + ${MANIFEST} ) target_link_libraries(pdftohtml goo fofi splash ${PAPER_LIBRARY} @@ -175,6 +188,7 @@ endif () add_executable(pdfinfo $ pdfinfo.cc + ${MANIFEST} ) target_link_libraries(pdfinfo goo fofi ${PAPER_LIBRARY} @@ -189,6 +203,7 @@ install(FILES ${PROJECT_SOURCE_DIR}/doc/pdfinfo.1 DESTINATION ${CMAKE_INSTALL_MA add_executable(pdffonts $ pdffonts.cc + ${MANIFEST} ) target_link_libraries(pdffonts goo fofi ${PAPER_LIBRARY} @@ -203,6 +218,7 @@ install(FILES ${PROJECT_SOURCE_DIR}/doc/pdffonts.1 DESTINATION ${CMAKE_INSTALL_M add_executable(pdfdetach $ pdfdetach.cc + ${MANIFEST} ) target_link_libraries(pdfdetach goo fofi ${PAPER_LIBRARY} @@ -220,6 +236,7 @@ if (HAVE_SPLASH) ShadingImage.cc SplashOutputDev.cc pdftoppm.cc + ${MANIFEST} ) target_link_libraries(pdftoppm goo fofi splash ${PAPER_LIBRARY} @@ -240,6 +257,7 @@ if (HAVE_SPLASH AND PNG_FOUND) ShadingImage.cc SplashOutputDev.cc pdftopng.cc + ${MANIFEST} ) target_link_libraries(pdftopng goo fofi splash ${PAPER_LIBRARY} @@ -259,6 +277,7 @@ add_executable(pdfimages $ ImageOutputDev.cc pdfimages.cc + ${MANIFEST} ) target_link_libraries(pdfimages goo fofi ${PAPER_LIBRARY} diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/Catalog.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/Catalog.cc index 6ea8fa89ff4..ddcbad55f07 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/Catalog.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/Catalog.cc @@ -623,7 +623,7 @@ void Catalog::loadPage2(int pg, int relPg, PageTreeNode *node) { // merge the PageAttrs attrs = new PageAttrs(node->parent ? node->parent->attrs : (PageAttrs *)NULL, - pageObj.getDict()); + pageObj.getDict(), xref); // if "Kids" exists, it's an internal node if (pageObj.dictLookup("Kids", &kidsObj)->isArray()) { diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/CharCodeToUnicode.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/CharCodeToUnicode.cc index 5eec7a9fc6c..0a2100fde9b 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/CharCodeToUnicode.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/CharCodeToUnicode.cc @@ -232,6 +232,10 @@ CharCodeToUnicode *CharCodeToUnicode::make8BitToUnicode(Unicode *toUnicode) { return new CharCodeToUnicode(NULL, toUnicode, 256, gTrue, NULL, 0, 0); } +CharCodeToUnicode *CharCodeToUnicode::make16BitToUnicode(Unicode *toUnicode) { + return new CharCodeToUnicode(NULL, toUnicode, 65536, gTrue, NULL, 0, 0); +} + CharCodeToUnicode *CharCodeToUnicode::parseCMap(GString *buf, int nBits) { CharCodeToUnicode *ctu; GStringIndex idx; @@ -470,24 +474,17 @@ GBool CharCodeToUnicode::parseCMap1(int (*getCharFunc)(void *), void *data, void CharCodeToUnicode::addMapping(CharCode code, char *uStr, int n, int offset) { CharCode oldLen, i; -#if 1 //~utf16 Unicode u[maxUnicodeString]; int uLen, j; -#else - Unicode u; - int j; -#endif if (code > 0xffffff) { // This is an arbitrary limit to avoid integer overflow issues. // (I've seen CMaps with mappings for .) return; } -#if 1 //~utf16 if ((uLen = parseUTF16String(uStr, n, u)) == 0) { return; } -#endif if (code >= mapLen) { oldLen = mapLen; mapLen = mapLen ? 2 * mapLen : 256; @@ -499,7 +496,6 @@ void CharCodeToUnicode::addMapping(CharCode code, char *uStr, int n, map[i] = 0; } } -#if 1 //~utf16 if (uLen == 1) { map[code] = u[0] + offset; } else { @@ -517,34 +513,6 @@ void CharCodeToUnicode::addMapping(CharCode code, char *uStr, int n, sMap[sMapLen].len = uLen; ++sMapLen; } -#else //~utf16 - if (n <= 4) { - if (!parseHex(uStr, n, &u)) { - error(errSyntaxWarning, -1, "Illegal entry in ToUnicode CMap"); - return; - } - map[code] = u + offset; - } else { - if (sMapLen >= sMapSize) { - sMapSize = sMapSize + 16; - sMap = (CharCodeToUnicodeString *) - greallocn(sMap, sMapSize, sizeof(CharCodeToUnicodeString)); - } - map[code] = 0; - sMap[sMapLen].c = code; - if ((sMap[sMapLen].len = n / 4) > maxUnicodeString) { - sMap[sMapLen].len = maxUnicodeString; - } - for (j = 0; j < sMap[sMapLen].len; ++j) { - if (!parseHex(uStr + j*4, 4, &sMap[sMapLen].u[j])) { - error(errSyntaxWarning, -1, "Illegal entry in ToUnicode CMap"); - return; - } - } - sMap[sMapLen].u[sMap[sMapLen].len - 1] += offset; - ++sMapLen; - } -#endif //~utf16 } // Convert a UTF-16BE hex string into a sequence of up to diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/CharCodeToUnicode.h b/Build/source/libs/xpdf/xpdf-src/xpdf/CharCodeToUnicode.h index c390a8c5c50..be9025107aa 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/CharCodeToUnicode.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/CharCodeToUnicode.h @@ -49,6 +49,11 @@ public: // reference count to 1. static CharCodeToUnicode *make8BitToUnicode(Unicode *toUnicode); + // Create the CharCode-to-Unicode mapping for a 16-bit font. + // is an array of 65536 Unicode indexes. Sets the + // initial reference count to 1. + static CharCodeToUnicode *make16BitToUnicode(Unicode *toUnicode); + // Parse a ToUnicode CMap for an 8- or 16-bit font. static CharCodeToUnicode *parseCMap(GString *buf, int nBits); diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/Gfx.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/Gfx.cc index ed98d9d165f..1539b8404bc 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/Gfx.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/Gfx.cc @@ -527,6 +527,7 @@ Gfx::Gfx(PDFDoc *docA, OutputDev *outA, int pageNum, Dict *resDict, xref = doc->getXRef(); subPage = gFalse; printCommands = globalParams->getPrintCommands(); + defaultFont = NULL; // start the resource stack res = new GfxResources(xref, resDict, NULL); @@ -574,6 +575,7 @@ Gfx::Gfx(PDFDoc *docA, OutputDev *outA, Dict *resDict, xref = doc->getXRef(); subPage = gTrue; printCommands = globalParams->getPrintCommands(); + defaultFont = NULL; // start the resource stack res = new GfxResources(xref, resDict, NULL); @@ -609,6 +611,9 @@ Gfx::Gfx(PDFDoc *docA, OutputDev *outA, Dict *resDict, } Gfx::~Gfx() { + if (defaultFont) { + delete defaultFont; + } if (!subPage) { out->endPage(); } @@ -2080,12 +2085,19 @@ void Gfx::doTilingPatternFill(GfxTilingPattern *tPat, // Adobe's behavior state->setFillPattern(NULL); state->setStrokePattern(NULL); + state->setFillOverprint(gFalse); + state->setStrokeOverprint(gFalse); + state->setOverprintMode(0); if (tPat->getPaintType() == 2 && (cs = patCS->getUnder())) { state->setFillColorSpace(cs->copy()); out->updateFillColorSpace(state); state->setStrokeColorSpace(cs->copy()); out->updateStrokeColorSpace(state); - state->setStrokeColor(state->getFillColor()); + if (stroke) { + state->setFillColor(state->getStrokeColor()); + } else { + state->setStrokeColor(state->getFillColor()); + } out->updateFillColor(state); out->updateStrokeColor(state); state->setIgnoreColorOps(gTrue); @@ -3564,8 +3576,10 @@ void Gfx::opSetFont(Object args[], int numArgs) { void Gfx::doSetFont(GfxFont *font, double size) { if (!font) { - state->setFont(NULL, 0); - return; + if (!defaultFont) { + defaultFont = GfxFont::makeDefaultFont(xref); + } + font = defaultFont; } if (printCommands) { printf(" font: tag=%s name='%s' %g\n", @@ -3847,7 +3861,7 @@ void Gfx::doShowText(GString *s) { newCTM[2] *= state->getFontSize(); newCTM[3] *= state->getFontSize(); newCTM[0] *= state->getHorizScaling(); - newCTM[2] *= state->getHorizScaling(); + newCTM[1] *= state->getHorizScaling(); curX = state->getCurX(); curY = state->getCurY(); oldParser = parser; @@ -4035,7 +4049,7 @@ void Gfx::doIncCharCount(GString *s) { void Gfx::opXObject(Object args[], int numArgs) { char *name; - Object obj1, obj2, obj3, refObj; + Object xObj, refObj, obj2, obj3; GBool ocSaved, oc; #if OPI_SUPPORT Object opiDict; @@ -4045,18 +4059,31 @@ void Gfx::opXObject(Object args[], int numArgs) { return; } name = args[0].getName(); - if (!res->lookupXObject(name, &obj1)) { + // NB: we get both the reference and the object here, to make sure + // they refer to the same object. There's a problematic corner + // case: if the resource dict contains an entry for [name] with a + // reference to a nonexistent object ("/name 99999 0 R", where + // object 99999 doesn't exist), and a parent resource dict contains + // a valid entry with the same name, then lookupXObjectNF() will + // return "99999 0 R", but lookupXObject() will return the valid + // entry. This causes problems for doImage() and doForm(). + if (!res->lookupXObjectNF(name, &refObj)) { + return; + } + if (!refObj.fetch(xref, &xObj)) { + refObj.free(); return; } - if (!obj1.isStream()) { + if (!xObj.isStream()) { error(errSyntaxError, getPos(), "XObject '{0:s}' is wrong type", name); - obj1.free(); + xObj.free(); + refObj.free(); return; } // check for optional content key ocSaved = ocState; - obj1.streamGetDict()->lookupNF("OC", &obj2); + xObj.streamGetDict()->lookupNF("OC", &obj2); if (doc->getOptionalContent()->evalOCObject(&obj2, &oc)) { ocState &= oc; } @@ -4066,32 +4093,28 @@ void Gfx::opXObject(Object args[], int numArgs) { try { #endif #if OPI_SUPPORT - obj1.streamGetDict()->lookup("OPI", &opiDict); + xObj.streamGetDict()->lookup("OPI", &opiDict); if (opiDict.isDict()) { out->opiBegin(state, opiDict.getDict()); } #endif - obj1.streamGetDict()->lookup("Subtype", &obj2); + xObj.streamGetDict()->lookup("Subtype", &obj2); if (obj2.isName("Image")) { if (out->needNonText()) { - res->lookupXObjectNF(name, &refObj); - doImage(&refObj, obj1.getStream(), gFalse); - refObj.free(); + doImage(&refObj, xObj.getStream(), gFalse); } } else if (obj2.isName("Form")) { - res->lookupXObjectNF(name, &refObj); if (out->useDrawForm() && refObj.isRef()) { if (ocState) { out->drawForm(refObj.getRef()); } } else { - doForm(&refObj, &obj1); + doForm(&refObj, &xObj); } - refObj.free(); } else if (obj2.isName("PS")) { if (ocState) { - obj1.streamGetDict()->lookup("Level1", &obj3); - out->psXObject(obj1.getStream(), + xObj.streamGetDict()->lookup("Level1", &obj3); + out->psXObject(xObj.getStream(), obj3.isStream() ? obj3.getStream() : (Stream *)NULL); } } else if (obj2.isName()) { @@ -4110,13 +4133,16 @@ void Gfx::opXObject(Object args[], int numArgs) { #endif #if USE_EXCEPTIONS } catch (GMemException e) { - obj1.free(); + xObj.free(); + refObj.free(); throw; } #endif - obj1.free(); ocState = ocSaved; + + xObj.free(); + refObj.free(); } GBool Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) { @@ -4144,6 +4170,10 @@ GBool Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) { return gTrue; } + // images can have arbitrarily high compression ratios, but the + // data size is inherently limited + str->disableDecompressionBombChecking(); + // get info from the stream bits = 0; csMode = streamCSNone; @@ -4248,6 +4278,7 @@ GBool Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) { // if drawing is disabled, skip over inline image data if (!ocState) { + str->disableDecompressionBombChecking(); str->reset(); n = height * ((width + 7) / 8); for (i = 0; i < n; ++i) { @@ -4339,6 +4370,7 @@ GBool Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) { goto err1; } maskStr = smaskObj.getStream(); + maskStr->disableDecompressionBombChecking(); maskDict = smaskObj.streamGetDict(); maskDict->lookup("Width", &obj1); if (obj1.isNull()) { @@ -4487,6 +4519,7 @@ GBool Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) { goto err1; } maskStr = maskObj.getStream(); + maskStr->disableDecompressionBombChecking(); maskDict = maskObj.streamGetDict(); maskDict->lookup("Width", &obj1); if (obj1.isNull()) { @@ -4559,6 +4592,7 @@ GBool Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) { " in uncolored Type 3 char or tiling pattern"); } if (inlineImg) { + str->disableDecompressionBombChecking(); str->reset(); n = height * ((width * colorMap->getNumPixelComps() * colorMap->getBits() + 7) / 8); @@ -4569,7 +4603,7 @@ GBool Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) { // draw it } else { if (haveSoftMask) { - dict->lookupNF("Mask", &maskRef); + dict->lookupNF("SMask", &maskRef); out->drawSoftMaskedImage(state, ref, str, width, height, colorMap, &maskRef, maskStr, maskWidth, maskHeight, maskColorMap, @@ -4654,13 +4688,18 @@ void Gfx::doForm(Object *strRef, Object *str) { // get bounding box dict->lookup("BBox", &bboxObj); - if (!bboxObj.isArray()) { + if (!(bboxObj.isArray() && bboxObj.arrayGetLength() == 4)) { bboxObj.free(); error(errSyntaxError, getPos(), "Bad form bounding box"); return; } for (i = 0; i < 4; ++i) { bboxObj.arrayGet(i, &obj1); + if (!obj1.isNum()) { + bboxObj.free(); + error(errSyntaxError, getPos(), "Bad form bounding box"); + return; + } bbox[i] = obj1.getNum(); obj1.free(); } @@ -4668,10 +4707,14 @@ void Gfx::doForm(Object *strRef, Object *str) { // get matrix dict->lookup("Matrix", &matrixObj); - if (matrixObj.isArray()) { + if (matrixObj.isArray() && matrixObj.arrayGetLength() == 6) { for (i = 0; i < 6; ++i) { matrixObj.arrayGet(i, &obj1); - m[i] = obj1.getNum(); + if (obj1.isNum()) { + m[i] = obj1.getNum(); + } else { + m[i] = 0; + } obj1.free(); } } else { @@ -4769,22 +4812,27 @@ void Gfx::drawForm(Object *strRef, Dict *resDict, groupAttrsObj.free(); strObj.free(); - traceBegin(oldBaseMatrix, softMask ? "begin soft mask" : "begin t-group"); - if (state->getBlendMode() != gfxBlendNormal) { - state->setBlendMode(gfxBlendNormal); - out->updateBlendMode(state); - } - if (state->getFillOpacity() != 1) { - state->setFillOpacity(1); - out->updateFillOpacity(state); + if (!out->beginTransparencyGroup(state, bbox, blendingColorSpace, + isolated, knockout, softMask)) { + transpGroup = gFalse; } - if (state->getStrokeOpacity() != 1) { - state->setStrokeOpacity(1); - out->updateStrokeOpacity(state); + + if (softMask || transpGroup) { + traceBegin(oldBaseMatrix, softMask ? "begin soft mask" : "begin t-group"); + if (state->getBlendMode() != gfxBlendNormal) { + state->setBlendMode(gfxBlendNormal); + out->updateBlendMode(state); + } + if (state->getFillOpacity() != 1) { + state->setFillOpacity(1); + out->updateFillOpacity(state); + } + if (state->getStrokeOpacity() != 1) { + state->setStrokeOpacity(1); + out->updateStrokeOpacity(state); + } + out->clearSoftMask(state); } - out->clearSoftMask(state); - out->beginTransparencyGroup(state, bbox, blendingColorSpace, - isolated, knockout, softMask); } // set new base matrix diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/Gfx.h b/Build/source/libs/xpdf/xpdf-src/xpdf/Gfx.h index 4625ac289d0..14d7a608438 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/Gfx.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/Gfx.h @@ -188,6 +188,7 @@ private: GBool subPage; // is this a sub-page object? GBool printCommands; // print the drawing commands (for debugging) GfxResources *res; // resource stack + GfxFont *defaultFont; // font substituted for undefined fonts int opCounter; // operation counter (used to decide when // to check for an abort) diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/GfxFont.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/GfxFont.cc index f224ff75b5f..30e8bd1c79c 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/GfxFont.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/GfxFont.cc @@ -198,6 +198,27 @@ GfxFont *GfxFont::makeFont(XRef *xref, const char *tagA, return font; } +GfxFont *GfxFont::makeDefaultFont(XRef *xref) { + Object type, subtype, baseFont; + type.initName("Font"); + subtype.initName("Type1"); + baseFont.initName("Helvetica"); + Object fontDict; + fontDict.initDict(xref); + fontDict.dictAdd(copyString("Type"), &type); + fontDict.dictAdd(copyString("Subtype"), &subtype); + fontDict.dictAdd(copyString("BaseFont"), &baseFont); + + Ref r; + r.gen = 100000; + r.num = GfxFontDict::hashFontObject(&fontDict); + + GfxFont *font = makeFont(xref, "undef", r, fontDict.getDict()); + fontDict.free(); + + return font; +} + GfxFont::GfxFont(const char *tagA, Ref idA, GString *nameA, GfxFontType typeA, Ref embFontIDA) { ok = gFalse; @@ -1701,9 +1722,59 @@ GfxCIDFont::GfxCIDFont(XRef *xref, const char *tagA, Ref idA, GString *nameA, obj2.free(); obj1.free(); + // encoding (i.e., CMap) + if (fontDict->lookup("Encoding", &obj1)->isNull()) { + error(errSyntaxError, -1, "Missing Encoding entry in Type 0 font"); + goto err2; + } + if (!(cMap = CMap::parse(NULL, collection, &obj1))) { + goto err2; + } + + // check for fonts that use the Identity-H encoding (cmap), and the + // Adobe-Identity character collection + identityEnc = obj1.isName("Identity-H") && + !collection->cmp("Adobe-Identity"); + + obj1.free(); + + // CIDToGIDMap + // (the PDF 1.7 spec only allows these for TrueType fonts, but + // Acrobat apparently also allows them for OpenType CFF fonts -- and + // the PDF 2.0 spec has removed the prohibition) + hasIdentityCIDToGID = gFalse; + desFontDict->lookup("CIDToGIDMap", &obj1); + if (obj1.isStream()) { + cidToGIDLen = 0; + i = 64; + cidToGID = (int *)gmallocn(i, sizeof(int)); + obj1.streamReset(); + while ((c1 = obj1.streamGetChar()) != EOF && + (c2 = obj1.streamGetChar()) != EOF) { + if (cidToGIDLen == i) { + i *= 2; + cidToGID = (int *)greallocn(cidToGID, i, sizeof(int)); + } + cidToGID[cidToGIDLen++] = (c1 << 8) + c2; + } + obj1.streamClose(); + identityEnc = gFalse; + } else if (obj1.isName("Identity")) { + hasIdentityCIDToGID = gTrue; + } else if (!obj1.isNull()) { + error(errSyntaxError, -1, "Invalid CIDToGIDMap entry in CID font"); + } + obj1.free(); + // look for a ToUnicode CMap hasKnownCollection = gFalse; - if (!(ctu = readToUnicodeCMap(fontDict, 16, NULL))) { + if (globalParams->getUseTrueTypeUnicodeMapping()) { + readTrueTypeUnicodeMapping(xref); + } + if (!ctu) { + ctu = readToUnicodeCMap(fontDict, 16, NULL); + } + if (!ctu) { ctuUsesCharCode = gFalse; // use an identity mapping for the "Adobe-Identity" and @@ -1748,55 +1819,11 @@ GfxCIDFont::GfxCIDFont(XRef *xref, const char *tagA, Ref idA, GString *nameA, } } - // encoding (i.e., CMap) - if (fontDict->lookup("Encoding", &obj1)->isNull()) { - error(errSyntaxError, -1, "Missing Encoding entry in Type 0 font"); - goto err2; - } - if (!(cMap = CMap::parse(NULL, collection, &obj1))) { - goto err2; - } - - // check for fonts that use the Identity-H encoding (cmap), and the - // Adobe-Identity character collection - identityEnc = obj1.isName("Identity-H") && - !collection->cmp("Adobe-Identity"); - - obj1.free(); - - // CIDToGIDMap - // (the PDF 1.7 spec only allows these for TrueType fonts, but - // Acrobat apparently also allows them for OpenType CFF fonts -- and - // the PDF 2.0 spec has removed the prohibition) - hasIdentityCIDToGID = gFalse; - desFontDict->lookup("CIDToGIDMap", &obj1); - if (obj1.isStream()) { - cidToGIDLen = 0; - i = 64; - cidToGID = (int *)gmallocn(i, sizeof(int)); - obj1.streamReset(); - while ((c1 = obj1.streamGetChar()) != EOF && - (c2 = obj1.streamGetChar()) != EOF) { - if (cidToGIDLen == i) { - i *= 2; - cidToGID = (int *)greallocn(cidToGID, i, sizeof(int)); - } - cidToGID[cidToGIDLen++] = (c1 << 8) + c2; - } - obj1.streamClose(); - identityEnc = gFalse; - } else if (obj1.isName("Identity")) { - hasIdentityCIDToGID = gTrue; - } else if (!obj1.isNull()) { - error(errSyntaxError, -1, "Invalid CIDToGIDMap entry in CID font"); - } - obj1.free(); - //----- character metrics ----- // default char width - if (desFontDict->lookup("DW", &obj1)->isInt()) { - widths.defWidth = obj1.getInt() * 0.001; + if (desFontDict->lookup("DW", &obj1)->isNum()) { + widths.defWidth = obj1.getNum() * 0.001; } obj1.free(); @@ -1968,6 +1995,91 @@ GfxCIDFont::~GfxCIDFont() { } } +// Construct a code-to-Unicode mapping, based on the TrueType Unicode +// cmap (if present). Constructs ctu if succesful; leaves ctu = null +// otherwise. Always leaves ctu = null for non-TrueType fonts. +void GfxCIDFont::readTrueTypeUnicodeMapping(XRef *xref) { + char *buf; + FoFiTrueType *ff; + Unicode *gidToUnicode, *codeToUnicode; + Unicode u; + int bufLen, cmapPlatform, cmapEncoding, unicodeCmap; + int nGlyphs, nMappings, gid, i; + + // must be an embedded TrueType font, with an unknown char collection + if ((type != fontCIDType2 && type == fontCIDType2OT) || + embFontID.num < 0 || + hasKnownCollection) { + goto err0; + } + + // read the embedded font and construct a FoFiTrueType + if (!(buf = readEmbFontFile(xref, &bufLen))) { + goto err0; + } + if (!(ff = FoFiTrueType::make(buf, bufLen, 0))) { + goto err1; + } + + // find the TrueType Unicode cmap + unicodeCmap = -1; + for (i = 0; i < ff->getNumCmaps(); ++i) { + cmapPlatform = ff->getCmapPlatform(i); + cmapEncoding = ff->getCmapEncoding(i); + if ((cmapPlatform == 3 && cmapEncoding == 1) || + (cmapPlatform == 0 && cmapEncoding <= 4)) { + unicodeCmap = i; + break; + } + } + if (unicodeCmap < 0) { + goto err2; + } + + // construct reverse GID-to-Unicode map + nGlyphs = ff->getNumGlyphs(); + gidToUnicode = (Unicode *)gmallocn(nGlyphs, sizeof(Unicode)); + memset(gidToUnicode, 0, nGlyphs * sizeof(Unicode)); + nMappings = 0; + for (u = 1; u <= 0xffff; ++u) { + gid = ff->mapCodeToGID(unicodeCmap, (int)u); + if (gid > 0 && gid < nGlyphs) { + gidToUnicode[gid] = u; + ++nMappings; + } + } + // bail out if the Unicode cmap was completely empty + if (nMappings == 0) { + goto err3; + } + + // construct code-to-Unicode map + codeToUnicode = (Unicode *)gmallocn(65536, sizeof(Unicode)); + memset(codeToUnicode, 0, 65536 * sizeof(Unicode)); + for (i = 0; i <= 0xffff; ++i) { + // we've already checked for an identity encoding, so CID = i + if (cidToGID && i < cidToGIDLen) { + gid = cidToGID[i]; + } else { + gid = i; + } + if (gid < nGlyphs && gidToUnicode[gid] > 0) { + codeToUnicode[i] = gidToUnicode[gid]; + } + } + ctu = CharCodeToUnicode::make16BitToUnicode(codeToUnicode); + + gfree(codeToUnicode); + err3: + gfree(gidToUnicode); + err2: + delete ff; + err1: + gfree(buf); + err0: + return; +} + int GfxCIDFont::getNextChar(char *s, int len, CharCode *code, Unicode *u, int uSize, int *uLen, double *dx, double *dy, double *ox, double *oy) { diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/GfxFont.h b/Build/source/libs/xpdf/xpdf-src/xpdf/GfxFont.h index ded34bc1ee7..e752ded62f8 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/GfxFont.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/GfxFont.h @@ -135,6 +135,10 @@ public: static GfxFont *makeFont(XRef *xref, const char *tagA, Ref idA, Dict *fontDict); + // Create a simple default font, to substitute for an undefined font + // object. + static GfxFont *makeDefaultFont(XRef *xref); + GfxFont(const char *tagA, Ref idA, GString *nameA, GfxFontType typeA, Ref embFontIDA); @@ -357,6 +361,7 @@ public: private: + void readTrueTypeUnicodeMapping(XRef *xref); void getHorizontalMetrics(CID cid, double *w); void getVerticalMetrics(CID cid, double *h, double *vx, double *vy); @@ -398,8 +403,10 @@ public: private: - int hashFontObject(Object *obj); - void hashFontObject1(Object *obj, FNVHash *h); + friend class GfxFont; + + static int hashFontObject(Object *obj); + static void hashFontObject1(Object *obj, FNVHash *h); GHash *fonts; // hash table of fonts -- this may // include duplicates, i.e., when diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/GfxState.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/GfxState.cc index 5e9991e1b97..43503aaedb8 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/GfxState.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/GfxState.cc @@ -2071,6 +2071,7 @@ GfxFunctionShading *GfxFunctionShading::parse(Dict *dict Function *funcsA[gfxColorMaxComps]; int nFuncsA; Object obj1, obj2; + GBool ok; int i; x0A = y0A = 0; @@ -2139,14 +2140,21 @@ GfxFunctionShading *GfxFunctionShading::parse(Dict *dict return NULL; } - for (i = 0; i < shading->nFuncs; ++i) { - if (shading->funcs[i]->getOutputSize() - != shading->getColorSpace()->getNComps()) { - error(errSyntaxError, -1, "Invalid function in shading dictionary"); - delete shading; - return NULL; + ok = gFalse; + if (shading->nFuncs == 1) { + ok = shading->funcs[0]->getOutputSize() + == shading->getColorSpace()->getNComps(); + } else if (shading->nFuncs == shading->getColorSpace()->getNComps()) { + ok = gTrue; + for (i = 0; i < shading->nFuncs; ++i) { + ok = ok && shading->funcs[i]->getOutputSize() == 1; } } + if (!ok) { + error(errSyntaxError, -1, "Invalid function in shading dictionary"); + delete shading; + return NULL; + } return shading; @@ -2241,7 +2249,7 @@ GfxAxialShading *GfxAxialShading::parse(Dict *dict double t0A, t1A; Function *funcsA[gfxColorMaxComps]; int nFuncsA; - GBool extend0A, extend1A; + GBool extend0A, extend1A, ok; Object obj1, obj2; int i; @@ -2319,14 +2327,21 @@ GfxAxialShading *GfxAxialShading::parse(Dict *dict return NULL; } - for (i = 0; i < shading->nFuncs; ++i) { - if (shading->funcs[i]->getOutputSize() - != shading->getColorSpace()->getNComps()) { - error(errSyntaxError, -1, "Invalid function in shading dictionary"); - delete shading; - return NULL; + ok = gFalse; + if (shading->nFuncs == 1) { + ok = shading->funcs[0]->getOutputSize() + == shading->getColorSpace()->getNComps(); + } else if (shading->nFuncs == shading->getColorSpace()->getNComps()) { + ok = gTrue; + for (i = 0; i < shading->nFuncs; ++i) { + ok = ok && shading->funcs[i]->getOutputSize() == 1; } } + if (!ok) { + error(errSyntaxError, -1, "Invalid function in shading dictionary"); + delete shading; + return NULL; + } return shading; @@ -2420,7 +2435,7 @@ GfxRadialShading *GfxRadialShading::parse(Dict *dict double t0A, t1A; Function *funcsA[gfxColorMaxComps]; int nFuncsA; - GBool extend0A, extend1A; + GBool extend0A, extend1A, ok; Object obj1, obj2; int i; @@ -2501,14 +2516,21 @@ GfxRadialShading *GfxRadialShading::parse(Dict *dict return NULL; } - for (i = 0; i < shading->nFuncs; ++i) { - if (shading->funcs[i]->getOutputSize() - != shading->getColorSpace()->getNComps()) { - error(errSyntaxError, -1, "Invalid function in shading dictionary"); - delete shading; - return NULL; + ok = gFalse; + if (shading->nFuncs == 1) { + ok = shading->funcs[0]->getOutputSize() + == shading->getColorSpace()->getNComps(); + } else if (shading->nFuncs == shading->getColorSpace()->getNComps()) { + ok = gTrue; + for (i = 0; i < shading->nFuncs; ++i) { + ok = ok && shading->funcs[i]->getOutputSize() == 1; } } + if (!ok) { + error(errSyntaxError, -1, "Invalid function in shading dictionary"); + delete shading; + return NULL; + } return shading; @@ -2675,6 +2697,7 @@ GfxGouraudTriangleShading *GfxGouraudTriangleShading::parse( Guint c[gfxColorMaxComps]; GfxShadingBitBuf *bitBuf; Object obj1, obj2; + GBool ok; int i, j, k, state; if (dict->lookup("BitsPerCoordinate", &obj1)->isInt()) { @@ -2883,14 +2906,23 @@ GfxGouraudTriangleShading *GfxGouraudTriangleShading::parse( return NULL; } - for (i = 0; i < shading->nFuncs; ++i) { - if (shading->funcs[i]->getOutputSize() - != shading->getColorSpace()->getNComps()) { - error(errSyntaxError, -1, "Invalid function in shading dictionary"); - delete shading; - return NULL; + ok = gFalse; + if (shading->nFuncs == 0) { + ok = shading->nComps == shading->getColorSpace()->getNComps(); + } else if (shading->nFuncs == 1) { + ok = shading->funcs[0]->getOutputSize() + == shading->getColorSpace()->getNComps(); + } else if (shading->nFuncs == shading->getColorSpace()->getNComps()) { + ok = gTrue; + for (i = 0; i < shading->nFuncs; ++i) { + ok = ok && shading->funcs[i]->getOutputSize() == 1; } } + if (!ok) { + error(errSyntaxError, -1, "Invalid function in shading dictionary"); + delete shading; + return NULL; + } return shading; @@ -3042,6 +3074,7 @@ GfxPatchMeshShading *GfxPatchMeshShading::parse(int typeA, Dict *dict, Guint ci; GfxShadingBitBuf *bitBuf; Object obj1, obj2; + GBool ok; int i, j; nPatchesA = 0; @@ -3555,14 +3588,23 @@ GfxPatchMeshShading *GfxPatchMeshShading::parse(int typeA, Dict *dict, return NULL; } - for (i = 0; i < shading->nFuncs; ++i) { - if (shading->funcs[i]->getOutputSize() - != shading->getColorSpace()->getNComps()) { - error(errSyntaxError, -1, "Invalid function in shading dictionary"); - delete shading; - return NULL; + ok = gFalse; + if (shading->nFuncs == 0) { + ok = shading->nComps == shading->getColorSpace()->getNComps(); + } else if (shading->nFuncs == 1) { + ok = shading->funcs[0]->getOutputSize() + == shading->getColorSpace()->getNComps(); + } else if (shading->nFuncs == shading->getColorSpace()->getNComps()) { + ok = gTrue; + for (i = 0; i < shading->nFuncs; ++i) { + ok = ok && shading->funcs[i]->getOutputSize() == 1; } } + if (!ok) { + error(errSyntaxError, -1, "Invalid function in shading dictionary"); + delete shading; + return NULL; + } return shading; @@ -4091,6 +4133,26 @@ GfxPath::GfxPath(GBool justMoved1, double firstX1, double firstY1, subpaths[i] = subpaths1[i]->copy(); } +double GfxPath::getCurX() { + if (justMoved) { + return firstX; + } else if (n > 0) { + return subpaths[n-1]->getLastX(); + } else { + return 0; + } +} + +double GfxPath::getCurY() { + if (justMoved) { + return firstY; + } else if (n > 0) { + return subpaths[n-1]->getLastY(); + } else { + return 0; + } +} + void GfxPath::moveTo(double x, double y) { justMoved = gTrue; firstX = x; @@ -4581,65 +4643,143 @@ void GfxState::clip() { } void GfxState::clipToStrokePath() { - double xMin, yMin, xMax, yMax, x, y, t0, t1; - GfxSubpath *subpath; - int i, j; - - xMin = xMax = yMin = yMax = 0; // make gcc happy - for (i = 0; i < path->getNumSubpaths(); ++i) { - subpath = path->getSubpath(i); - for (j = 0; j < subpath->getNumPoints(); ++j) { - transform(subpath->getX(j), subpath->getY(j), &x, &y); + // We compute the stroke path bbox in user space (line width and + // miter limt are handled in user space), and then transform the + // bbox to device space. This can result in a larger-than-needed + // bbox if the matrix isn't "square", but that's ok. + // + // There are two cases for each point on the path: + // (1) miter join, under miter limit => compute the miter point + // (2) all other joins and caps => use the path point +/- 0.5 * line width + double xMin = 0, yMin = 0, xMax = 0, yMax = 0; + double w = 0.5 * lineWidth; + for (int i = 0; i < path->getNumSubpaths(); ++i) { + GfxSubpath *subpath = path->getSubpath(i); + for (int j = 0; j < subpath->getNumPoints(); ++j) { + double x1 = subpath->getX(j); + double y1 = subpath->getY(j); if (i == 0 && j == 0) { - xMin = xMax = x; - yMin = yMax = y; - } else { - if (x < xMin) { - xMin = x; - } else if (x > xMax) { - xMax = x; + xMin = xMax = x1; + yMin = yMax = y1; + } + GBool useMiter = gFalse; + if (lineJoin == 0 && // miter join + ((j > 0 && j < subpath->getNumPoints() - 1) || subpath->isClosed())) { + double x0, y0, x2, y2; + if (j > 0) { + x0 = subpath->getX(j - 1); + y0 = subpath->getY(j - 1); + } else { + x0 = subpath->getLastX(); + y0 = subpath->getLastY(); } - if (y < yMin) { - yMin = y; - } else if (y > yMax) { - yMax = y; + if (j < subpath->getNumPoints() - 1) { + x2 = subpath->getX(j + 1); + y2 = subpath->getY(j + 1); + } else { + x2 = subpath->getX(0); + y2 = subpath->getY(0); + } + if ((fabs(x1 - x0) > 0.0001 || fabs(y1 - y0) > 0.0001) && + (fabs(x2 - x1) > 0.0001 || fabs(y2 - y1) > 0.0001)) { + double d01 = 1 / sqrt((x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0)); + double ux = (x1 - x0) * d01; + double uy = (y1 - y0) * d01; + double d12 = 1 / sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)); + double vx = (x2 - x1) * d12; + double vy = (y2 - y1) * d12; + double dot = -ux * vx - uy * vy; + if (dot < 0.9999) { + double miter = sqrt(2 / (1 - dot)); + if (miter <= miterLimit) { + double cross = ux * vy - uy * vx; + double m = sqrt(2 / (1 - dot) - 1); + double ax, ay; + if (cross >= 0) { + ax = x1 + w * uy; + ay = y1 - w * ux; + } else { + ax = x1 - w * uy; + ay = y1 + w * ux; + } + double mx = ax + m * w * ux; + double my = ay + m * w * uy; + if (mx < xMin) { + xMin = mx; + } else if (mx > xMax) { + xMax = mx; + } + if (my < yMin) { + yMin = my; + } else if (my > yMax) { + yMax = my; + } + useMiter = gTrue; + } + } + } + } + if (!useMiter) { + if (x1 - w < xMin) { + xMin = x1 - w; + } + if (x1 + w > xMax) { + xMax = x1 + w; + } + if (y1 - w < yMin) { + yMin = y1 - w; + } + if (y1 + w > yMax) { + yMax = y1 + w; } } } } - // allow for the line width - //~ miter joins can extend farther than this - t0 = fabs(ctm[0]); - t1 = fabs(ctm[2]); - if (t0 > t1) { - xMin -= 0.5 * lineWidth * t0; - xMax += 0.5 * lineWidth * t0; - } else { - xMin -= 0.5 * lineWidth * t1; - xMax += 0.5 * lineWidth * t1; - } - t0 = fabs(ctm[0]); - t1 = fabs(ctm[3]); - if (t0 > t1) { - yMin -= 0.5 * lineWidth * t0; - yMax += 0.5 * lineWidth * t0; - } else { - yMin -= 0.5 * lineWidth * t1; - yMax += 0.5 * lineWidth * t1; - } - - if (xMin > clipXMin) { - clipXMin = xMin; - } - if (yMin > clipYMin) { - clipYMin = yMin; - } - if (xMax < clipXMax) { - clipXMax = xMax; - } - if (yMax < clipYMax) { - clipYMax = yMax; + double xx, yy; + transform(xMin, yMin, &xx, &yy); + if (xx < clipXMin) { + clipXMin = xx; + } else if (xx > clipXMax) { + clipXMax = xx; + } + if (yy < clipYMin) { + clipYMin = yy; + } else if (yy > clipYMax) { + clipYMax = yy; + } + transform(xMin, yMax, &xx, &yy); + if (xx < clipXMin) { + clipXMin = xx; + } else if (xx > clipXMax) { + clipXMax = xx; + } + if (yy < clipYMin) { + clipYMin = yy; + } else if (yy > clipYMax) { + clipYMax = yy; + } + transform(xMax, yMin, &xx, &yy); + if (xx < clipXMin) { + clipXMin = xx; + } else if (xx > clipXMax) { + clipXMax = xx; + } + if (yy < clipYMin) { + clipYMin = yy; + } else if (yy > clipYMax) { + clipYMax = yy; + } + transform(xMax, yMax, &xx, &yy); + if (xx < clipXMin) { + clipXMin = xx; + } else if (xx > clipXMax) { + clipXMax = xx; + } + if (yy < clipYMin) { + clipYMin = yy; + } else if (yy > clipYMax) { + clipYMax = yy; } } diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/GfxState.h b/Build/source/libs/xpdf/xpdf-src/xpdf/GfxState.h index f9c0cfcad6e..60d48527c29 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/GfxState.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/GfxState.h @@ -1076,6 +1076,10 @@ public: double getLastX() { return subpaths[n-1]->getLastX(); } double getLastY() { return subpaths[n-1]->getLastY(); } + // Get the current point + double getCurX(); + double getCurY(); + // Move the current point. void moveTo(double x, double y); diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/GlobalParams.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/GlobalParams.cc index 5ff932479d1..e7cc594b12d 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/GlobalParams.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/GlobalParams.cc @@ -5,9 +5,6 @@ // Copyright 2001-2003 Glyph & Cog, LLC // //======================================================================== -// Modified for TeX Live by Peter Breitenlohner -// See top-level ChangeLog for a list of all modifications -//======================================================================== #include @@ -219,7 +216,7 @@ GString *SysFontInfo::mungeName1(GString *in) { return out; } -// Remove trailing "Identity-H"/"Identity-V" from the name. +// Remove trailing encoding tags from the name. // Split the name into tokens at space/comma/dash/underscore. // Remove trailing "MT" or "BT" from tokens. // Remove trailing "PS" and "WGL4" from tokens. @@ -229,7 +226,9 @@ GString *SysFontInfo::mungeName2(GString *in) { GString *out = new GString(); char *p0 = in->getCString(); while (*p0) { - if (!strcmp(p0, "Identity-H") || !strcmp(p0, "Identity-V")) { + if (!strcmp(p0, "Identity-H") || !strcmp(p0, "Identity-V") || + !strcmp(p0, "GB2312") || + !strcmp(p0, "UniGB-UCS2-H") || !strcmp(p0, "UniGB-UCS2-V")) { break; } char *p1; @@ -729,6 +728,7 @@ GlobalParams::GlobalParams(const char *cfgFileName) { disableFreeTypeHinting = gFalse; antialias = gTrue; vectorAntialias = gTrue; + imageMaskAntialias = gTrue; antialiasPrinting = gFalse; strokeAdjust = strokeAdjustNormal; screenType = screenUnset; @@ -741,6 +741,7 @@ GlobalParams::GlobalParams(const char *cfgFileName) { enablePathSimplification = gFalse; drawAnnotations = gTrue; drawFormFields = gTrue; + enableXFA = gTrue; overprintPreview = gFalse; paperColor = new GString("#ffffff"); matteColor = new GString("#808080"); @@ -753,11 +754,14 @@ GlobalParams::GlobalParams(const char *cfgFileName) { mapNumericCharNames = gTrue; mapUnknownCharNames = gFalse; mapExtTrueTypeFontsViaUnicode = gTrue; + useTrueTypeUnicodeMapping = gFalse; droppedFonts = new GHash(gTrue); createDefaultKeyBindings(); popupMenuCmds = new GList(); tabStateFile = appendToPath(getHomeDir(), ".xpdf.tab-state"); + savePageNumbers = gTrue; printCommands = gFalse; + printStatusInfo = gFalse; errQuiet = gFalse; debugLogFile = NULL; @@ -1186,6 +1190,9 @@ void GlobalParams::parseLine(char *buf, GString *fileName, int line) { } else if (!cmd->cmp("vectorAntialias")) { parseYesNo("vectorAntialias", &vectorAntialias, tokens, fileName, line); + } else if (!cmd->cmp("imageMaskAntialias")) { + parseYesNo("imageMaskAntialias", &imageMaskAntialias, + tokens, fileName, line); } else if (!cmd->cmp("antialiasPrinting")) { parseYesNo("antialiasPrinting", &antialiasPrinting, tokens, fileName, line); @@ -1219,6 +1226,9 @@ void GlobalParams::parseLine(char *buf, GString *fileName, int line) { } else if (!cmd->cmp("drawFormFields")) { parseYesNo("drawFormFields", &drawFormFields, tokens, fileName, line); + } else if (!cmd->cmp("enableXFA")) { + parseYesNo("enableXFA", &enableXFA, + tokens, fileName, line); } else if (!cmd->cmp("overprintPreview")) { parseYesNo("overprintPreview", &overprintPreview, tokens, fileName, line); @@ -1250,6 +1260,10 @@ void GlobalParams::parseLine(char *buf, GString *fileName, int line) { parseYesNo("mapExtTrueTypeFontsViaUnicode", &mapExtTrueTypeFontsViaUnicode, tokens, fileName, line); + } else if (!cmd->cmp("useTrueTypeUnicodeMapping")) { + parseYesNo("useTrueTypeUnicodeMapping", + &useTrueTypeUnicodeMapping, + tokens, fileName, line); } else if (!cmd->cmp("dropFont")) { parseDropFont(tokens, fileName, line); } else if (!cmd->cmp("bind")) { @@ -1260,8 +1274,12 @@ void GlobalParams::parseLine(char *buf, GString *fileName, int line) { parsePopupMenuCmd(tokens, fileName, line); } else if (!cmd->cmp("tabStateFile")) { parseString("tabStateFile", &tabStateFile, tokens, fileName, line); + } else if (!cmd->cmp("savePageNumbers")) { + parseYesNo("savePageNumbers", &savePageNumbers, tokens, fileName, line); } else if (!cmd->cmp("printCommands")) { parseYesNo("printCommands", &printCommands, tokens, fileName, line); + } else if (!cmd->cmp("printStatusInfo")) { + parseYesNo("printStatusInfo", &printStatusInfo, tokens, fileName, line); } else if (!cmd->cmp("errQuiet")) { parseYesNo("errQuiet", &errQuiet, tokens, fileName, line); } else if (!cmd->cmp("debugLogFile")) { @@ -1281,8 +1299,6 @@ void GlobalParams::parseLine(char *buf, GString *fileName, int line) { } else if (!cmd->cmp("fontpath") || !cmd->cmp("fontmap")) { error(errConfig, -1, "The config file format has changed since Xpdf 0.9x"); - } else if (!cmd->cmp("enableXFA")) { - error(errConfig, -1, "The enableXFA option is no longer used"); } } } @@ -2115,6 +2131,7 @@ GlobalParams::~GlobalParams() { deleteGList(keyBindings, KeyBinding); deleteGList(popupMenuCmds, PopupMenuCmd); delete tabStateFile; + delete debugLogFile; cMapDirs->startIter(&iter); while (cMapDirs->getNext(&iter, &key, (void **)&list)) { @@ -3060,6 +3077,15 @@ GBool GlobalParams::getVectorAntialias() { return f; } +GBool GlobalParams::getImageMaskAntialias() { + GBool f; + + lockGlobalParams; + f = imageMaskAntialias; + unlockGlobalParams; + return f; +} + GBool GlobalParams::getAntialiasPrinting() { GBool f; @@ -3168,6 +3194,15 @@ GBool GlobalParams::getDrawFormFields() { return draw; } +GBool GlobalParams::getEnableXFA() { + GBool xfa; + + lockGlobalParams; + xfa = enableXFA; + unlockGlobalParams; + return xfa; +} + GString *GlobalParams::getPaperColor() { @@ -3251,6 +3286,15 @@ GBool GlobalParams::getMapExtTrueTypeFontsViaUnicode() { return map; } +GBool GlobalParams::getUseTrueTypeUnicodeMapping() { + GBool use; + + lockGlobalParams; + use = useTrueTypeUnicodeMapping; + unlockGlobalParams; + return use; +} + GBool GlobalParams::isDroppedFont(const char *fontName) { GBool isDropped; @@ -3321,6 +3365,15 @@ GString *GlobalParams::getTabStateFile() { return s; } +GBool GlobalParams::getSavePageNumbers() { + GBool s; + + lockGlobalParams; + s = savePageNumbers; + unlockGlobalParams; + return s; +} + GBool GlobalParams::getPrintCommands() { GBool p; @@ -3330,6 +3383,15 @@ GBool GlobalParams::getPrintCommands() { return p; } +GBool GlobalParams::getPrintStatusInfo() { + GBool p; + + lockGlobalParams; + p = printStatusInfo; + unlockGlobalParams; + return p; +} + GBool GlobalParams::getErrQuiet() { // no locking -- this function may get called from inside a locked // section @@ -3759,6 +3821,12 @@ void GlobalParams::setPrintCommands(GBool printCommandsA) { unlockGlobalParams; } +void GlobalParams::setPrintStatusInfo(GBool printStatusInfoA) { + lockGlobalParams; + printStatusInfo = printStatusInfoA; + unlockGlobalParams; +} + void GlobalParams::setErrQuiet(GBool errQuietA) { lockGlobalParams; errQuiet = errQuietA; diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/GlobalParams.h b/Build/source/libs/xpdf/xpdf-src/xpdf/GlobalParams.h index 2823ea59421..d72473f2a46 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/GlobalParams.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/GlobalParams.h @@ -316,6 +316,7 @@ public: GBool getDisableFreeTypeHinting(); GBool getAntialias(); GBool getVectorAntialias(); + GBool getImageMaskAntialias(); GBool getAntialiasPrinting(); StrokeAdjustMode getStrokeAdjust(); ScreenType getScreenType(); @@ -328,6 +329,7 @@ public: GBool getEnablePathSimplification(); GBool getDrawAnnotations(); GBool getDrawFormFields(); + GBool getEnableXFA(); GBool getOverprintPreview() { return overprintPreview; } GString *getPaperColor(); GString *getMatteColor(); @@ -340,13 +342,16 @@ public: GBool getMapNumericCharNames(); GBool getMapUnknownCharNames(); GBool getMapExtTrueTypeFontsViaUnicode(); + GBool getUseTrueTypeUnicodeMapping(); GBool isDroppedFont(const char *fontName); GList *getKeyBinding(int code, int mods, int context); GList *getAllKeyBindings(); int getNumPopupMenuCmds(); PopupMenuCmd *getPopupMenuCmd(int idx); GString *getTabStateFile(); + GBool getSavePageNumbers(); GBool getPrintCommands(); + GBool getPrintStatusInfo(); GBool getErrQuiet(); GString *getDebugLogFile(); void debugLogPrintf(const char *fmt, ...); @@ -401,6 +406,7 @@ public: void setMapExtTrueTypeFontsViaUnicode(GBool map); void setTabStateFile(char *tabStateFileA); void setPrintCommands(GBool printCommandsA); + void setPrintStatusInfo(GBool printStatusInfoA); void setErrQuiet(GBool errQuietA); #ifdef _WIN32 @@ -559,6 +565,7 @@ private: GBool disableFreeTypeHinting; // FreeType hinting disable flag GBool antialias; // font anti-aliasing enable flag GBool vectorAntialias; // vector anti-aliasing enable flag + GBool imageMaskAntialias; // image mask anti-aliasing enable flag GBool antialiasPrinting; // allow anti-aliasing when printing StrokeAdjustMode strokeAdjust; // stroke adjustment mode ScreenType screenType; // halftone screen type @@ -572,6 +579,7 @@ private: enablePathSimplification; GBool drawAnnotations; // draw annotations or not GBool drawFormFields; // draw form fields or not + GBool enableXFA; // enable XFA form parsing GBool overprintPreview; // enable overprint preview GString *paperColor; // paper (page background) color GString *matteColor; // matte (background outside of page) color @@ -586,11 +594,17 @@ private: GBool mapUnknownCharNames; // map unknown char names? GBool mapExtTrueTypeFontsViaUnicode; // map char codes to GID via Unicode // for external TrueType fonts? + GBool useTrueTypeUnicodeMapping; // use the Unicode cmaps in TrueType + // fonts, rather than the PDF + // ToUnicode mapping GHash *droppedFonts; // dropped fonts [int] GList *keyBindings; // key & mouse button bindings [KeyBinding] GList *popupMenuCmds; // popup menu commands [PopupMenuCmd] GString *tabStateFile; // path for the tab state save file + GBool savePageNumbers; // save page number when file is closed + // and restore page number when opened GBool printCommands; // print the drawing commands + GBool printStatusInfo; // print status info for each page GBool errQuiet; // suppress error messages? GString *debugLogFile; // path for debug log file diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/HTMLGen.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/HTMLGen.cc index 6f51ad85190..a077655ef43 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/HTMLGen.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/HTMLGen.cc @@ -2,7 +2,7 @@ // // HTMLGen.cc // -// Copyright 2010 Glyph & Cog, LLC +// Copyright 2010-2021 Glyph & Cog, LLC // //======================================================================== @@ -13,9 +13,8 @@ //~ generic serif/sans-serif/monospace name) //~ - check that htmlDir exists and is a directory //~ - links: -//~ - links to pages -//~ - links to named destinations -//~ - links to URLs +//~ - internal links (to pages, to named destinations) +//~ - links from non-text content //~ - rotated text should go in the background image //~ - metadata //~ - PDF outline @@ -35,6 +34,7 @@ #include "SplashBitmap.h" #include "PDFDoc.h" #include "GfxFont.h" +#include "AcroForm.h" #include "TextOutputDev.h" #include "SplashOutputDev.h" #include "ErrorCodes.h" @@ -196,10 +196,93 @@ public: //------------------------------------------------------------------------ +class HTMLGenFormFieldInfo { +public: + + HTMLGenFormFieldInfo(AcroFormField *acroFormFieldA) + : acroFormField(acroFormFieldA) {} + + AcroFormField *acroFormField; +}; + +//------------------------------------------------------------------------ + +class Base64Encoder { +public: + + Base64Encoder(int (*writeFuncA)(void *stream, const char *data, int size), + void *streamA); + void encode(const unsigned char *data, size_t size); + void flush(); + +private: + + int (*writeFunc)(void *stream, const char *data, int size); + void *stream; + unsigned char buf[3]; + int bufLen; +}; + +static char base64Chars[65] = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + +Base64Encoder::Base64Encoder(int (*writeFuncA)(void *stream, const char *data, + int size), + void *streamA) { + writeFunc = writeFuncA; + stream = streamA; + bufLen = 0; +} + +void Base64Encoder::encode(const unsigned char *data, size_t size) { + size_t i = 0; + while (1) { + while (bufLen < 3) { + if (i >= size) { + return; + } + buf[bufLen++] = data[i++]; + } + char out[4]; + out[0] = base64Chars[(buf[0] >> 2) & 0x3f]; + out[1] = base64Chars[((buf[0] << 4) | (buf[1] >> 4)) & 0x3f]; + out[2] = base64Chars[((buf[1] << 2) | (buf[2] >> 6)) & 0x3f]; + out[3] = base64Chars[buf[2] & 0x3f]; + writeFunc(stream, out, 4); + bufLen = 0; + } +} + +void Base64Encoder::flush() { + // if bufLen == 0, this does nothing + // bufLen should never be 3 here + char out[4]; + if (bufLen == 1) { + out[0] = base64Chars[(buf[0] >> 2) & 0x3f]; + out[1] = base64Chars[(buf[0] << 4) & 0x3f]; + out[2] = '='; + out[3] = '='; + writeFunc(stream, out, 4); + } else if (bufLen == 2) { + out[0] = base64Chars[(buf[0] >> 2) & 0x3f]; + out[1] = base64Chars[((buf[0] << 4) | (buf[1] >> 4)) & 0x3f]; + out[2] = base64Chars[(buf[1] << 2) & 0x3f]; + out[3] = '='; + writeFunc(stream, out, 4); + } +} + +static int writeToString(void *stream, const char *data, int size) { + ((GString *)stream)->append(data, size); + return size; +} + +//------------------------------------------------------------------------ + //------------------------------------------------------------------------ -HTMLGen::HTMLGen(double backgroundResolutionA) { +HTMLGen::HTMLGen(double backgroundResolutionA, GBool tableMode) { TextOutputControl textOutControl; SplashColor paperColor; @@ -207,12 +290,16 @@ HTMLGen::HTMLGen(double backgroundResolutionA) { backgroundResolution = backgroundResolutionA; zoom = 1.0; + vStretch = 1.0; drawInvisibleText = gTrue; allTextInvisible = gFalse; extractFontFiles = gFalse; + convertFormFields = gFalse; + embedBackgroundImage = gFalse; + embedFonts = gFalse; // set up the TextOutputDev - textOutControl.mode = textOutReadingOrder; + textOutControl.mode = tableMode ? textOutTableLayout : textOutReadingOrder; textOutControl.html = gTrue; textOutControl.splitRotatedWords = gTrue; textOut = new TextOutputDev(NULL, &textOutControl, gFalse); @@ -266,15 +353,18 @@ static int pf(int (*writeFunc)(void *stream, const char *data, int size), } struct PNGWriteInfo { + Base64Encoder *base64; int (*writePNG)(void *stream, const char *data, int size); void *pngStream; }; static void pngWriteFunc(png_structp png, png_bytep data, png_size_t size) { - PNGWriteInfo *info; - - info = (PNGWriteInfo *)png_get_progressive_ptr(png); - info->writePNG(info->pngStream, (char *)data, (int)size); + PNGWriteInfo *info = (PNGWriteInfo *)png_get_progressive_ptr(png); + if (info->base64) { + info->base64->encode(data, size); + } else { + info->writePNG(info->pngStream, (char *)data, (int)size); + } } int HTMLGen::convertPage( @@ -304,31 +394,10 @@ int HTMLGen::convertPage( // generate the background bitmap splashOut->setSkipText(!allTextInvisible, gFalse); - doc->displayPage(splashOut, pg, backgroundResolution, backgroundResolution, + doc->displayPage(splashOut, pg, + backgroundResolution, backgroundResolution * vStretch, 0, gFalse, gTrue, gFalse); bitmap = splashOut->getBitmap(); - if (!(png = png_create_write_struct(PNG_LIBPNG_VER_STRING, - NULL, NULL, NULL)) || - !(pngInfo = png_create_info_struct(png))) { - return errFileIO; - } - if (setjmp(png_jmpbuf(png))) { - return errFileIO; - } - writeInfo.writePNG = writePNG; - writeInfo.pngStream = pngStream; - png_set_write_fn(png, &writeInfo, pngWriteFunc, NULL); - png_set_IHDR(png, pngInfo, bitmap->getWidth(), bitmap->getHeight(), - 8, PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE, - PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); - png_write_info(png, pngInfo); - p = bitmap->getDataPtr(); - for (y = 0; y < bitmap->getHeight(); ++y) { - png_write_row(png, (png_bytep)p); - p += bitmap->getRowSize(); - } - png_write_end(png, pngInfo); - png_destroy_write_struct(&png, &pngInfo); // page size if (doc->getPageRotate(pg) == 90 || doc->getPageRotate(pg) == 270) { @@ -345,12 +414,86 @@ int HTMLGen::convertPage( text = textOut->takeText(); primaryDir = text->primaryDirectionIsLR() ? 1 : -1; + // insert a special character for each form field; + // remove existing characters inside field bboxes; + // erase background content inside field bboxes + formFieldFont = NULL; + formFieldInfo = NULL; + if (convertFormFields) { + AcroForm *form = doc->getCatalog()->getForm(); + if (form) { + formFieldInfo = new GList(); + formFieldFont = new TextFontInfo(); + double yTop = doc->getCatalog()->getPage(pg)->getMediaBox()->y2; + for (i = 0; i < form->getNumFields(); ++i) { + AcroFormField *field = form->getField(i); + AcroFormFieldType fieldType = field->getAcroFormFieldType(); + if (field->getPageNum() == pg && + (fieldType == acroFormFieldText || + fieldType == acroFormFieldCheckbox)) { + double llx, lly, urx, ury; + field->getBBox(&llx, &lly, &urx, &ury); + lly = yTop - lly; + ury = yTop - ury; + + // add the field info + int fieldIdx = formFieldInfo->getLength(); + formFieldInfo->append(new HTMLGenFormFieldInfo(field)); + + // remove exsting chars + text->removeChars(llx, ury, urx, lly, 0.75, 0.5); + + // erase background content + int llxI = (int)(llx * backgroundResolution / 72 + 0.5); + int llyI = (int)(lly * backgroundResolution * vStretch / 72 + 0.5); + int urxI = (int)(urx * backgroundResolution / 72 + 0.5); + int uryI = (int)(ury * backgroundResolution * vStretch / 72 + 0.5); + llyI += (int)(backgroundResolution * vStretch / 20); + if (llxI < 0) { + llxI = 0; + } + if (urxI >= bitmap->getWidth()) { + urxI = bitmap->getWidth() - 1; + } + if (uryI < 0) { + uryI = 0; + } + if (llyI > bitmap->getHeight()) { + llyI = bitmap->getHeight() - 1; + } + if (uryI <= llyI && llxI <= urxI) { + SplashColorPtr p = bitmap->getDataPtr() + + uryI * bitmap->getRowSize() + llxI * 3; + for (int y = uryI; y <= llyI; ++y) { + memset(p, 0xff, (urxI - llxI + 1) * 3); + p += bitmap->getRowSize(); + } + } + + // add a special char + // (the font size is unused -- 10 is an arbitrary value) + text->addSpecialChar(llx, ury, urx, lly, + 0, formFieldFont, 10, 0x80000000 + fieldIdx); + } + } + } + } + // HTML header pr(writeHTML, htmlStream, "\n"); pr(writeHTML, htmlStream, "\n"); pr(writeHTML, htmlStream, "\n"); pr(writeHTML, htmlStream, "