node-poppler 5.1.4 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (176) hide show
  1. package/README.md +2 -0
  2. package/package.json +13 -13
  3. package/src/index.js +20 -8
  4. package/API.md +0 -465
  5. package/CHANGELOG.md +0 -976
  6. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Annot.h +0 -1783
  7. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/AnnotStampImageHelper.h +0 -68
  8. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Array.h +0 -92
  9. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/BBoxOutputDev.h +0 -54
  10. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/CMap.h +0 -128
  11. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/CachedFile.h +0 -149
  12. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/CairoFontEngine.h +0 -122
  13. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/CairoOutputDev.h +0 -468
  14. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/CairoRescaleBox.h +0 -60
  15. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Catalog.h +0 -318
  16. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/CertificateInfo.h +0 -129
  17. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/CharCodeToUnicode.h +0 -143
  18. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/CharTypes.h +0 -24
  19. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/CurlCachedFile.h +0 -37
  20. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/CurlPDFDocBuilder.h +0 -32
  21. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/DateInfo.h +0 -44
  22. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Decrypt.h +0 -147
  23. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Dict.h +0 -126
  24. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Error.h +0 -59
  25. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/ErrorCodes.h +0 -54
  26. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/FDPDFDocBuilder.h +0 -36
  27. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/FILECacheLoader.h +0 -34
  28. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/FileSpec.h +0 -85
  29. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/FontEncodingTables.h +0 -20
  30. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/FontInfo.h +0 -109
  31. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Form.h +0 -734
  32. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Function.h +0 -251
  33. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Gfx.h +0 -373
  34. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/GfxFont.h +0 -466
  35. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/GfxState.h +0 -1759
  36. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/GfxState_helpers.h +0 -90
  37. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/GlobalParams.h +0 -221
  38. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Hints.h +0 -91
  39. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/JArithmeticDecoder.h +0 -131
  40. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/JBIG2Stream.h +0 -130
  41. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/JPEG2000Stream.h +0 -54
  42. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/JSInfo.h +0 -65
  43. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Lexer.h +0 -113
  44. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Linearization.h +0 -43
  45. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Link.h +0 -566
  46. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/LocalPDFDocBuilder.h +0 -32
  47. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/MarkedContentOutputDev.h +0 -132
  48. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Movie.h +0 -123
  49. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/NameToCharCode.h +0 -52
  50. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/NameToUnicodeTable.h +0 -4300
  51. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Object.h +0 -678
  52. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/OptionalContent.h +0 -117
  53. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Outline.h +0 -122
  54. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/OutputDev.h +0 -379
  55. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/PDFDoc.h +0 -419
  56. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/PDFDocBuilder.h +0 -47
  57. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/PDFDocEncoding.h +0 -43
  58. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/PDFDocFactory.h +0 -58
  59. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/PSOutputDev.h +0 -549
  60. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/PSTokenizer.h +0 -47
  61. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Page.h +0 -273
  62. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/PageTransition.h +0 -105
  63. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Parser.h +0 -76
  64. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/PopplerCache.h +0 -65
  65. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/PreScanOutputDev.h +0 -148
  66. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/ProfileData.h +0 -35
  67. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Rendition.h +0 -164
  68. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/SecurityHandler.h +0 -131
  69. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Sound.h +0 -82
  70. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/SplashOutputDev.h +0 -413
  71. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Stream-CCITT.h +0 -334
  72. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Stream.h +0 -1504
  73. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/StructElement.h +0 -406
  74. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/StructTreeRoot.h +0 -89
  75. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/TextOutputDev.h +0 -918
  76. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/UTF.h +0 -112
  77. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/UnicodeCClassTables.h +0 -983
  78. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/UnicodeCompTables.h +0 -328
  79. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/UnicodeDecompTables.h +0 -7181
  80. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/UnicodeMap.h +0 -128
  81. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/UnicodeMapFuncs.h +0 -35
  82. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/UnicodeMapTables.h +0 -84
  83. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/UnicodeTypeTable.h +0 -49
  84. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/ViewerPreferences.h +0 -87
  85. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/XRef.h +0 -325
  86. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/cpp/poppler-destination.h +0 -69
  87. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/cpp/poppler-document.h +0 -135
  88. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/cpp/poppler-embedded-file.h +0 -55
  89. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/cpp/poppler-font-private.h +0 -68
  90. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/cpp/poppler-font.h +0 -95
  91. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/cpp/poppler-global.h +0 -132
  92. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/cpp/poppler-image.h +0 -74
  93. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/cpp/poppler-page-renderer.h +0 -77
  94. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/cpp/poppler-page-transition.h +0 -85
  95. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/cpp/poppler-page.h +0 -225
  96. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/cpp/poppler-rectangle.h +0 -66
  97. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/cpp/poppler-toc.h +0 -72
  98. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/cpp/poppler-version.h +0 -39
  99. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/cpp/poppler_cpp_export.h +0 -42
  100. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/fofi/FoFiBase.h +0 -66
  101. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/fofi/FoFiEncodings.h +0 -43
  102. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/fofi/FoFiIdentifier.h +0 -52
  103. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/fofi/FoFiTrueType.h +0 -190
  104. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/fofi/FoFiType1.h +0 -70
  105. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/fofi/FoFiType1C.h +0 -263
  106. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/glib/poppler-action.h +0 -454
  107. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/glib/poppler-annot.h +0 -333
  108. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/glib/poppler-attachment.h +0 -123
  109. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/glib/poppler-date.h +0 -32
  110. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/glib/poppler-document.h +0 -541
  111. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/glib/poppler-enums.h +0 -191
  112. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/glib/poppler-features.h +0 -88
  113. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/glib/poppler-form-field.h +0 -254
  114. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/glib/poppler-layer.h +0 -50
  115. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/glib/poppler-macros.h +0 -42
  116. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/glib/poppler-media.h +0 -80
  117. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/glib/poppler-movie.h +0 -81
  118. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/glib/poppler-page.h +0 -424
  119. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/glib/poppler-structure-element.h +0 -425
  120. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/glib/poppler.h +0 -259
  121. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/goo/GooCheckedOps.h +0 -116
  122. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/goo/GooLikely.h +0 -22
  123. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/goo/GooString.h +0 -262
  124. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/goo/GooTimer.h +0 -59
  125. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/goo/ImgWriter.h +0 -39
  126. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/goo/JpegWriter.h +0 -69
  127. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/goo/PNGWriter.h +0 -68
  128. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/goo/TiffWriter.h +0 -70
  129. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/goo/gdir.h +0 -96
  130. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/goo/gfile.h +0 -156
  131. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/goo/gmem.h +0 -201
  132. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/goo/grandom.h +0 -21
  133. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/goo/gstrtod.h +0 -45
  134. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/poppler-config.h +0 -155
  135. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/poppler_private_export.h +0 -42
  136. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/Splash.h +0 -336
  137. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashBitmap.h +0 -127
  138. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashClip.h +0 -131
  139. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashErrorCodes.h +0 -50
  140. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashFTFont.h +0 -71
  141. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashFTFontEngine.h +0 -72
  142. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashFTFontFile.h +0 -64
  143. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashFont.h +0 -116
  144. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashFontEngine.h +0 -89
  145. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashFontFile.h +0 -98
  146. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashFontFileID.h +0 -40
  147. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashGlyphBitmap.h +0 -23
  148. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashMath.h +0 -215
  149. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashPath.h +0 -138
  150. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashPattern.h +0 -107
  151. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashScreen.h +0 -87
  152. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashState.h +0 -132
  153. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashTypes.h +0 -248
  154. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashXPath.h +0 -95
  155. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashXPathScanner.h +0 -136
  156. package/src/lib/win32/poppler-22.04.0/Library/lib/pkgconfig/poppler-cpp.pc +0 -12
  157. package/src/lib/win32/poppler-22.04.0/Library/lib/pkgconfig/poppler-glib.pc +0 -12
  158. package/src/lib/win32/poppler-22.04.0/Library/lib/pkgconfig/poppler.pc +0 -10
  159. package/src/lib/win32/poppler-22.04.0/Library/lib/poppler-cpp.lib +0 -0
  160. package/src/lib/win32/poppler-22.04.0/Library/lib/poppler-glib.lib +0 -0
  161. package/src/lib/win32/poppler-22.04.0/Library/lib/poppler.lib +0 -0
  162. package/src/lib/win32/poppler-22.04.0/Library/share/man/man1/pdfattach.1 +0 -60
  163. package/src/lib/win32/poppler-22.04.0/Library/share/man/man1/pdfdetach.1 +0 -94
  164. package/src/lib/win32/poppler-22.04.0/Library/share/man/man1/pdffonts.1 +0 -128
  165. package/src/lib/win32/poppler-22.04.0/Library/share/man/man1/pdfimages.1 +0 -265
  166. package/src/lib/win32/poppler-22.04.0/Library/share/man/man1/pdfinfo.1 +0 -198
  167. package/src/lib/win32/poppler-22.04.0/Library/share/man/man1/pdfseparate.1 +0 -60
  168. package/src/lib/win32/poppler-22.04.0/Library/share/man/man1/pdftocairo.1 +0 -346
  169. package/src/lib/win32/poppler-22.04.0/Library/share/man/man1/pdftohtml.1 +0 -118
  170. package/src/lib/win32/poppler-22.04.0/Library/share/man/man1/pdftoppm.1 +0 -230
  171. package/src/lib/win32/poppler-22.04.0/Library/share/man/man1/pdftops.1 +0 -267
  172. package/src/lib/win32/poppler-22.04.0/Library/share/man/man1/pdftotext.1 +0 -157
  173. package/src/lib/win32/poppler-22.04.0/Library/share/man/man1/pdfunite.1 +0 -43
  174. package/src/lib/win32/poppler-22.04.0/share/poppler/CMakeLists.txt +0 -309
  175. package/src/lib/win32/poppler-22.04.0/share/poppler/Makefile +0 -333
  176. package/tsconfig.json +0 -9
@@ -1,325 +0,0 @@
1
- //========================================================================
2
- //
3
- // XRef.h
4
- //
5
- // Copyright 1996-2003 Glyph & Cog, LLC
6
- //
7
- //========================================================================
8
-
9
- //========================================================================
10
- //
11
- // Modified under the Poppler project - http://poppler.freedesktop.org
12
- //
13
- // All changes made under the Poppler project to this file are licensed
14
- // under GPL version 2 or later
15
- //
16
- // Copyright (C) 2005 Brad Hards <bradh@frogmouth.net>
17
- // Copyright (C) 2006, 2008, 2010-2013, 2017-2021 Albert Astals Cid <aacid@kde.org>
18
- // Copyright (C) 2007-2008 Julien Rebetez <julienr@svn.gnome.org>
19
- // Copyright (C) 2007 Carlos Garcia Campos <carlosgc@gnome.org>
20
- // Copyright (C) 2010 Ilya Gorenbein <igorenbein@finjan.com>
21
- // Copyright (C) 2010 Hib Eris <hib@hiberis.nl>
22
- // Copyright (C) 2012, 2013, 2016 Thomas Freitag <Thomas.Freitag@kabelmail.de>
23
- // Copyright (C) 2012, 2013 Fabio D'Urso <fabiodurso@hotmail.it>
24
- // Copyright (C) 2013, 2017, 2019 Adrian Johnson <ajohnson@redneon.com>
25
- // Copyright (C) 2016 Jakub Alba <jakubalba@gmail.com>
26
- // Copyright (C) 2018 Adam Reichold <adam.reichold@t-online.de>
27
- // Copyright (C) 2018 Marek Kasik <mkasik@redhat.com>
28
- // Copyright (C) 2021 Mahmoud Khalil <mahmoudkhalil11@gmail.com>
29
- // Copyright (C) 2021 Georgiy Sgibnev <georgiy@sgibnev.com>. Work sponsored by lab50.net.
30
- //
31
- // To see a description of the changes please see the Changelog file that
32
- // came with your tarball or type make ChangeLog if you are building from git
33
- //
34
- //========================================================================
35
-
36
- #ifndef XREF_H
37
- #define XREF_H
38
-
39
- #include <functional>
40
-
41
- #include "poppler-config.h"
42
- #include "poppler_private_export.h"
43
- #include "Object.h"
44
- #include "Stream.h"
45
- #include "PopplerCache.h"
46
-
47
- class Dict;
48
- class Stream;
49
- class Parser;
50
- class ObjectStream;
51
-
52
- //------------------------------------------------------------------------
53
- // XRef
54
- //------------------------------------------------------------------------
55
-
56
- enum XRefEntryType
57
- {
58
- xrefEntryFree,
59
- xrefEntryUncompressed,
60
- xrefEntryCompressed,
61
- xrefEntryNone
62
- };
63
-
64
- struct XRefEntry
65
- {
66
- Goffset offset;
67
- int gen;
68
- XRefEntryType type;
69
- int flags;
70
- Object obj; // if this entry was updated, obj will contains the updated object
71
-
72
- enum Flag
73
- {
74
- // Regular flags
75
- Updated, // Entry was modified
76
- Parsing, // Entry is currently being parsed
77
-
78
- // Special flags -- available only after xref->scanSpecialFlags() is run
79
- Unencrypted, // Entry is stored in unencrypted form (meaningless in unencrypted documents)
80
- DontRewrite // Entry must not be written back in case of full rewrite
81
- };
82
-
83
- inline bool getFlag(Flag flag) const
84
- {
85
- const int mask = (1 << (int)flag);
86
- return (flags & mask) != 0;
87
- }
88
-
89
- inline void setFlag(Flag flag, bool value)
90
- {
91
- const int mask = (1 << (int)flag);
92
- if (value) {
93
- flags |= mask;
94
- } else {
95
- flags &= ~mask;
96
- }
97
- }
98
- };
99
-
100
- class POPPLER_PRIVATE_EXPORT XRef
101
- {
102
- public:
103
- // Constructor, create an empty XRef, used for PDF writing
104
- XRef();
105
- // Constructor, create an empty XRef but with info dict, used for PDF writing
106
- explicit XRef(const Object *trailerDictA);
107
- // Constructor. Read xref table from stream.
108
- XRef(BaseStream *strA, Goffset pos, Goffset mainXRefEntriesOffsetA = 0, bool *wasReconstructed = nullptr, bool reconstruct = false, const std::function<void()> &xrefReconstructedCallback = {});
109
-
110
- // Destructor.
111
- ~XRef();
112
-
113
- XRef(const XRef &) = delete;
114
- XRef &operator=(const XRef &) = delete;
115
-
116
- // Copy xref but with new base stream!
117
- XRef *copy() const;
118
-
119
- // Is xref table valid?
120
- bool isOk() const { return ok; }
121
-
122
- // Is the last XRef section a stream or a table?
123
- bool isXRefStream() const { return xRefStream; }
124
-
125
- // Get the error code (if isOk() returns false).
126
- int getErrorCode() const { return errCode; }
127
-
128
- // Set the encryption parameters.
129
- void setEncryption(int permFlagsA, bool ownerPasswordOkA, const unsigned char *fileKeyA, int keyLengthA, int encVersionA, int encRevisionA, CryptAlgorithm encAlgorithmA);
130
- // Mark Encrypt entry as Unencrypted
131
- void markUnencrypted();
132
-
133
- void getEncryptionParameters(unsigned char **fileKeyA, CryptAlgorithm *encAlgorithmA, int *keyLengthA);
134
-
135
- // Is the file encrypted?
136
- bool isEncrypted() const { return encrypted; }
137
-
138
- // Is the given Ref encrypted?
139
- bool isRefEncrypted(Ref r);
140
-
141
- // Check various permissions.
142
- bool okToPrint(bool ignoreOwnerPW = false) const;
143
- bool okToPrintHighRes(bool ignoreOwnerPW = false) const;
144
- bool okToChange(bool ignoreOwnerPW = false) const;
145
- bool okToCopy(bool ignoreOwnerPW = false) const;
146
- bool okToAddNotes(bool ignoreOwnerPW = false) const;
147
- bool okToFillForm(bool ignoreOwnerPW = false) const;
148
- bool okToAccessibility(bool ignoreOwnerPW = false) const;
149
- bool okToAssemble(bool ignoreOwnerPW = false) const;
150
- int getPermFlags() const { return permFlags; }
151
-
152
- // Get catalog object.
153
- Object getCatalog();
154
-
155
- // Fetch an indirect reference.
156
- Object fetch(const Ref ref, int recursion = 0);
157
- // If endPos is not null, returns file position after parsing the object. This will
158
- // be a few bytes after the end of the object due to the parser reading ahead.
159
- // Returns -1 if object is in compressed stream.
160
- Object fetch(int num, int gen, int recursion = 0, Goffset *endPos = nullptr);
161
-
162
- // Return the document's Info dictionary (if any).
163
- Object getDocInfo();
164
- Object getDocInfoNF();
165
-
166
- // Create and return the document's Info dictionary if needed.
167
- // Otherwise return the existing one.
168
- // Returns in the given parameter the Ref the Info is in
169
- Object createDocInfoIfNeeded(Ref *ref);
170
-
171
- // Remove the document's Info dictionary and update the trailer dictionary.
172
- void removeDocInfo();
173
-
174
- // Return the number of objects in the xref table.
175
- int getNumObjects() const { return size; }
176
-
177
- // Return the catalog object reference.
178
- int getRootNum() const { return rootNum; }
179
- int getRootGen() const { return rootGen; }
180
- Ref getRoot() const { return { rootNum, rootGen }; }
181
-
182
- // Get end position for a stream in a damaged file.
183
- // Returns false if unknown or file is not damaged.
184
- bool getStreamEnd(Goffset streamStart, Goffset *streamEnd);
185
-
186
- // Retuns the entry that belongs to the offset
187
- int getNumEntry(Goffset offset);
188
-
189
- // Scans the document and sets special flags in all xref entries. One of those
190
- // flags is Unencrypted, which affects how the object is fetched. Therefore,
191
- // this function must be called before fetching unencrypted objects (e.g.
192
- // Encrypt dictionary, XRef streams). Note that the code that initializes
193
- // decryption doesn't need to call this function, because it runs before
194
- // decryption is enabled, and therefore the Unencrypted flag is ignored.
195
- void scanSpecialFlags();
196
-
197
- // Direct access.
198
- XRefEntry *getEntry(int i, bool complainIfMissing = true);
199
- Object *getTrailerDict() { return &trailerDict; }
200
-
201
- // Was the XRef modified?
202
- bool isModified() const { return modified; }
203
- // Set the modification flag for XRef to true.
204
- void setModified() { modified = true; }
205
-
206
- // Write access
207
- void setModifiedObject(const Object *o, Ref r);
208
- Ref addIndirectObject(const Object &o);
209
- void removeIndirectObject(Ref r);
210
- void add(int num, int gen, Goffset offs, bool used);
211
- void add(Ref ref, Goffset offs, bool used);
212
- // Adds a stream object using AutoFreeMemStream.
213
- // The function takes ownership over dict and buffer.
214
- // The buffer should be created using gmalloc().
215
- // Returns ref to a new object.
216
- Ref addStreamObject(Dict *dict, char *buffer, const Goffset bufferSize);
217
- Ref addStreamObject(Dict *dict, uint8_t *buffer, const Goffset bufferSize);
218
-
219
- // Output XRef table to stream
220
- void writeTableToFile(OutStream *outStr, bool writeAllEntries);
221
- // Output XRef stream contents to GooString and fill trailerDict fields accordingly
222
- void writeStreamToBuffer(GooString *stmBuf, Dict *xrefDict, XRef *xref);
223
-
224
- // to be thread safe during write where changes are not allowed
225
- void lock();
226
- void unlock();
227
-
228
- private:
229
- BaseStream *str; // input stream
230
- Goffset start; // offset in file (to allow for garbage
231
- // at beginning of file)
232
- XRefEntry *entries; // xref entries
233
- int capacity; // size of <entries> array
234
- int size; // number of entries
235
- int rootNum, rootGen; // catalog dict
236
- bool ok; // true if xref table is valid
237
- int errCode; // error code (if <ok> is false)
238
- bool xrefReconstructed; // marker, true if xref was already reconstructed
239
- Object trailerDict; // trailer dictionary
240
- bool modified;
241
- Goffset *streamEnds; // 'endstream' positions - only used in
242
- // damaged files
243
- int streamEndsLen; // number of valid entries in streamEnds
244
- PopplerCache<Goffset, ObjectStream> objStrs; // cached object streams
245
- bool encrypted; // true if file is encrypted
246
- int encRevision;
247
- int encVersion; // encryption algorithm
248
- CryptAlgorithm encAlgorithm; // encryption algorithm
249
- int keyLength; // length of key, in bytes
250
- int permFlags; // permission bits
251
- unsigned char fileKey[32]; // file decryption key
252
- bool ownerPasswordOk; // true if owner password is correct
253
- Goffset prevXRefOffset; // position of prev XRef section (= next to read)
254
- Goffset mainXRefEntriesOffset; // offset of entries in main XRef table
255
- bool xRefStream; // true if last XRef section is a stream
256
- Goffset mainXRefOffset; // position of the main XRef table/stream
257
- bool scannedSpecialFlags; // true if scanSpecialFlags has been called
258
- bool strOwner; // true if str is owned by the instance
259
- mutable std::recursive_mutex mutex;
260
- std::function<void()> xrefReconstructedCb;
261
-
262
- int reserve(int newSize);
263
- int resize(int newSize);
264
- bool readXRef(Goffset *pos, std::vector<Goffset> *followedXRefStm, std::vector<int> *xrefStreamObjsNum);
265
- bool readXRefTable(Parser *parser, Goffset *pos, std::vector<Goffset> *followedXRefStm, std::vector<int> *xrefStreamObjsNum);
266
- bool readXRefStreamSection(Stream *xrefStr, const int *w, int first, int n);
267
- bool readXRefStream(Stream *xrefStr, Goffset *pos);
268
- bool constructXRef(bool *wasReconstructed, bool needCatalogDict = false);
269
- bool parseEntry(Goffset offset, XRefEntry *entry);
270
- void readXRefUntil(int untilEntryNum, std::vector<int> *xrefStreamObjsNum = nullptr);
271
- void markUnencrypted(Object *obj);
272
-
273
- class XRefWriter
274
- {
275
- public:
276
- XRefWriter() = default;
277
- virtual void startSection(int first, int count) = 0;
278
- virtual void writeEntry(Goffset offset, int gen, XRefEntryType type) = 0;
279
- virtual ~XRefWriter();
280
-
281
- XRefWriter(const XRefWriter &) = delete;
282
- XRefWriter &operator=(const XRefWriter &other) = delete;
283
- };
284
-
285
- // XRefWriter subclass that writes a XRef table
286
- class XRefTableWriter : public XRefWriter
287
- {
288
- public:
289
- explicit XRefTableWriter(OutStream *outStrA);
290
- void startSection(int first, int count) override;
291
- void writeEntry(Goffset offset, int gen, XRefEntryType type) override;
292
-
293
- private:
294
- OutStream *outStr;
295
- };
296
-
297
- // XRefWriter subclass that writes a XRef stream
298
- class XRefStreamWriter : public XRefWriter
299
- {
300
- public:
301
- XRefStreamWriter(Array *index, GooString *stmBuf, int offsetSize);
302
- void startSection(int first, int count) override;
303
- void writeEntry(Goffset offset, int gen, XRefEntryType type) override;
304
-
305
- private:
306
- Array *index;
307
- GooString *stmBuf;
308
- int offsetSize;
309
- };
310
-
311
- // Dummy XRefWriter subclass that only checks if all offsets fit in 4 bytes
312
- class XRefPreScanWriter : public XRefWriter
313
- {
314
- public:
315
- XRefPreScanWriter();
316
- void startSection(int first, int count) override;
317
- void writeEntry(Goffset offset, int gen, XRefEntryType type) override;
318
-
319
- bool hasOffsetsBeyond4GB;
320
- };
321
-
322
- void writeXRef(XRefWriter *writer, bool writeAllEntries);
323
- };
324
-
325
- #endif
@@ -1,69 +0,0 @@
1
- /*
2
- * Copyright (C) 2019, Masamichi Hosoda <trueroad@trueroad.jp>
3
- * Copyright (C) 2019, 2021, Albert Astals Cid <aacid@kde.org>
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2, or (at your option)
8
- * any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License
16
- * along with this program; if not, write to the Free Software
17
- * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
18
- */
19
-
20
- #ifndef POPPLER_DESTINATION_H
21
- #define POPPLER_DESTINATION_H
22
-
23
- #include "poppler-global.h"
24
-
25
- namespace poppler {
26
- class destination_private;
27
-
28
- class POPPLER_CPP_EXPORT destination : public poppler::noncopyable
29
- {
30
- public:
31
- enum type_enum
32
- {
33
- unknown,
34
- xyz,
35
- fit,
36
- fit_h,
37
- fit_v,
38
- fit_r,
39
- fit_b,
40
- fit_b_h,
41
- fit_b_v
42
- };
43
-
44
- ~destination();
45
- destination(destination &&other) noexcept;
46
-
47
- type_enum type() const;
48
- int page_number() const;
49
- double left() const;
50
- double bottom() const;
51
- double right() const;
52
- double top() const;
53
- double zoom() const;
54
- bool is_change_left() const;
55
- bool is_change_top() const;
56
- bool is_change_zoom() const;
57
-
58
- destination &operator=(destination &&other) noexcept;
59
-
60
- private:
61
- explicit destination(destination_private *dd);
62
-
63
- destination_private *d;
64
- friend class document;
65
- };
66
-
67
- }
68
-
69
- #endif
@@ -1,135 +0,0 @@
1
- /*
2
- * Copyright (C) 2009-2010, Pino Toscano <pino@kde.org>
3
- * Copyright (C) 2016 Jakub Alba <jakubalba@gmail.com>
4
- * Copyright (C) 2019, Masamichi Hosoda <trueroad@trueroad.jp>
5
- * Copyright (C) 2019, 2021, Albert Astals Cid <aacid@kde.org>
6
- *
7
- * This program is free software; you can redistribute it and/or modify
8
- * it under the terms of the GNU General Public License as published by
9
- * the Free Software Foundation; either version 2, or (at your option)
10
- * any later version.
11
- *
12
- * This program is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- * GNU General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU General Public License
18
- * along with this program; if not, write to the Free Software
19
- * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
20
- */
21
-
22
- #ifndef POPPLER_DOCUMENT_H
23
- #define POPPLER_DOCUMENT_H
24
-
25
- #include "poppler-global.h"
26
- #include "poppler-font.h"
27
-
28
- #include <map>
29
-
30
- namespace poppler {
31
-
32
- class destination;
33
- class document_private;
34
- class embedded_file;
35
- class page;
36
- class toc;
37
-
38
- class POPPLER_CPP_EXPORT document : public poppler::noncopyable
39
- {
40
- public:
41
- enum page_mode_enum
42
- {
43
- use_none,
44
- use_outlines,
45
- use_thumbs,
46
- fullscreen,
47
- use_oc,
48
- use_attach
49
- };
50
-
51
- enum page_layout_enum
52
- {
53
- no_layout,
54
- single_page,
55
- one_column,
56
- two_column_left,
57
- two_column_right,
58
- two_page_left,
59
- two_page_right
60
- };
61
-
62
- ~document();
63
-
64
- bool is_locked() const;
65
- bool unlock(const std::string &owner_password, const std::string &user_password);
66
-
67
- page_mode_enum page_mode() const;
68
- page_layout_enum page_layout() const;
69
- void get_pdf_version(int *major, int *minor) const;
70
- std::vector<std::string> info_keys() const;
71
-
72
- ustring info_key(const std::string &key) const;
73
- bool set_info_key(const std::string &key, const ustring &val);
74
-
75
- time_type info_date(const std::string &key) const;
76
- bool set_info_date(const std::string &key, time_type val);
77
-
78
- ustring get_title() const;
79
- bool set_title(const ustring &title);
80
- ustring get_author() const;
81
- bool set_author(const ustring &author);
82
- ustring get_subject() const;
83
- bool set_subject(const ustring &subject);
84
- ustring get_keywords() const;
85
- bool set_keywords(const ustring &keywords);
86
- ustring get_creator() const;
87
- bool set_creator(const ustring &creator);
88
- ustring get_producer() const;
89
- bool set_producer(const ustring &producer);
90
- time_type get_creation_date() const;
91
- bool set_creation_date(time_type creation_date);
92
- time_type get_modification_date() const;
93
- bool set_modification_date(time_type mod_date);
94
-
95
- bool remove_info();
96
-
97
- bool is_encrypted() const;
98
- bool is_linearized() const;
99
- bool has_permission(permission_enum which) const;
100
- ustring metadata() const;
101
- bool get_pdf_id(std::string *permanent_id, std::string *update_id) const;
102
-
103
- int pages() const;
104
- page *create_page(const ustring &label) const;
105
- page *create_page(int index) const;
106
-
107
- std::vector<font_info> fonts() const;
108
- font_iterator *create_font_iterator(int start_page = 0) const;
109
-
110
- toc *create_toc() const;
111
-
112
- bool has_embedded_files() const;
113
- std::vector<embedded_file *> embedded_files() const;
114
-
115
- // Named destinations are bytestrings, not string.
116
- // So we use std::string instead of ustring.
117
- std::map<std::string, destination> create_destination_map() const;
118
-
119
- bool save(const std::string &file_name) const;
120
- bool save_a_copy(const std::string &file_name) const;
121
-
122
- static document *load_from_file(const std::string &file_name, const std::string &owner_password = std::string(), const std::string &user_password = std::string());
123
- static document *load_from_data(byte_array *file_data, const std::string &owner_password = std::string(), const std::string &user_password = std::string());
124
- static document *load_from_raw_data(const char *file_data, int file_data_length, const std::string &owner_password = std::string(), const std::string &user_password = std::string());
125
-
126
- private:
127
- explicit document(document_private &dd);
128
-
129
- document_private *d;
130
- friend class document_private;
131
- };
132
-
133
- }
134
-
135
- #endif
@@ -1,55 +0,0 @@
1
- /*
2
- * Copyright (C) 2009-2010, Pino Toscano <pino@kde.org>
3
- * Copyright (C) 2021, Albert Astals Cid <aacid@kde.org>
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2, or (at your option)
8
- * any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License
16
- * along with this program; if not, write to the Free Software
17
- * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
18
- */
19
-
20
- #ifndef POPPLER_EMBEDDED_FILE_H
21
- #define POPPLER_EMBEDDED_FILE_H
22
-
23
- #include "poppler-global.h"
24
-
25
- #include <vector>
26
-
27
- namespace poppler {
28
-
29
- class embedded_file_private;
30
-
31
- class POPPLER_CPP_EXPORT embedded_file : public poppler::noncopyable
32
- {
33
- public:
34
- ~embedded_file();
35
-
36
- bool is_valid() const;
37
- std::string name() const;
38
- ustring description() const;
39
- int size() const;
40
- time_type modification_date() const;
41
- time_type creation_date() const;
42
- byte_array checksum() const;
43
- std::string mime_type() const;
44
- byte_array data() const;
45
-
46
- private:
47
- explicit embedded_file(embedded_file_private &dd);
48
-
49
- embedded_file_private *d;
50
- friend class embedded_file_private;
51
- };
52
-
53
- }
54
-
55
- #endif
@@ -1,68 +0,0 @@
1
- /*
2
- * Copyright (C) 2009, Pino Toscano <pino@kde.org>
3
- * Copyright (C) 2015, Tamas Szekeres <szekerest@gmail.com>
4
- * Copyright (C) 2020, Suzuki Toshiya <mpsuzuki@hiroshima-u.ac.jp>
5
- * Copyright (C) 2021, Albert Astals Cid <aacid@kde.org>
6
- *
7
- * This program is free software; you can redistribute it and/or modify
8
- * it under the terms of the GNU General Public License as published by
9
- * the Free Software Foundation; either version 2, or (at your option)
10
- * any later version.
11
- *
12
- * This program is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- * GNU General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU General Public License
18
- * along with this program; if not, write to the Free Software
19
- * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
20
- */
21
-
22
- #include "poppler-font.h"
23
-
24
- #include "poppler-document-private.h"
25
-
26
- #include "FontInfo.h"
27
-
28
- #include <algorithm>
29
-
30
- using namespace poppler;
31
-
32
- class poppler::font_info_private
33
- {
34
- public:
35
- font_info_private() : type(font_info::unknown), is_embedded(false), is_subset(false) { }
36
- explicit font_info_private(FontInfo *fi) : type((font_info::type_enum)fi->getType()), is_embedded(fi->getEmbedded()), is_subset(fi->getSubset())
37
- {
38
- if (fi->getName()) {
39
- font_name = fi->getName()->c_str();
40
- }
41
- if (fi->getFile()) {
42
- font_file = fi->getFile()->c_str();
43
- }
44
-
45
- ref = fi->getRef();
46
- emb_ref = fi->getEmbRef();
47
- }
48
-
49
- std::string font_name;
50
- std::string font_file;
51
- font_info::type_enum type : 5;
52
- bool is_embedded : 1;
53
- bool is_subset : 1;
54
-
55
- Ref ref;
56
- Ref emb_ref;
57
- };
58
-
59
- class poppler::font_iterator_private
60
- {
61
- public:
62
- font_iterator_private(int start_page, document_private *dd) : font_info_scanner(dd->doc, start_page), total_pages(dd->doc->getNumPages()), current_page((std::max)(start_page, 0)) { }
63
- ~font_iterator_private() { }
64
-
65
- FontInfoScanner font_info_scanner;
66
- int total_pages;
67
- int current_page;
68
- };