pdf2json 0.1.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.
- data/README.markdown +9 -0
- data/bin/.gitkeep +0 -0
- data/ext/extconf.rb +30 -0
- data/lib/pdf2json.rb +8 -0
- data/pdf2json-0.52-source/AUTHORS +24 -0
- data/pdf2json-0.52-source/CHANGES +11 -0
- data/pdf2json-0.52-source/Makefile +84 -0
- data/pdf2json-0.52-source/Makefile.in +84 -0
- data/pdf2json-0.52-source/aclocal.m4 +274 -0
- data/pdf2json-0.52-source/aconf-win32.h +86 -0
- data/pdf2json-0.52-source/aconf.h +42 -0
- data/pdf2json-0.52-source/aconf.h.in +41 -0
- data/pdf2json-0.52-source/autom4te.cache/output.0 +6908 -0
- data/pdf2json-0.52-source/autom4te.cache/requests +76 -0
- data/pdf2json-0.52-source/autom4te.cache/traces.0 +466 -0
- data/pdf2json-0.52-source/config.log +1259 -0
- data/pdf2json-0.52-source/config.status +1050 -0
- data/pdf2json-0.52-source/configure +6908 -0
- data/pdf2json-0.52-source/configure.ac +93 -0
- data/pdf2json-0.52-source/doc/pdffonts.1 +130 -0
- data/pdf2json-0.52-source/doc/pdffonts.cat +107 -0
- data/pdf2json-0.52-source/doc/pdffonts.hlp +117 -0
- data/pdf2json-0.52-source/doc/pdfimages.1 +102 -0
- data/pdf2json-0.52-source/doc/pdfimages.cat +92 -0
- data/pdf2json-0.52-source/doc/pdfimages.hlp +101 -0
- data/pdf2json-0.52-source/doc/pdfinfo.1 +158 -0
- data/pdf2json-0.52-source/doc/pdfinfo.cat +119 -0
- data/pdf2json-0.52-source/doc/pdfinfo.hlp +129 -0
- data/pdf2json-0.52-source/doc/pdftoppm.1 +115 -0
- data/pdf2json-0.52-source/doc/pdftoppm.cat +105 -0
- data/pdf2json-0.52-source/doc/pdftoppm.hlp +114 -0
- data/pdf2json-0.52-source/doc/pdftops.1 +229 -0
- data/pdf2json-0.52-source/doc/pdftops.cat +221 -0
- data/pdf2json-0.52-source/doc/pdftops.hlp +231 -0
- data/pdf2json-0.52-source/doc/pdftotext.1 +137 -0
- data/pdf2json-0.52-source/doc/pdftotext.cat +120 -0
- data/pdf2json-0.52-source/doc/pdftotext.hlp +133 -0
- data/pdf2json-0.52-source/doc/sample-xpdfrc +91 -0
- data/pdf2json-0.52-source/doc/xpdf.1 +513 -0
- data/pdf2json-0.52-source/doc/xpdf.cat +476 -0
- data/pdf2json-0.52-source/doc/xpdf.hlp +489 -0
- data/pdf2json-0.52-source/doc/xpdfrc.5 +480 -0
- data/pdf2json-0.52-source/doc/xpdfrc.cat +474 -0
- data/pdf2json-0.52-source/doc/xpdfrc.hlp +479 -0
- data/pdf2json-0.52-source/fofi/.DS_Store +0 -0
- data/pdf2json-0.52-source/fofi/FoFiBase.cc +156 -0
- data/pdf2json-0.52-source/fofi/FoFiBase.h +57 -0
- data/pdf2json-0.52-source/fofi/FoFiBase.o +0 -0
- data/pdf2json-0.52-source/fofi/FoFiEncodings.cc +994 -0
- data/pdf2json-0.52-source/fofi/FoFiEncodings.h +36 -0
- data/pdf2json-0.52-source/fofi/FoFiEncodings.o +0 -0
- data/pdf2json-0.52-source/fofi/FoFiTrueType.cc +2027 -0
- data/pdf2json-0.52-source/fofi/FoFiTrueType.h +174 -0
- data/pdf2json-0.52-source/fofi/FoFiTrueType.o +0 -0
- data/pdf2json-0.52-source/fofi/FoFiType1.cc +252 -0
- data/pdf2json-0.52-source/fofi/FoFiType1.h +59 -0
- data/pdf2json-0.52-source/fofi/FoFiType1.o +0 -0
- data/pdf2json-0.52-source/fofi/FoFiType1C.cc +2603 -0
- data/pdf2json-0.52-source/fofi/FoFiType1C.h +233 -0
- data/pdf2json-0.52-source/fofi/FoFiType1C.o +0 -0
- data/pdf2json-0.52-source/fofi/Makefile +70 -0
- data/pdf2json-0.52-source/fofi/Makefile.dep +0 -0
- data/pdf2json-0.52-source/fofi/Makefile.in +70 -0
- data/pdf2json-0.52-source/fofi/libfofi.a +0 -0
- data/pdf2json-0.52-source/fofi/vms_make.com +0 -0
- data/pdf2json-0.52-source/freetype.win32/.DS_Store +0 -0
- data/pdf2json-0.52-source/freetype.win32/include/.DS_Store +0 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/config/ftconfig.h +528 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/config/ftheader.h +780 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/config/ftmodule.h +32 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/config/ftoption.h +733 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/config/ftstdlib.h +173 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/freetype.h +3919 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftadvanc.h +179 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftbbox.h +94 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftbdf.h +209 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftbitmap.h +227 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftcache.h +1128 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftchapters.h +103 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftcid.h +166 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/fterrdef.h +244 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/fterrors.h +206 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftgasp.h +120 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftglyph.h +613 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftgxval.h +358 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftgzip.h +102 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftimage.h +1313 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftincrem.h +353 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftlcdfil.h +213 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftlist.h +277 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftlzw.h +99 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftmac.h +274 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftmm.h +378 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftmodapi.h +483 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftmoderr.h +155 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftotval.h +203 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftoutln.h +537 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftpfr.h +172 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftrender.h +230 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftsizes.h +159 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftsnames.h +200 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftstroke.h +716 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftsynth.h +80 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftsystem.h +347 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/fttrigon.h +350 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/fttypes.h +588 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftwinfnt.h +274 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftxf86.h +83 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/autohint.h +231 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/ftcalc.h +179 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/ftdebug.h +250 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/ftdriver.h +422 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/ftgloadr.h +168 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/ftmemory.h +380 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/ftobjs.h +1428 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/ftpic.h +67 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/ftrfork.h +196 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/ftserv.h +620 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/ftstream.h +539 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/fttrace.h +139 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/ftvalid.h +150 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/internal.h +51 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/pcftypes.h +56 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/psaux.h +873 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/pshints.h +712 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/services/svbdf.h +77 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/services/svcid.h +83 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/services/svgldict.h +82 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/services/svgxval.h +72 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/services/svkern.h +51 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/services/svmm.h +104 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/services/svotval.h +55 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/services/svpfr.h +66 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/services/svpostnm.h +79 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/services/svpscmap.h +164 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/services/svpsinfo.h +92 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/services/svsfnt.h +102 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/services/svttcmap.h +106 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/services/svtteng.h +53 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/services/svttglyf.h +67 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/services/svwinfnt.h +50 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/services/svxf86nm.h +55 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/sfnt.h +897 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/t1types.h +270 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/tttypes.h +1543 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/t1tables.h +504 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ttnameid.h +1247 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/tttables.h +759 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/tttags.h +107 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ttunpat.h +59 -0
- data/pdf2json-0.52-source/freetype.win32/include/ft2build.h +39 -0
- data/pdf2json-0.52-source/freetype.win32/lib/freetype_a.lib +0 -0
- data/pdf2json-0.52-source/goo/.DS_Store +0 -0
- data/pdf2json-0.52-source/goo/FixedPoint.cc +118 -0
- data/pdf2json-0.52-source/goo/FixedPoint.h +155 -0
- data/pdf2json-0.52-source/goo/FixedPoint.o +0 -0
- data/pdf2json-0.52-source/goo/GHash.cc +380 -0
- data/pdf2json-0.52-source/goo/GHash.h +78 -0
- data/pdf2json-0.52-source/goo/GHash.o +0 -0
- data/pdf2json-0.52-source/goo/GList.cc +97 -0
- data/pdf2json-0.52-source/goo/GList.h +96 -0
- data/pdf2json-0.52-source/goo/GList.o +0 -0
- data/pdf2json-0.52-source/goo/GMutex.h +49 -0
- data/pdf2json-0.52-source/goo/GString.cc +724 -0
- data/pdf2json-0.52-source/goo/GString.cc.fixed +718 -0
- data/pdf2json-0.52-source/goo/GString.h +136 -0
- data/pdf2json-0.52-source/goo/GString.o +0 -0
- data/pdf2json-0.52-source/goo/ImgWriter.o +0 -0
- data/pdf2json-0.52-source/goo/JpegWriter.o +0 -0
- data/pdf2json-0.52-source/goo/Makefile +72 -0
- data/pdf2json-0.52-source/goo/Makefile.dep +0 -0
- data/pdf2json-0.52-source/goo/Makefile.in +72 -0
- data/pdf2json-0.52-source/goo/PNGWriter.o +0 -0
- data/pdf2json-0.52-source/goo/gfile.cc +731 -0
- data/pdf2json-0.52-source/goo/gfile.h +138 -0
- data/pdf2json-0.52-source/goo/gfile.o +0 -0
- data/pdf2json-0.52-source/goo/gmem.cc +264 -0
- data/pdf2json-0.52-source/goo/gmem.h +79 -0
- data/pdf2json-0.52-source/goo/gmem.o +0 -0
- data/pdf2json-0.52-source/goo/gmempp.cc +32 -0
- data/pdf2json-0.52-source/goo/gmempp.o +0 -0
- data/pdf2json-0.52-source/goo/gtypes.h +29 -0
- data/pdf2json-0.52-source/goo/libGoo.a +0 -0
- data/pdf2json-0.52-source/goo/parseargs.c +190 -0
- data/pdf2json-0.52-source/goo/parseargs.h +71 -0
- data/pdf2json-0.52-source/goo/parseargs.o +0 -0
- data/pdf2json-0.52-source/goo/vms_directory.c +214 -0
- data/pdf2json-0.52-source/goo/vms_dirent.h +67 -0
- data/pdf2json-0.52-source/goo/vms_make.com +82 -0
- data/pdf2json-0.52-source/goo/vms_sys_dirent.h +54 -0
- data/pdf2json-0.52-source/goo/vms_unix_time.h +102 -0
- data/pdf2json-0.52-source/goo/vms_unix_times.c +42 -0
- data/pdf2json-0.52-source/goo/vms_unlink.c +22 -0
- data/pdf2json-0.52-source/ms_make.bat +199 -0
- data/pdf2json-0.52-source/splash/.DS_Store +0 -0
- data/pdf2json-0.52-source/splash/Makefile +103 -0
- data/pdf2json-0.52-source/splash/Makefile.dep +0 -0
- data/pdf2json-0.52-source/splash/Makefile.in +103 -0
- data/pdf2json-0.52-source/splash/Splash.cc +3310 -0
- data/pdf2json-0.52-source/splash/Splash.h +293 -0
- data/pdf2json-0.52-source/splash/Splash.o +0 -0
- data/pdf2json-0.52-source/splash/SplashBitmap.cc +188 -0
- data/pdf2json-0.52-source/splash/SplashBitmap.h +64 -0
- data/pdf2json-0.52-source/splash/SplashBitmap.o +0 -0
- data/pdf2json-0.52-source/splash/SplashClip.cc +382 -0
- data/pdf2json-0.52-source/splash/SplashClip.h +107 -0
- data/pdf2json-0.52-source/splash/SplashClip.o +0 -0
- data/pdf2json-0.52-source/splash/SplashErrorCodes.h +32 -0
- data/pdf2json-0.52-source/splash/SplashFTFont.cc +357 -0
- data/pdf2json-0.52-source/splash/SplashFTFont.h +58 -0
- data/pdf2json-0.52-source/splash/SplashFTFont.o +0 -0
- data/pdf2json-0.52-source/splash/SplashFTFontEngine.cc +179 -0
- data/pdf2json-0.52-source/splash/SplashFTFontEngine.h +65 -0
- data/pdf2json-0.52-source/splash/SplashFTFontEngine.o +0 -0
- data/pdf2json-0.52-source/splash/SplashFTFontFile.cc +114 -0
- data/pdf2json-0.52-source/splash/SplashFTFontFile.h +73 -0
- data/pdf2json-0.52-source/splash/SplashFTFontFile.o +0 -0
- data/pdf2json-0.52-source/splash/SplashFont.cc +176 -0
- data/pdf2json-0.52-source/splash/SplashFont.h +104 -0
- data/pdf2json-0.52-source/splash/SplashFont.o +0 -0
- data/pdf2json-0.52-source/splash/SplashFontEngine.cc +317 -0
- data/pdf2json-0.52-source/splash/SplashFontEngine.h +91 -0
- data/pdf2json-0.52-source/splash/SplashFontEngine.o +0 -0
- data/pdf2json-0.52-source/splash/SplashFontFile.cc +55 -0
- data/pdf2json-0.52-source/splash/SplashFontFile.h +60 -0
- data/pdf2json-0.52-source/splash/SplashFontFile.o +0 -0
- data/pdf2json-0.52-source/splash/SplashFontFileID.cc +23 -0
- data/pdf2json-0.52-source/splash/SplashFontFileID.h +30 -0
- data/pdf2json-0.52-source/splash/SplashFontFileID.o +0 -0
- data/pdf2json-0.52-source/splash/SplashGlyphBitmap.h +26 -0
- data/pdf2json-0.52-source/splash/SplashMath.h +89 -0
- data/pdf2json-0.52-source/splash/SplashPath.cc +184 -0
- data/pdf2json-0.52-source/splash/SplashPath.h +121 -0
- data/pdf2json-0.52-source/splash/SplashPath.o +0 -0
- data/pdf2json-0.52-source/splash/SplashPattern.cc +40 -0
- data/pdf2json-0.52-source/splash/SplashPattern.h +65 -0
- data/pdf2json-0.52-source/splash/SplashPattern.o +0 -0
- data/pdf2json-0.52-source/splash/SplashScreen.cc +383 -0
- data/pdf2json-0.52-source/splash/SplashScreen.h +56 -0
- data/pdf2json-0.52-source/splash/SplashScreen.o +0 -0
- data/pdf2json-0.52-source/splash/SplashState.cc +165 -0
- data/pdf2json-0.52-source/splash/SplashState.h +103 -0
- data/pdf2json-0.52-source/splash/SplashState.o +0 -0
- data/pdf2json-0.52-source/splash/SplashT1Font.cc +287 -0
- data/pdf2json-0.52-source/splash/SplashT1Font.h +57 -0
- data/pdf2json-0.52-source/splash/SplashT1Font.o +0 -0
- data/pdf2json-0.52-source/splash/SplashT1FontEngine.cc +124 -0
- data/pdf2json-0.52-source/splash/SplashT1FontEngine.h +53 -0
- data/pdf2json-0.52-source/splash/SplashT1FontEngine.o +0 -0
- data/pdf2json-0.52-source/splash/SplashT1FontFile.cc +97 -0
- data/pdf2json-0.52-source/splash/SplashT1FontFile.h +58 -0
- data/pdf2json-0.52-source/splash/SplashT1FontFile.o +0 -0
- data/pdf2json-0.52-source/splash/SplashTypes.h +132 -0
- data/pdf2json-0.52-source/splash/SplashXPath.cc +438 -0
- data/pdf2json-0.52-source/splash/SplashXPath.h +100 -0
- data/pdf2json-0.52-source/splash/SplashXPath.o +0 -0
- data/pdf2json-0.52-source/splash/SplashXPathScanner.cc +428 -0
- data/pdf2json-0.52-source/splash/SplashXPathScanner.h +87 -0
- data/pdf2json-0.52-source/splash/SplashXPathScanner.o +0 -0
- data/pdf2json-0.52-source/splash/libsplash.a +0 -0
- data/pdf2json-0.52-source/splash/vms_make.com +0 -0
- data/pdf2json-0.52-source/src/.DS_Store +0 -0
- data/pdf2json-0.52-source/src/GVector.h +101 -0
- data/pdf2json-0.52-source/src/ImgOutputDev.cc +1243 -0
- data/pdf2json-0.52-source/src/ImgOutputDev.h +307 -0
- data/pdf2json-0.52-source/src/ImgOutputDev.o +0 -0
- data/pdf2json-0.52-source/src/Makefile +68 -0
- data/pdf2json-0.52-source/src/Makefile.in +68 -0
- data/pdf2json-0.52-source/src/XmlFonts.cc +367 -0
- data/pdf2json-0.52-source/src/XmlFonts.h +91 -0
- data/pdf2json-0.52-source/src/XmlFonts.o +0 -0
- data/pdf2json-0.52-source/src/XmlLinks.cc +101 -0
- data/pdf2json-0.52-source/src/XmlLinks.h +54 -0
- data/pdf2json-0.52-source/src/XmlLinks.o +0 -0
- data/pdf2json-0.52-source/src/pdf2json +0 -0
- data/pdf2json-0.52-source/src/pdf2json.cc +343 -0
- data/pdf2json-0.52-source/src/pdf2json.o +0 -0
- data/pdf2json-0.52-source/src/pdf2xml.dtd +22 -0
- data/pdf2json-0.52-source/src/pdf2xmljson.dtd +9 -0
- data/pdf2json-0.52-source/xpdf/.DS_Store +0 -0
- data/pdf2json-0.52-source/xpdf/Annot.cc +1556 -0
- data/pdf2json-0.52-source/xpdf/Annot.h +142 -0
- data/pdf2json-0.52-source/xpdf/Annot.o +0 -0
- data/pdf2json-0.52-source/xpdf/Array.cc +73 -0
- data/pdf2json-0.52-source/xpdf/Array.h +58 -0
- data/pdf2json-0.52-source/xpdf/Array.o +0 -0
- data/pdf2json-0.52-source/xpdf/BuiltinFont.cc +65 -0
- data/pdf2json-0.52-source/xpdf/BuiltinFont.h +57 -0
- data/pdf2json-0.52-source/xpdf/BuiltinFont.o +0 -0
- data/pdf2json-0.52-source/xpdf/BuiltinFontTables.cc +4284 -0
- data/pdf2json-0.52-source/xpdf/BuiltinFontTables.h +23 -0
- data/pdf2json-0.52-source/xpdf/BuiltinFontTables.o +0 -0
- data/pdf2json-0.52-source/xpdf/CMap.cc +408 -0
- data/pdf2json-0.52-source/xpdf/CMap.h +102 -0
- data/pdf2json-0.52-source/xpdf/CMap.o +0 -0
- data/pdf2json-0.52-source/xpdf/Catalog.cc +374 -0
- data/pdf2json-0.52-source/xpdf/Catalog.h +97 -0
- data/pdf2json-0.52-source/xpdf/Catalog.o +0 -0
- data/pdf2json-0.52-source/xpdf/CharCodeToUnicode.cc +540 -0
- data/pdf2json-0.52-source/xpdf/CharCodeToUnicode.h +117 -0
- data/pdf2json-0.52-source/xpdf/CharCodeToUnicode.o +0 -0
- data/pdf2json-0.52-source/xpdf/CharTypes.h +24 -0
- data/pdf2json-0.52-source/xpdf/CompactFontTables.h +464 -0
- data/pdf2json-0.52-source/xpdf/CoreOutputDev.cc +61 -0
- data/pdf2json-0.52-source/xpdf/CoreOutputDev.h +61 -0
- data/pdf2json-0.52-source/xpdf/Decrypt.cc +776 -0
- data/pdf2json-0.52-source/xpdf/Decrypt.h +95 -0
- data/pdf2json-0.52-source/xpdf/Decrypt.o +0 -0
- data/pdf2json-0.52-source/xpdf/Dict.cc +95 -0
- data/pdf2json-0.52-source/xpdf/Dict.h +77 -0
- data/pdf2json-0.52-source/xpdf/Dict.o +0 -0
- data/pdf2json-0.52-source/xpdf/Error.cc +38 -0
- data/pdf2json-0.52-source/xpdf/Error.h +23 -0
- data/pdf2json-0.52-source/xpdf/Error.o +0 -0
- data/pdf2json-0.52-source/xpdf/ErrorCodes.h +36 -0
- data/pdf2json-0.52-source/xpdf/FontEncodingTables.cc +1824 -0
- data/pdf2json-0.52-source/xpdf/FontEncodingTables.h +20 -0
- data/pdf2json-0.52-source/xpdf/FontEncodingTables.o +0 -0
- data/pdf2json-0.52-source/xpdf/Function.cc +1573 -0
- data/pdf2json-0.52-source/xpdf/Function.h +229 -0
- data/pdf2json-0.52-source/xpdf/Function.o +0 -0
- data/pdf2json-0.52-source/xpdf/Gfx.cc +4187 -0
- data/pdf2json-0.52-source/xpdf/Gfx.h +312 -0
- data/pdf2json-0.52-source/xpdf/Gfx.o +0 -0
- data/pdf2json-0.52-source/xpdf/GfxFont.cc +1568 -0
- data/pdf2json-0.52-source/xpdf/GfxFont.h +320 -0
- data/pdf2json-0.52-source/xpdf/GfxFont.o +0 -0
- data/pdf2json-0.52-source/xpdf/GfxState.cc +4137 -0
- data/pdf2json-0.52-source/xpdf/GfxState.h +1244 -0
- data/pdf2json-0.52-source/xpdf/GfxState.o +0 -0
- data/pdf2json-0.52-source/xpdf/GlobalParams.cc +2924 -0
- data/pdf2json-0.52-source/xpdf/GlobalParams.cc.old +2908 -0
- data/pdf2json-0.52-source/xpdf/GlobalParams.h +466 -0
- data/pdf2json-0.52-source/xpdf/GlobalParams.h.old +463 -0
- data/pdf2json-0.52-source/xpdf/GlobalParams.o +0 -0
- data/pdf2json-0.52-source/xpdf/ImageOutputDev.cc +195 -0
- data/pdf2json-0.52-source/xpdf/ImageOutputDev.h +76 -0
- data/pdf2json-0.52-source/xpdf/ImageOutputDev.o +0 -0
- data/pdf2json-0.52-source/xpdf/JArithmeticDecoder.cc +322 -0
- data/pdf2json-0.52-source/xpdf/JArithmeticDecoder.h +109 -0
- data/pdf2json-0.52-source/xpdf/JArithmeticDecoder.o +0 -0
- data/pdf2json-0.52-source/xpdf/JBIG2Stream.cc +3413 -0
- data/pdf2json-0.52-source/xpdf/JBIG2Stream.h +145 -0
- data/pdf2json-0.52-source/xpdf/JBIG2Stream.o +0 -0
- data/pdf2json-0.52-source/xpdf/JPXStream.cc +3144 -0
- data/pdf2json-0.52-source/xpdf/JPXStream.h +351 -0
- data/pdf2json-0.52-source/xpdf/JPXStream.o +0 -0
- data/pdf2json-0.52-source/xpdf/Lexer.cc +485 -0
- data/pdf2json-0.52-source/xpdf/Lexer.h +80 -0
- data/pdf2json-0.52-source/xpdf/Lexer.o +0 -0
- data/pdf2json-0.52-source/xpdf/Link.cc +806 -0
- data/pdf2json-0.52-source/xpdf/Link.cc.old +784 -0
- data/pdf2json-0.52-source/xpdf/Link.h +415 -0
- data/pdf2json-0.52-source/xpdf/Link.h.old +369 -0
- data/pdf2json-0.52-source/xpdf/Link.o +0 -0
- data/pdf2json-0.52-source/xpdf/Makefile +232 -0
- data/pdf2json-0.52-source/xpdf/Makefile.dep +0 -0
- data/pdf2json-0.52-source/xpdf/Makefile.in +232 -0
- data/pdf2json-0.52-source/xpdf/NameToCharCode.cc +116 -0
- data/pdf2json-0.52-source/xpdf/NameToCharCode.h +42 -0
- data/pdf2json-0.52-source/xpdf/NameToCharCode.o +0 -0
- data/pdf2json-0.52-source/xpdf/NameToUnicodeTable.h +1097 -0
- data/pdf2json-0.52-source/xpdf/Object.cc +231 -0
- data/pdf2json-0.52-source/xpdf/Object.h +303 -0
- data/pdf2json-0.52-source/xpdf/Object.o +0 -0
- data/pdf2json-0.52-source/xpdf/Outline.cc +151 -0
- data/pdf2json-0.52-source/xpdf/Outline.h +76 -0
- data/pdf2json-0.52-source/xpdf/Outline.o +0 -0
- data/pdf2json-0.52-source/xpdf/OutputDev.cc +131 -0
- data/pdf2json-0.52-source/xpdf/OutputDev.h +253 -0
- data/pdf2json-0.52-source/xpdf/OutputDev.o +0 -0
- data/pdf2json-0.52-source/xpdf/PDFCore.cc +2044 -0
- data/pdf2json-0.52-source/xpdf/PDFCore.h +321 -0
- data/pdf2json-0.52-source/xpdf/PDFDoc.cc +404 -0
- data/pdf2json-0.52-source/xpdf/PDFDoc.h +183 -0
- data/pdf2json-0.52-source/xpdf/PDFDoc.o +0 -0
- data/pdf2json-0.52-source/xpdf/PDFDocEncoding.cc +44 -0
- data/pdf2json-0.52-source/xpdf/PDFDocEncoding.h +16 -0
- data/pdf2json-0.52-source/xpdf/PDFDocEncoding.o +0 -0
- data/pdf2json-0.52-source/xpdf/PSOutputDev.cc +6224 -0
- data/pdf2json-0.52-source/xpdf/PSOutputDev.h +395 -0
- data/pdf2json-0.52-source/xpdf/PSOutputDev.o +0 -0
- data/pdf2json-0.52-source/xpdf/PSTokenizer.cc +135 -0
- data/pdf2json-0.52-source/xpdf/PSTokenizer.h +41 -0
- data/pdf2json-0.52-source/xpdf/PSTokenizer.o +0 -0
- data/pdf2json-0.52-source/xpdf/Page.cc +454 -0
- data/pdf2json-0.52-source/xpdf/Page.h +187 -0
- data/pdf2json-0.52-source/xpdf/Page.o +0 -0
- data/pdf2json-0.52-source/xpdf/Parser.cc +227 -0
- data/pdf2json-0.52-source/xpdf/Parser.h +59 -0
- data/pdf2json-0.52-source/xpdf/Parser.o +0 -0
- data/pdf2json-0.52-source/xpdf/PreScanOutputDev.cc +257 -0
- data/pdf2json-0.52-source/xpdf/PreScanOutputDev.h +130 -0
- data/pdf2json-0.52-source/xpdf/PreScanOutputDev.o +0 -0
- data/pdf2json-0.52-source/xpdf/SecurityHandler.cc +390 -0
- data/pdf2json-0.52-source/xpdf/SecurityHandler.h +160 -0
- data/pdf2json-0.52-source/xpdf/SecurityHandler.o +0 -0
- data/pdf2json-0.52-source/xpdf/SplashOutputDev.cc +2845 -0
- data/pdf2json-0.52-source/xpdf/SplashOutputDev.h +247 -0
- data/pdf2json-0.52-source/xpdf/SplashOutputDev.o +0 -0
- data/pdf2json-0.52-source/xpdf/Stream-CCITT.h +459 -0
- data/pdf2json-0.52-source/xpdf/Stream.cc +4627 -0
- data/pdf2json-0.52-source/xpdf/Stream.h +858 -0
- data/pdf2json-0.52-source/xpdf/Stream.o +0 -0
- data/pdf2json-0.52-source/xpdf/TextOutputDev.cc +4090 -0
- data/pdf2json-0.52-source/xpdf/TextOutputDev.h +661 -0
- data/pdf2json-0.52-source/xpdf/TextOutputDev.o +0 -0
- data/pdf2json-0.52-source/xpdf/UTF8.h +56 -0
- data/pdf2json-0.52-source/xpdf/UnicodeMap.cc +302 -0
- data/pdf2json-0.52-source/xpdf/UnicodeMap.cc.old +293 -0
- data/pdf2json-0.52-source/xpdf/UnicodeMap.h +135 -0
- data/pdf2json-0.52-source/xpdf/UnicodeMap.h.old +123 -0
- data/pdf2json-0.52-source/xpdf/UnicodeMap.o +0 -0
- data/pdf2json-0.52-source/xpdf/UnicodeMapTables.h +361 -0
- data/pdf2json-0.52-source/xpdf/UnicodeTypeTable.cc +949 -0
- data/pdf2json-0.52-source/xpdf/UnicodeTypeTable.h +20 -0
- data/pdf2json-0.52-source/xpdf/UnicodeTypeTable.o +0 -0
- data/pdf2json-0.52-source/xpdf/XPDFApp.cc +447 -0
- data/pdf2json-0.52-source/xpdf/XPDFApp.h +114 -0
- data/pdf2json-0.52-source/xpdf/XPDFCore.cc +1655 -0
- data/pdf2json-0.52-source/xpdf/XPDFCore.h +251 -0
- data/pdf2json-0.52-source/xpdf/XPDFTree.cc +931 -0
- data/pdf2json-0.52-source/xpdf/XPDFTree.h +45 -0
- data/pdf2json-0.52-source/xpdf/XPDFTreeP.h +87 -0
- data/pdf2json-0.52-source/xpdf/XPDFViewer.cc +3488 -0
- data/pdf2json-0.52-source/xpdf/XPDFViewer.h +352 -0
- data/pdf2json-0.52-source/xpdf/XRef.cc +896 -0
- data/pdf2json-0.52-source/xpdf/XRef.h +133 -0
- data/pdf2json-0.52-source/xpdf/XRef.o +0 -0
- data/pdf2json-0.52-source/xpdf/XpdfPluginAPI.cc +262 -0
- data/pdf2json-0.52-source/xpdf/XpdfPluginAPI.h +341 -0
- data/pdf2json-0.52-source/xpdf/XpdfPluginAPI.o +0 -0
- data/pdf2json-0.52-source/xpdf/about-text.h +48 -0
- data/pdf2json-0.52-source/xpdf/about.xbm +6 -0
- data/pdf2json-0.52-source/xpdf/backArrow.xbm +6 -0
- data/pdf2json-0.52-source/xpdf/backArrowDis.xbm +6 -0
- data/pdf2json-0.52-source/xpdf/config.h +112 -0
- data/pdf2json-0.52-source/xpdf/dblLeftArrow.xbm +6 -0
- data/pdf2json-0.52-source/xpdf/dblLeftArrowDis.xbm +6 -0
- data/pdf2json-0.52-source/xpdf/dblRightArrow.xbm +6 -0
- data/pdf2json-0.52-source/xpdf/dblRightArrowDis.xbm +6 -0
- data/pdf2json-0.52-source/xpdf/find.xbm +6 -0
- data/pdf2json-0.52-source/xpdf/findDis.xbm +6 -0
- data/pdf2json-0.52-source/xpdf/forwardArrow.xbm +6 -0
- data/pdf2json-0.52-source/xpdf/forwardArrowDis.xbm +6 -0
- data/pdf2json-0.52-source/xpdf/leftArrow.xbm +5 -0
- data/pdf2json-0.52-source/xpdf/leftArrowDis.xbm +5 -0
- data/pdf2json-0.52-source/xpdf/libXpdf.a +0 -0
- data/pdf2json-0.52-source/xpdf/pdffonts +0 -0
- data/pdf2json-0.52-source/xpdf/pdffonts.cc +298 -0
- data/pdf2json-0.52-source/xpdf/pdffonts.o +0 -0
- data/pdf2json-0.52-source/xpdf/pdfimages +0 -0
- data/pdf2json-0.52-source/xpdf/pdfimages.cc +155 -0
- data/pdf2json-0.52-source/xpdf/pdfimages.o +0 -0
- data/pdf2json-0.52-source/xpdf/pdfinfo +0 -0
- data/pdf2json-0.52-source/xpdf/pdfinfo.cc +387 -0
- data/pdf2json-0.52-source/xpdf/pdfinfo.o +0 -0
- data/pdf2json-0.52-source/xpdf/pdftoppm.cc +203 -0
- data/pdf2json-0.52-source/xpdf/pdftops +0 -0
- data/pdf2json-0.52-source/xpdf/pdftops.cc +344 -0
- data/pdf2json-0.52-source/xpdf/pdftops.o +0 -0
- data/pdf2json-0.52-source/xpdf/pdftotext +0 -0
- data/pdf2json-0.52-source/xpdf/pdftotext.cc +333 -0
- data/pdf2json-0.52-source/xpdf/pdftotext.o +0 -0
- data/pdf2json-0.52-source/xpdf/print.xbm +6 -0
- data/pdf2json-0.52-source/xpdf/printDis.xbm +6 -0
- data/pdf2json-0.52-source/xpdf/rightArrow.xbm +5 -0
- data/pdf2json-0.52-source/xpdf/rightArrowDis.xbm +5 -0
- data/pdf2json-0.52-source/xpdf/vms_make.com +129 -0
- data/pdf2json-0.52-source/xpdf/xpdf.cc +344 -0
- data/pdf2json-0.52-source/xpdf/xpdfIcon.xpm +62 -0
- data/pdf2json.gemspec +29 -0
- metadata +518 -0
@@ -0,0 +1,352 @@
|
|
1
|
+
//========================================================================
|
2
|
+
//
|
3
|
+
// XPDFViewer.h
|
4
|
+
//
|
5
|
+
// Copyright 2002-2003 Glyph & Cog, LLC
|
6
|
+
//
|
7
|
+
//========================================================================
|
8
|
+
|
9
|
+
#ifndef XPDFVIEWER_H
|
10
|
+
#define XPDFVIEWER_H
|
11
|
+
|
12
|
+
#include <aconf.h>
|
13
|
+
|
14
|
+
#ifdef USE_GCC_PRAGMAS
|
15
|
+
#pragma interface
|
16
|
+
#endif
|
17
|
+
|
18
|
+
#define Object XtObject
|
19
|
+
#include <Xm/XmAll.h>
|
20
|
+
#undef Object
|
21
|
+
#include "gtypes.h"
|
22
|
+
#include "XPDFCore.h"
|
23
|
+
|
24
|
+
#if (XmVERSION <= 1) && !defined(__sgi)
|
25
|
+
#define DISABLE_OUTLINE
|
26
|
+
#endif
|
27
|
+
|
28
|
+
#if (XmVERSION >= 2 && !defined(LESSTIF_VERSION))
|
29
|
+
# define USE_COMBO_BOX 1
|
30
|
+
#else
|
31
|
+
# undef USE_COMBO_BOX
|
32
|
+
#endif
|
33
|
+
|
34
|
+
class GString;
|
35
|
+
class GList;
|
36
|
+
class UnicodeMap;
|
37
|
+
class LinkDest;
|
38
|
+
class XPDFApp;
|
39
|
+
class XPDFViewer;
|
40
|
+
|
41
|
+
//------------------------------------------------------------------------
|
42
|
+
|
43
|
+
// NB: this must match the defn of zoomMenuBtnInfo in XPDFViewer.cc
|
44
|
+
#define nZoomMenuItems 10
|
45
|
+
|
46
|
+
//------------------------------------------------------------------------
|
47
|
+
|
48
|
+
struct XPDFViewerCmd {
|
49
|
+
char *name;
|
50
|
+
int nArgs;
|
51
|
+
GBool requiresDoc;
|
52
|
+
GBool requiresEvent;
|
53
|
+
void (XPDFViewer::*func)(GString *args[], int nArgs, XEvent *event);
|
54
|
+
};
|
55
|
+
|
56
|
+
//------------------------------------------------------------------------
|
57
|
+
// XPDFViewer
|
58
|
+
//------------------------------------------------------------------------
|
59
|
+
|
60
|
+
class XPDFViewer {
|
61
|
+
public:
|
62
|
+
|
63
|
+
XPDFViewer(XPDFApp *appA, GString *fileName,
|
64
|
+
int pageA, GString *destName, GBool fullScreen,
|
65
|
+
GString *ownerPassword, GString *userPassword);
|
66
|
+
XPDFViewer(XPDFApp *appA, PDFDoc *doc, int pageA,
|
67
|
+
GString *destName, GBool fullScreen);
|
68
|
+
GBool isOk() { return ok; }
|
69
|
+
~XPDFViewer();
|
70
|
+
|
71
|
+
void open(GString *fileName, int pageA, GString *destName);
|
72
|
+
void clear();
|
73
|
+
void reloadFile();
|
74
|
+
|
75
|
+
void execCmd(GString *cmd, XEvent *event);
|
76
|
+
|
77
|
+
Widget getWindow() { return win; }
|
78
|
+
|
79
|
+
private:
|
80
|
+
|
81
|
+
//----- load / display
|
82
|
+
GBool loadFile(GString *fileName, GString *ownerPassword = NULL,
|
83
|
+
GString *userPassword = NULL);
|
84
|
+
void displayPage(int pageA, double zoomA, int rotateA,
|
85
|
+
GBool scrollToTop, GBool addToHist);
|
86
|
+
void displayDest(LinkDest *dest, double zoomA, int rotateA,
|
87
|
+
GBool addToHist);
|
88
|
+
void getPageAndDest(int pageA, GString *destName,
|
89
|
+
int *pageOut, LinkDest **destOut);
|
90
|
+
|
91
|
+
//----- hyperlinks / actions
|
92
|
+
void doLink(int wx, int wy, GBool onlyIfNoSelection, GBool newWin);
|
93
|
+
static void actionCbk(void *data, char *action);
|
94
|
+
|
95
|
+
//----- keyboard/mouse input
|
96
|
+
static void keyPressCbk(void *data, KeySym key, Guint modifiers,
|
97
|
+
XEvent *event);
|
98
|
+
static void mouseCbk(void *data, XEvent *event);
|
99
|
+
int getModifiers(Guint modifiers);
|
100
|
+
int getContext(Guint modifiers);
|
101
|
+
|
102
|
+
//----- command functions
|
103
|
+
void cmdAbout(GString *args[], int nArgs, XEvent *event);
|
104
|
+
void cmdCloseOutline(GString *args[], int nArgs, XEvent *event);
|
105
|
+
void cmdCloseWindow(GString *args[], int nArgs, XEvent *event);
|
106
|
+
void cmdContinuousMode(GString *args[], int nArgs, XEvent *event);
|
107
|
+
void cmdEndPan(GString *args[], int nArgs, XEvent *event);
|
108
|
+
void cmdEndSelection(GString *args[], int nArgs, XEvent *event);
|
109
|
+
void cmdFind(GString *args[], int nArgs, XEvent *event);
|
110
|
+
void cmdFindNext(GString *args[], int nArgs, XEvent *event);
|
111
|
+
void cmdFocusToDocWin(GString *args[], int nArgs, XEvent *event);
|
112
|
+
void cmdFocusToPageNum(GString *args[], int nArgs, XEvent *event);
|
113
|
+
void cmdFollowLink(GString *args[], int nArgs, XEvent *event);
|
114
|
+
void cmdFollowLinkInNewWin(GString *args[], int nArgs, XEvent *event);
|
115
|
+
void cmdFollowLinkInNewWinNoSel(GString *args[], int nArgs, XEvent *event);
|
116
|
+
void cmdFollowLinkNoSel(GString *args[], int nArgs, XEvent *event);
|
117
|
+
void cmdFullScreenMode(GString *args[], int nArgs, XEvent *event);
|
118
|
+
void cmdGoBackward(GString *args[], int nArgs, XEvent *event);
|
119
|
+
void cmdGoForward(GString *args[], int nArgs, XEvent *event);
|
120
|
+
void cmdGotoDest(GString *args[], int nArgs, XEvent *event);
|
121
|
+
void cmdGotoLastPage(GString *args[], int nArgs, XEvent *event);
|
122
|
+
void cmdGotoLastPageNoScroll(GString *args[], int nArgs, XEvent *event);
|
123
|
+
void cmdGotoPage(GString *args[], int nArgs, XEvent *event);
|
124
|
+
void cmdGotoPageNoScroll(GString *args[], int nArgs, XEvent *event);
|
125
|
+
void cmdNextPage(GString *args[], int nArgs, XEvent *event);
|
126
|
+
void cmdNextPageNoScroll(GString *args[], int nArgs, XEvent *event);
|
127
|
+
void cmdOpen(GString *args[], int nArgs, XEvent *event);
|
128
|
+
void cmdOpenFile(GString *args[], int nArgs, XEvent *event);
|
129
|
+
void cmdOpenFileAtDest(GString *args[], int nArgs, XEvent *event);
|
130
|
+
void cmdOpenFileAtDestInNewWin(GString *args[], int nArgs, XEvent *event);
|
131
|
+
void cmdOpenFileAtPage(GString *args[], int nArgs, XEvent *event);
|
132
|
+
void cmdOpenFileAtPageInNewWin(GString *args[], int nArgs, XEvent *event);
|
133
|
+
void cmdOpenFileInNewWin(GString *args[], int nArgs, XEvent *event);
|
134
|
+
void cmdOpenInNewWin(GString *args[], int nArgs, XEvent *event);
|
135
|
+
void cmdOpenOutline(GString *args[], int nArgs, XEvent *event);
|
136
|
+
void cmdPageDown(GString *args[], int nArgs, XEvent *event);
|
137
|
+
void cmdPageUp(GString *args[], int nArgs, XEvent *event);
|
138
|
+
void cmdPostPopupMenu(GString *args[], int nArgs, XEvent *event);
|
139
|
+
void cmdPrevPage(GString *args[], int nArgs, XEvent *event);
|
140
|
+
void cmdPrevPageNoScroll(GString *args[], int nArgs, XEvent *event);
|
141
|
+
void cmdPrint(GString *args[], int nArgs, XEvent *event);
|
142
|
+
void cmdQuit(GString *args[], int nArgs, XEvent *event);
|
143
|
+
void cmdRaise(GString *args[], int nArgs, XEvent *event);
|
144
|
+
void cmdRedraw(GString *args[], int nArgs, XEvent *event);
|
145
|
+
void cmdReload(GString *args[], int nArgs, XEvent *event);
|
146
|
+
void cmdRun(GString *args[], int nArgs, XEvent *event);
|
147
|
+
void cmdScrollDown(GString *args[], int nArgs, XEvent *event);
|
148
|
+
void cmdScrollDownNextPage(GString *args[], int nArgs, XEvent *event);
|
149
|
+
void cmdScrollLeft(GString *args[], int nArgs, XEvent *event);
|
150
|
+
void cmdScrollOutlineDown(GString *args[], int nArgs, XEvent *event);
|
151
|
+
void cmdScrollOutlineUp(GString *args[], int nArgs, XEvent *event);
|
152
|
+
void cmdScrollRight(GString *args[], int nArgs, XEvent *event);
|
153
|
+
void cmdScrollToBottomEdge(GString *args[], int nArgs, XEvent *event);
|
154
|
+
void cmdScrollToBottomRight(GString *args[], int nArgs, XEvent *event);
|
155
|
+
void cmdScrollToLeftEdge(GString *args[], int nArgs, XEvent *event);
|
156
|
+
void cmdScrollToRightEdge(GString *args[], int nArgs, XEvent *event);
|
157
|
+
void cmdScrollToTopEdge(GString *args[], int nArgs, XEvent *event);
|
158
|
+
void cmdScrollToTopLeft(GString *args[], int nArgs, XEvent *event);
|
159
|
+
void cmdScrollUp(GString *args[], int nArgs, XEvent *event);
|
160
|
+
void cmdScrollUpPrevPage(GString *args[], int nArgs, XEvent *event);
|
161
|
+
void cmdSinglePageMode(GString *args[], int nArgs, XEvent *event);
|
162
|
+
void cmdStartPan(GString *args[], int nArgs, XEvent *event);
|
163
|
+
void cmdStartSelection(GString *args[], int nArgs, XEvent *event);
|
164
|
+
void cmdToggleContinuousMode(GString *args[], int nArgs, XEvent *event);
|
165
|
+
void cmdToggleFullScreenMode(GString *args[], int nArgs, XEvent *event);
|
166
|
+
void cmdToggleOutline(GString *args[], int nArgs, XEvent *event);
|
167
|
+
void cmdWindowMode(GString *args[], int nArgs, XEvent *event);
|
168
|
+
void cmdZoomFitPage(GString *args[], int nArgs, XEvent *event);
|
169
|
+
void cmdZoomFitWidth(GString *args[], int nArgs, XEvent *event);
|
170
|
+
void cmdZoomIn(GString *args[], int nArgs, XEvent *event);
|
171
|
+
void cmdZoomOut(GString *args[], int nArgs, XEvent *event);
|
172
|
+
void cmdZoomPercent(GString *args[], int nArgs, XEvent *event);
|
173
|
+
void cmdZoomToSelection(GString *args[], int nArgs, XEvent *event);
|
174
|
+
|
175
|
+
//----- GUI code: main window
|
176
|
+
void initWindow(GBool fullScreen);
|
177
|
+
void initToolbar(Widget parent);
|
178
|
+
#ifndef DISABLE_OUTLINE
|
179
|
+
void initPanedWin(Widget parent);
|
180
|
+
#endif
|
181
|
+
void initCore(Widget parent, GBool fullScreen);
|
182
|
+
void initPopupMenu();
|
183
|
+
void addToolTip(Widget widget, char *text);
|
184
|
+
void mapWindow();
|
185
|
+
void closeWindow();
|
186
|
+
int getZoomIdx();
|
187
|
+
void setZoomIdx(int idx);
|
188
|
+
void setZoomVal(double z);
|
189
|
+
static void prevPageCbk(Widget widget, XtPointer ptr,
|
190
|
+
XtPointer callData);
|
191
|
+
static void prevTenPageCbk(Widget widget, XtPointer ptr,
|
192
|
+
XtPointer callData);
|
193
|
+
static void nextPageCbk(Widget widget, XtPointer ptr,
|
194
|
+
XtPointer callData);
|
195
|
+
static void nextTenPageCbk(Widget widget, XtPointer ptr,
|
196
|
+
XtPointer callData);
|
197
|
+
static void backCbk(Widget widget, XtPointer ptr,
|
198
|
+
XtPointer callData);
|
199
|
+
static void forwardCbk(Widget widget, XtPointer ptr,
|
200
|
+
XtPointer callData);
|
201
|
+
#if USE_COMBO_BOX
|
202
|
+
static void zoomComboBoxCbk(Widget widget, XtPointer ptr,
|
203
|
+
XtPointer callData);
|
204
|
+
#else
|
205
|
+
static void zoomMenuCbk(Widget widget, XtPointer ptr,
|
206
|
+
XtPointer callData);
|
207
|
+
#endif
|
208
|
+
static void findCbk(Widget widget, XtPointer ptr,
|
209
|
+
XtPointer callData);
|
210
|
+
static void printCbk(Widget widget, XtPointer ptr,
|
211
|
+
XtPointer callData);
|
212
|
+
static void aboutCbk(Widget widget, XtPointer ptr,
|
213
|
+
XtPointer callData);
|
214
|
+
static void quitCbk(Widget widget, XtPointer ptr,
|
215
|
+
XtPointer callData);
|
216
|
+
static void openCbk(Widget widget, XtPointer ptr,
|
217
|
+
XtPointer callData);
|
218
|
+
static void openInNewWindowCbk(Widget widget, XtPointer ptr,
|
219
|
+
XtPointer callData);
|
220
|
+
static void reloadCbk(Widget widget, XtPointer ptr,
|
221
|
+
XtPointer callData);
|
222
|
+
static void saveAsCbk(Widget widget, XtPointer ptr,
|
223
|
+
XtPointer callData);
|
224
|
+
static void continuousModeToggleCbk(Widget widget, XtPointer ptr,
|
225
|
+
XtPointer callData);
|
226
|
+
static void fullScreenToggleCbk(Widget widget, XtPointer ptr,
|
227
|
+
XtPointer callData);
|
228
|
+
static void rotateCCWCbk(Widget widget, XtPointer ptr,
|
229
|
+
XtPointer callData);
|
230
|
+
static void rotateCWCbk(Widget widget, XtPointer ptr,
|
231
|
+
XtPointer callData);
|
232
|
+
static void zoomToSelectionCbk(Widget widget, XtPointer ptr,
|
233
|
+
XtPointer callData);
|
234
|
+
static void closeCbk(Widget widget, XtPointer ptr,
|
235
|
+
XtPointer callData);
|
236
|
+
static void closeMsgCbk(Widget widget, XtPointer ptr,
|
237
|
+
XtPointer callData);
|
238
|
+
static void pageNumCbk(Widget widget, XtPointer ptr,
|
239
|
+
XtPointer callData);
|
240
|
+
static void updateCbk(void *data, GString *fileName,
|
241
|
+
int pageNum, int numPages, char *linkString);
|
242
|
+
|
243
|
+
//----- GUI code: outline
|
244
|
+
#ifndef DISABLE_OUTLINE
|
245
|
+
void setupOutline();
|
246
|
+
void setupOutlineItems(GList *items, Widget parent, UnicodeMap *uMap);
|
247
|
+
static void outlineSelectCbk(Widget widget, XtPointer ptr,
|
248
|
+
XtPointer callData);
|
249
|
+
#endif
|
250
|
+
|
251
|
+
//----- GUI code: "about" dialog
|
252
|
+
void initAboutDialog();
|
253
|
+
|
254
|
+
//----- GUI code: "open" dialog
|
255
|
+
void initOpenDialog();
|
256
|
+
void mapOpenDialog(GBool openInNewWindowA);
|
257
|
+
static void openOkCbk(Widget widget, XtPointer ptr,
|
258
|
+
XtPointer callData);
|
259
|
+
|
260
|
+
//----- GUI code: "find" dialog
|
261
|
+
void initFindDialog();
|
262
|
+
static void findFindCbk(Widget widget, XtPointer ptr,
|
263
|
+
XtPointer callData);
|
264
|
+
void mapFindDialog();
|
265
|
+
void doFind(GBool next);
|
266
|
+
static void findCloseCbk(Widget widget, XtPointer ptr,
|
267
|
+
XtPointer callData);
|
268
|
+
|
269
|
+
//----- GUI code: "save as" dialog
|
270
|
+
void initSaveAsDialog();
|
271
|
+
void mapSaveAsDialog();
|
272
|
+
static void saveAsOkCbk(Widget widget, XtPointer ptr,
|
273
|
+
XtPointer callData);
|
274
|
+
|
275
|
+
//----- GUI code: "print" dialog
|
276
|
+
void initPrintDialog();
|
277
|
+
void setupPrintDialog();
|
278
|
+
static void printWithCmdBtnCbk(Widget widget, XtPointer ptr,
|
279
|
+
XtPointer callData);
|
280
|
+
static void printToFileBtnCbk(Widget widget, XtPointer ptr,
|
281
|
+
XtPointer callData);
|
282
|
+
static void printPrintCbk(Widget widget, XtPointer ptr,
|
283
|
+
XtPointer callData);
|
284
|
+
|
285
|
+
//----- Motif support
|
286
|
+
XmFontList createFontList(char *xlfd);
|
287
|
+
|
288
|
+
static XPDFViewerCmd cmdTab[];
|
289
|
+
|
290
|
+
XPDFApp *app;
|
291
|
+
GBool ok;
|
292
|
+
|
293
|
+
Display *display;
|
294
|
+
int screenNum;
|
295
|
+
Widget win; // top-level window
|
296
|
+
Widget form;
|
297
|
+
Widget panedWin;
|
298
|
+
#ifndef DISABLE_OUTLINE
|
299
|
+
Widget outlineScroll;
|
300
|
+
Widget outlineTree;
|
301
|
+
Widget *outlineLabels;
|
302
|
+
int outlineLabelsLength;
|
303
|
+
int outlineLabelsSize;
|
304
|
+
Dimension outlinePaneWidth;
|
305
|
+
#endif
|
306
|
+
XPDFCore *core;
|
307
|
+
Widget toolBar;
|
308
|
+
Widget backBtn;
|
309
|
+
Widget prevTenPageBtn;
|
310
|
+
Widget prevPageBtn;
|
311
|
+
Widget nextPageBtn;
|
312
|
+
Widget nextTenPageBtn;
|
313
|
+
Widget forwardBtn;
|
314
|
+
Widget pageNumText;
|
315
|
+
Widget pageCountLabel;
|
316
|
+
#if USE_COMBO_BOX
|
317
|
+
Widget zoomComboBox;
|
318
|
+
#else
|
319
|
+
Widget zoomMenu;
|
320
|
+
Widget zoomMenuBtns[nZoomMenuItems];
|
321
|
+
#endif
|
322
|
+
Widget zoomWidget;
|
323
|
+
Widget findBtn;
|
324
|
+
Widget printBtn;
|
325
|
+
Widget aboutBtn;
|
326
|
+
Widget linkLabel;
|
327
|
+
Widget quitBtn;
|
328
|
+
Widget popupMenu;
|
329
|
+
|
330
|
+
Widget aboutDialog;
|
331
|
+
XmFontList aboutBigFont, aboutVersionFont, aboutFixedFont;
|
332
|
+
|
333
|
+
Widget openDialog;
|
334
|
+
GBool openInNewWindow;
|
335
|
+
|
336
|
+
Widget findDialog;
|
337
|
+
Widget findText;
|
338
|
+
Widget findBackwardToggle;
|
339
|
+
Widget findCaseSensitiveToggle;
|
340
|
+
|
341
|
+
Widget saveAsDialog;
|
342
|
+
|
343
|
+
Widget printDialog;
|
344
|
+
Widget printWithCmdBtn;
|
345
|
+
Widget printToFileBtn;
|
346
|
+
Widget printCmdText;
|
347
|
+
Widget printFileText;
|
348
|
+
Widget printFirstPage;
|
349
|
+
Widget printLastPage;
|
350
|
+
};
|
351
|
+
|
352
|
+
#endif
|
@@ -0,0 +1,896 @@
|
|
1
|
+
//========================================================================
|
2
|
+
//
|
3
|
+
// XRef.cc
|
4
|
+
//
|
5
|
+
// Copyright 1996-2003 Glyph & Cog, LLC
|
6
|
+
//
|
7
|
+
//========================================================================
|
8
|
+
|
9
|
+
#include <aconf.h>
|
10
|
+
|
11
|
+
#ifdef USE_GCC_PRAGMAS
|
12
|
+
#pragma implementation
|
13
|
+
#endif
|
14
|
+
|
15
|
+
#include <stdlib.h>
|
16
|
+
#include <stddef.h>
|
17
|
+
#include <string.h>
|
18
|
+
#include <ctype.h>
|
19
|
+
#include "gmem.h"
|
20
|
+
#include "Object.h"
|
21
|
+
#include "Stream.h"
|
22
|
+
#include "Lexer.h"
|
23
|
+
#include "Parser.h"
|
24
|
+
#include "Dict.h"
|
25
|
+
#include "Error.h"
|
26
|
+
#include "ErrorCodes.h"
|
27
|
+
#include "XRef.h"
|
28
|
+
|
29
|
+
//------------------------------------------------------------------------
|
30
|
+
|
31
|
+
#define xrefSearchSize 1024 // read this many bytes at end of file
|
32
|
+
// to look for 'startxref'
|
33
|
+
|
34
|
+
//------------------------------------------------------------------------
|
35
|
+
// Permission bits
|
36
|
+
//------------------------------------------------------------------------
|
37
|
+
|
38
|
+
#define permPrint (1<<2)
|
39
|
+
#define permChange (1<<3)
|
40
|
+
#define permCopy (1<<4)
|
41
|
+
#define permNotes (1<<5)
|
42
|
+
#define defPermFlags 0xfffc
|
43
|
+
|
44
|
+
//------------------------------------------------------------------------
|
45
|
+
// ObjectStream
|
46
|
+
//------------------------------------------------------------------------
|
47
|
+
|
48
|
+
class ObjectStream {
|
49
|
+
public:
|
50
|
+
|
51
|
+
// Create an object stream, using object number <objStrNum>,
|
52
|
+
// generation 0.
|
53
|
+
ObjectStream(XRef *xref, int objStrNumA);
|
54
|
+
|
55
|
+
~ObjectStream();
|
56
|
+
|
57
|
+
// Return the object number of this object stream.
|
58
|
+
int getObjStrNum() { return objStrNum; }
|
59
|
+
|
60
|
+
// Get the <objIdx>th object from this stream, which should be
|
61
|
+
// object number <objNum>, generation 0.
|
62
|
+
Object *getObject(int objIdx, int objNum, Object *obj);
|
63
|
+
|
64
|
+
private:
|
65
|
+
|
66
|
+
int objStrNum; // object number of the object stream
|
67
|
+
int nObjects; // number of objects in the stream
|
68
|
+
Object *objs; // the objects (length = nObjects)
|
69
|
+
int *objNums; // the object numbers (length = nObjects)
|
70
|
+
};
|
71
|
+
|
72
|
+
ObjectStream::ObjectStream(XRef *xref, int objStrNumA) {
|
73
|
+
Stream *str;
|
74
|
+
Parser *parser;
|
75
|
+
int *offsets;
|
76
|
+
Object objStr, obj1, obj2;
|
77
|
+
int first, i;
|
78
|
+
|
79
|
+
objStrNum = objStrNumA;
|
80
|
+
nObjects = 0;
|
81
|
+
objs = NULL;
|
82
|
+
objNums = NULL;
|
83
|
+
|
84
|
+
if (!xref->fetch(objStrNum, 0, &objStr)->isStream()) {
|
85
|
+
goto err1;
|
86
|
+
}
|
87
|
+
|
88
|
+
if (!objStr.streamGetDict()->lookup("N", &obj1)->isInt()) {
|
89
|
+
obj1.free();
|
90
|
+
goto err1;
|
91
|
+
}
|
92
|
+
nObjects = obj1.getInt();
|
93
|
+
obj1.free();
|
94
|
+
if (nObjects <= 0) {
|
95
|
+
goto err1;
|
96
|
+
}
|
97
|
+
|
98
|
+
if (!objStr.streamGetDict()->lookup("First", &obj1)->isInt()) {
|
99
|
+
obj1.free();
|
100
|
+
goto err1;
|
101
|
+
}
|
102
|
+
first = obj1.getInt();
|
103
|
+
obj1.free();
|
104
|
+
if (first < 0) {
|
105
|
+
goto err1;
|
106
|
+
}
|
107
|
+
|
108
|
+
objs = new Object[nObjects];
|
109
|
+
objNums = (int *)gmallocn(nObjects, sizeof(int));
|
110
|
+
offsets = (int *)gmallocn(nObjects, sizeof(int));
|
111
|
+
|
112
|
+
// parse the header: object numbers and offsets
|
113
|
+
objStr.streamReset();
|
114
|
+
obj1.initNull();
|
115
|
+
str = new EmbedStream(objStr.getStream(), &obj1, gTrue, first);
|
116
|
+
parser = new Parser(xref, new Lexer(xref, str), gFalse);
|
117
|
+
for (i = 0; i < nObjects; ++i) {
|
118
|
+
parser->getObj(&obj1);
|
119
|
+
parser->getObj(&obj2);
|
120
|
+
if (!obj1.isInt() || !obj2.isInt()) {
|
121
|
+
obj1.free();
|
122
|
+
obj2.free();
|
123
|
+
delete parser;
|
124
|
+
gfree(offsets);
|
125
|
+
goto err1;
|
126
|
+
}
|
127
|
+
objNums[i] = obj1.getInt();
|
128
|
+
offsets[i] = obj2.getInt();
|
129
|
+
obj1.free();
|
130
|
+
obj2.free();
|
131
|
+
if (objNums[i] < 0 || offsets[i] < 0 ||
|
132
|
+
(i > 0 && offsets[i] < offsets[i-1])) {
|
133
|
+
delete parser;
|
134
|
+
gfree(offsets);
|
135
|
+
goto err1;
|
136
|
+
}
|
137
|
+
}
|
138
|
+
while (str->getChar() != EOF) ;
|
139
|
+
delete parser;
|
140
|
+
|
141
|
+
// skip to the first object - this shouldn't be necessary because
|
142
|
+
// the First key is supposed to be equal to offsets[0], but just in
|
143
|
+
// case...
|
144
|
+
for (i = first; i < offsets[0]; ++i) {
|
145
|
+
objStr.getStream()->getChar();
|
146
|
+
}
|
147
|
+
|
148
|
+
// parse the objects
|
149
|
+
for (i = 0; i < nObjects; ++i) {
|
150
|
+
obj1.initNull();
|
151
|
+
if (i == nObjects - 1) {
|
152
|
+
str = new EmbedStream(objStr.getStream(), &obj1, gFalse, 0);
|
153
|
+
} else {
|
154
|
+
str = new EmbedStream(objStr.getStream(), &obj1, gTrue,
|
155
|
+
offsets[i+1] - offsets[i]);
|
156
|
+
}
|
157
|
+
parser = new Parser(xref, new Lexer(xref, str), gFalse);
|
158
|
+
parser->getObj(&objs[i]);
|
159
|
+
while (str->getChar() != EOF) ;
|
160
|
+
delete parser;
|
161
|
+
}
|
162
|
+
|
163
|
+
gfree(offsets);
|
164
|
+
|
165
|
+
err1:
|
166
|
+
objStr.free();
|
167
|
+
return;
|
168
|
+
}
|
169
|
+
|
170
|
+
ObjectStream::~ObjectStream() {
|
171
|
+
int i;
|
172
|
+
|
173
|
+
if (objs) {
|
174
|
+
for (i = 0; i < nObjects; ++i) {
|
175
|
+
objs[i].free();
|
176
|
+
}
|
177
|
+
delete[] objs;
|
178
|
+
}
|
179
|
+
gfree(objNums);
|
180
|
+
}
|
181
|
+
|
182
|
+
Object *ObjectStream::getObject(int objIdx, int objNum, Object *obj) {
|
183
|
+
if (objIdx < 0 || objIdx >= nObjects || objNum != objNums[objIdx]) {
|
184
|
+
return obj->initNull();
|
185
|
+
}
|
186
|
+
return objs[objIdx].copy(obj);
|
187
|
+
}
|
188
|
+
|
189
|
+
//------------------------------------------------------------------------
|
190
|
+
// XRef
|
191
|
+
//------------------------------------------------------------------------
|
192
|
+
|
193
|
+
XRef::XRef(BaseStream *strA) {
|
194
|
+
Guint pos;
|
195
|
+
Object obj;
|
196
|
+
|
197
|
+
ok = gTrue;
|
198
|
+
errCode = errNone;
|
199
|
+
size = 0;
|
200
|
+
entries = NULL;
|
201
|
+
streamEnds = NULL;
|
202
|
+
streamEndsLen = 0;
|
203
|
+
objStr = NULL;
|
204
|
+
|
205
|
+
encrypted = gFalse;
|
206
|
+
permFlags = defPermFlags;
|
207
|
+
ownerPasswordOk = gFalse;
|
208
|
+
|
209
|
+
// read the trailer
|
210
|
+
str = strA;
|
211
|
+
start = str->getStart();
|
212
|
+
pos = getStartXref();
|
213
|
+
|
214
|
+
// if there was a problem with the 'startxref' position, try to
|
215
|
+
// reconstruct the xref table
|
216
|
+
if (pos == 0) {
|
217
|
+
if (!(ok = constructXRef())) {
|
218
|
+
errCode = errDamaged;
|
219
|
+
return;
|
220
|
+
}
|
221
|
+
|
222
|
+
// read the xref table
|
223
|
+
} else {
|
224
|
+
while (readXRef(&pos)) ;
|
225
|
+
|
226
|
+
// if there was a problem with the xref table,
|
227
|
+
// try to reconstruct it
|
228
|
+
if (!ok) {
|
229
|
+
if (!(ok = constructXRef())) {
|
230
|
+
errCode = errDamaged;
|
231
|
+
return;
|
232
|
+
}
|
233
|
+
}
|
234
|
+
}
|
235
|
+
|
236
|
+
// get the root dictionary (catalog) object
|
237
|
+
trailerDict.dictLookupNF("Root", &obj);
|
238
|
+
if (obj.isRef()) {
|
239
|
+
rootNum = obj.getRefNum();
|
240
|
+
rootGen = obj.getRefGen();
|
241
|
+
obj.free();
|
242
|
+
} else {
|
243
|
+
obj.free();
|
244
|
+
if (!(ok = constructXRef())) {
|
245
|
+
errCode = errDamaged;
|
246
|
+
return;
|
247
|
+
}
|
248
|
+
}
|
249
|
+
|
250
|
+
// now set the trailer dictionary's xref pointer so we can fetch
|
251
|
+
// indirect objects from it
|
252
|
+
trailerDict.getDict()->setXRef(this);
|
253
|
+
}
|
254
|
+
|
255
|
+
XRef::~XRef() {
|
256
|
+
gfree(entries);
|
257
|
+
trailerDict.free();
|
258
|
+
if (streamEnds) {
|
259
|
+
gfree(streamEnds);
|
260
|
+
}
|
261
|
+
if (objStr) {
|
262
|
+
delete objStr;
|
263
|
+
}
|
264
|
+
}
|
265
|
+
|
266
|
+
// Read the 'startxref' position.
|
267
|
+
Guint XRef::getStartXref() {
|
268
|
+
char buf[xrefSearchSize+1];
|
269
|
+
char *p;
|
270
|
+
int c, n, i;
|
271
|
+
|
272
|
+
// read last xrefSearchSize bytes
|
273
|
+
str->setPos(xrefSearchSize, -1);
|
274
|
+
for (n = 0; n < xrefSearchSize; ++n) {
|
275
|
+
if ((c = str->getChar()) == EOF) {
|
276
|
+
break;
|
277
|
+
}
|
278
|
+
buf[n] = c;
|
279
|
+
}
|
280
|
+
buf[n] = '\0';
|
281
|
+
|
282
|
+
// find startxref
|
283
|
+
for (i = n - 9; i >= 0; --i) {
|
284
|
+
if (!strncmp(&buf[i], "startxref", 9)) {
|
285
|
+
break;
|
286
|
+
}
|
287
|
+
}
|
288
|
+
if (i < 0) {
|
289
|
+
return 0;
|
290
|
+
}
|
291
|
+
for (p = &buf[i+9]; isspace(*p); ++p) ;
|
292
|
+
lastXRefPos = strToUnsigned(p);
|
293
|
+
|
294
|
+
return lastXRefPos;
|
295
|
+
}
|
296
|
+
|
297
|
+
// Read one xref table section. Also reads the associated trailer
|
298
|
+
// dictionary, and returns the prev pointer (if any).
|
299
|
+
GBool XRef::readXRef(Guint *pos) {
|
300
|
+
Parser *parser;
|
301
|
+
Object obj;
|
302
|
+
GBool more;
|
303
|
+
|
304
|
+
// start up a parser, parse one token
|
305
|
+
obj.initNull();
|
306
|
+
parser = new Parser(NULL,
|
307
|
+
new Lexer(NULL,
|
308
|
+
str->makeSubStream(start + *pos, gFalse, 0, &obj)),
|
309
|
+
gTrue);
|
310
|
+
parser->getObj(&obj);
|
311
|
+
|
312
|
+
// parse an old-style xref table
|
313
|
+
if (obj.isCmd("xref")) {
|
314
|
+
obj.free();
|
315
|
+
more = readXRefTable(parser, pos);
|
316
|
+
|
317
|
+
// parse an xref stream
|
318
|
+
} else if (obj.isInt()) {
|
319
|
+
obj.free();
|
320
|
+
if (!parser->getObj(&obj)->isInt()) {
|
321
|
+
goto err1;
|
322
|
+
}
|
323
|
+
obj.free();
|
324
|
+
if (!parser->getObj(&obj)->isCmd("obj")) {
|
325
|
+
goto err1;
|
326
|
+
}
|
327
|
+
obj.free();
|
328
|
+
if (!parser->getObj(&obj)->isStream()) {
|
329
|
+
goto err1;
|
330
|
+
}
|
331
|
+
more = readXRefStream(obj.getStream(), pos);
|
332
|
+
obj.free();
|
333
|
+
|
334
|
+
} else {
|
335
|
+
goto err1;
|
336
|
+
}
|
337
|
+
|
338
|
+
delete parser;
|
339
|
+
return more;
|
340
|
+
|
341
|
+
err1:
|
342
|
+
obj.free();
|
343
|
+
delete parser;
|
344
|
+
ok = gFalse;
|
345
|
+
return gFalse;
|
346
|
+
}
|
347
|
+
|
348
|
+
GBool XRef::readXRefTable(Parser *parser, Guint *pos) {
|
349
|
+
XRefEntry entry;
|
350
|
+
GBool more;
|
351
|
+
Object obj, obj2;
|
352
|
+
Guint pos2;
|
353
|
+
int first, n, newSize, i;
|
354
|
+
|
355
|
+
while (1) {
|
356
|
+
parser->getObj(&obj);
|
357
|
+
if (obj.isCmd("trailer")) {
|
358
|
+
obj.free();
|
359
|
+
break;
|
360
|
+
}
|
361
|
+
if (!obj.isInt()) {
|
362
|
+
goto err1;
|
363
|
+
}
|
364
|
+
first = obj.getInt();
|
365
|
+
obj.free();
|
366
|
+
if (!parser->getObj(&obj)->isInt()) {
|
367
|
+
goto err1;
|
368
|
+
}
|
369
|
+
n = obj.getInt();
|
370
|
+
obj.free();
|
371
|
+
if (first < 0 || n < 0 || first + n < 0) {
|
372
|
+
goto err1;
|
373
|
+
}
|
374
|
+
if (first + n > size) {
|
375
|
+
for (newSize = size ? 2 * size : 1024;
|
376
|
+
first + n > newSize && newSize > 0;
|
377
|
+
newSize <<= 1) ;
|
378
|
+
if (newSize < 0) {
|
379
|
+
goto err1;
|
380
|
+
}
|
381
|
+
entries = (XRefEntry *)greallocn(entries, newSize, sizeof(XRefEntry));
|
382
|
+
for (i = size; i < newSize; ++i) {
|
383
|
+
entries[i].offset = 0xffffffff;
|
384
|
+
entries[i].type = xrefEntryFree;
|
385
|
+
}
|
386
|
+
size = newSize;
|
387
|
+
}
|
388
|
+
for (i = first; i < first + n; ++i) {
|
389
|
+
if (!parser->getObj(&obj)->isInt()) {
|
390
|
+
goto err1;
|
391
|
+
}
|
392
|
+
entry.offset = (Guint)obj.getInt();
|
393
|
+
obj.free();
|
394
|
+
if (!parser->getObj(&obj)->isInt()) {
|
395
|
+
goto err1;
|
396
|
+
}
|
397
|
+
entry.gen = obj.getInt();
|
398
|
+
obj.free();
|
399
|
+
parser->getObj(&obj);
|
400
|
+
if (obj.isCmd("n")) {
|
401
|
+
entry.type = xrefEntryUncompressed;
|
402
|
+
} else if (obj.isCmd("f")) {
|
403
|
+
entry.type = xrefEntryFree;
|
404
|
+
} else {
|
405
|
+
goto err1;
|
406
|
+
}
|
407
|
+
obj.free();
|
408
|
+
if (entries[i].offset == 0xffffffff) {
|
409
|
+
entries[i] = entry;
|
410
|
+
// PDF files of patents from the IBM Intellectual Property
|
411
|
+
// Network have a bug: the xref table claims to start at 1
|
412
|
+
// instead of 0.
|
413
|
+
if (i == 1 && first == 1 &&
|
414
|
+
entries[1].offset == 0 && entries[1].gen == 65535 &&
|
415
|
+
entries[1].type == xrefEntryFree) {
|
416
|
+
i = first = 0;
|
417
|
+
entries[0] = entries[1];
|
418
|
+
entries[1].offset = 0xffffffff;
|
419
|
+
}
|
420
|
+
}
|
421
|
+
}
|
422
|
+
}
|
423
|
+
|
424
|
+
// read the trailer dictionary
|
425
|
+
if (!parser->getObj(&obj)->isDict()) {
|
426
|
+
goto err1;
|
427
|
+
}
|
428
|
+
|
429
|
+
// get the 'Prev' pointer
|
430
|
+
obj.getDict()->lookupNF("Prev", &obj2);
|
431
|
+
if (obj2.isInt()) {
|
432
|
+
*pos = (Guint)obj2.getInt();
|
433
|
+
more = gTrue;
|
434
|
+
} else if (obj2.isRef()) {
|
435
|
+
// certain buggy PDF generators generate "/Prev NNN 0 R" instead
|
436
|
+
// of "/Prev NNN"
|
437
|
+
*pos = (Guint)obj2.getRefNum();
|
438
|
+
more = gTrue;
|
439
|
+
} else {
|
440
|
+
more = gFalse;
|
441
|
+
}
|
442
|
+
obj2.free();
|
443
|
+
|
444
|
+
// save the first trailer dictionary
|
445
|
+
if (trailerDict.isNone()) {
|
446
|
+
obj.copy(&trailerDict);
|
447
|
+
}
|
448
|
+
|
449
|
+
// check for an 'XRefStm' key
|
450
|
+
if (obj.getDict()->lookup("XRefStm", &obj2)->isInt()) {
|
451
|
+
pos2 = (Guint)obj2.getInt();
|
452
|
+
readXRef(&pos2);
|
453
|
+
if (!ok) {
|
454
|
+
obj2.free();
|
455
|
+
goto err1;
|
456
|
+
}
|
457
|
+
}
|
458
|
+
obj2.free();
|
459
|
+
|
460
|
+
obj.free();
|
461
|
+
return more;
|
462
|
+
|
463
|
+
err1:
|
464
|
+
obj.free();
|
465
|
+
ok = gFalse;
|
466
|
+
return gFalse;
|
467
|
+
}
|
468
|
+
|
469
|
+
GBool XRef::readXRefStream(Stream *xrefStr, Guint *pos) {
|
470
|
+
Dict *dict;
|
471
|
+
int w[3];
|
472
|
+
GBool more;
|
473
|
+
Object obj, obj2, idx;
|
474
|
+
int newSize, first, n, i;
|
475
|
+
|
476
|
+
dict = xrefStr->getDict();
|
477
|
+
|
478
|
+
if (!dict->lookupNF("Size", &obj)->isInt()) {
|
479
|
+
goto err1;
|
480
|
+
}
|
481
|
+
newSize = obj.getInt();
|
482
|
+
obj.free();
|
483
|
+
if (newSize < 0) {
|
484
|
+
goto err1;
|
485
|
+
}
|
486
|
+
if (newSize > size) {
|
487
|
+
entries = (XRefEntry *)greallocn(entries, newSize, sizeof(XRefEntry));
|
488
|
+
for (i = size; i < newSize; ++i) {
|
489
|
+
entries[i].offset = 0xffffffff;
|
490
|
+
entries[i].type = xrefEntryFree;
|
491
|
+
}
|
492
|
+
size = newSize;
|
493
|
+
}
|
494
|
+
|
495
|
+
if (!dict->lookupNF("W", &obj)->isArray() ||
|
496
|
+
obj.arrayGetLength() < 3) {
|
497
|
+
goto err1;
|
498
|
+
}
|
499
|
+
for (i = 0; i < 3; ++i) {
|
500
|
+
if (!obj.arrayGet(i, &obj2)->isInt()) {
|
501
|
+
obj2.free();
|
502
|
+
goto err1;
|
503
|
+
}
|
504
|
+
w[i] = obj2.getInt();
|
505
|
+
obj2.free();
|
506
|
+
if (w[i] < 0 || w[i] > 4) {
|
507
|
+
goto err1;
|
508
|
+
}
|
509
|
+
}
|
510
|
+
obj.free();
|
511
|
+
|
512
|
+
xrefStr->reset();
|
513
|
+
dict->lookupNF("Index", &idx);
|
514
|
+
if (idx.isArray()) {
|
515
|
+
for (i = 0; i+1 < idx.arrayGetLength(); i += 2) {
|
516
|
+
if (!idx.arrayGet(i, &obj)->isInt()) {
|
517
|
+
idx.free();
|
518
|
+
goto err1;
|
519
|
+
}
|
520
|
+
first = obj.getInt();
|
521
|
+
obj.free();
|
522
|
+
if (!idx.arrayGet(i+1, &obj)->isInt()) {
|
523
|
+
idx.free();
|
524
|
+
goto err1;
|
525
|
+
}
|
526
|
+
n = obj.getInt();
|
527
|
+
obj.free();
|
528
|
+
if (first < 0 || n < 0 ||
|
529
|
+
!readXRefStreamSection(xrefStr, w, first, n)) {
|
530
|
+
idx.free();
|
531
|
+
goto err0;
|
532
|
+
}
|
533
|
+
}
|
534
|
+
} else {
|
535
|
+
if (!readXRefStreamSection(xrefStr, w, 0, newSize)) {
|
536
|
+
idx.free();
|
537
|
+
goto err0;
|
538
|
+
}
|
539
|
+
}
|
540
|
+
idx.free();
|
541
|
+
|
542
|
+
dict->lookupNF("Prev", &obj);
|
543
|
+
if (obj.isInt()) {
|
544
|
+
*pos = (Guint)obj.getInt();
|
545
|
+
more = gTrue;
|
546
|
+
} else {
|
547
|
+
more = gFalse;
|
548
|
+
}
|
549
|
+
obj.free();
|
550
|
+
if (trailerDict.isNone()) {
|
551
|
+
trailerDict.initDict(dict);
|
552
|
+
}
|
553
|
+
|
554
|
+
return more;
|
555
|
+
|
556
|
+
err1:
|
557
|
+
obj.free();
|
558
|
+
err0:
|
559
|
+
ok = gFalse;
|
560
|
+
return gFalse;
|
561
|
+
}
|
562
|
+
|
563
|
+
GBool XRef::readXRefStreamSection(Stream *xrefStr, int *w, int first, int n) {
|
564
|
+
Guint offset;
|
565
|
+
int type, gen, c, newSize, i, j;
|
566
|
+
|
567
|
+
if (first + n < 0) {
|
568
|
+
return gFalse;
|
569
|
+
}
|
570
|
+
if (first + n > size) {
|
571
|
+
for (newSize = size ? 2 * size : 1024;
|
572
|
+
first + n > newSize && newSize > 0;
|
573
|
+
newSize <<= 1) ;
|
574
|
+
if (newSize < 0) {
|
575
|
+
return gFalse;
|
576
|
+
}
|
577
|
+
entries = (XRefEntry *)greallocn(entries, newSize, sizeof(XRefEntry));
|
578
|
+
for (i = size; i < newSize; ++i) {
|
579
|
+
entries[i].offset = 0xffffffff;
|
580
|
+
entries[i].type = xrefEntryFree;
|
581
|
+
}
|
582
|
+
size = newSize;
|
583
|
+
}
|
584
|
+
for (i = first; i < first + n; ++i) {
|
585
|
+
if (w[0] == 0) {
|
586
|
+
type = 1;
|
587
|
+
} else {
|
588
|
+
for (type = 0, j = 0; j < w[0]; ++j) {
|
589
|
+
if ((c = xrefStr->getChar()) == EOF) {
|
590
|
+
return gFalse;
|
591
|
+
}
|
592
|
+
type = (type << 8) + c;
|
593
|
+
}
|
594
|
+
}
|
595
|
+
for (offset = 0, j = 0; j < w[1]; ++j) {
|
596
|
+
if ((c = xrefStr->getChar()) == EOF) {
|
597
|
+
return gFalse;
|
598
|
+
}
|
599
|
+
offset = (offset << 8) + c;
|
600
|
+
}
|
601
|
+
for (gen = 0, j = 0; j < w[2]; ++j) {
|
602
|
+
if ((c = xrefStr->getChar()) == EOF) {
|
603
|
+
return gFalse;
|
604
|
+
}
|
605
|
+
gen = (gen << 8) + c;
|
606
|
+
}
|
607
|
+
if (entries[i].offset == 0xffffffff) {
|
608
|
+
switch (type) {
|
609
|
+
case 0:
|
610
|
+
entries[i].offset = offset;
|
611
|
+
entries[i].gen = gen;
|
612
|
+
entries[i].type = xrefEntryFree;
|
613
|
+
break;
|
614
|
+
case 1:
|
615
|
+
entries[i].offset = offset;
|
616
|
+
entries[i].gen = gen;
|
617
|
+
entries[i].type = xrefEntryUncompressed;
|
618
|
+
break;
|
619
|
+
case 2:
|
620
|
+
entries[i].offset = offset;
|
621
|
+
entries[i].gen = gen;
|
622
|
+
entries[i].type = xrefEntryCompressed;
|
623
|
+
break;
|
624
|
+
default:
|
625
|
+
return gFalse;
|
626
|
+
}
|
627
|
+
}
|
628
|
+
}
|
629
|
+
|
630
|
+
return gTrue;
|
631
|
+
}
|
632
|
+
|
633
|
+
// Attempt to construct an xref table for a damaged file.
|
634
|
+
GBool XRef::constructXRef() {
|
635
|
+
Parser *parser;
|
636
|
+
Object newTrailerDict, obj;
|
637
|
+
char buf[256];
|
638
|
+
Guint pos;
|
639
|
+
int num, gen;
|
640
|
+
int newSize;
|
641
|
+
int streamEndsSize;
|
642
|
+
char *p;
|
643
|
+
int i;
|
644
|
+
GBool gotRoot;
|
645
|
+
|
646
|
+
gfree(entries);
|
647
|
+
size = 0;
|
648
|
+
entries = NULL;
|
649
|
+
|
650
|
+
error(-1, "PDF file is damaged - attempting to reconstruct xref table...");
|
651
|
+
gotRoot = gFalse;
|
652
|
+
streamEndsLen = streamEndsSize = 0;
|
653
|
+
|
654
|
+
str->reset();
|
655
|
+
while (1) {
|
656
|
+
pos = str->getPos();
|
657
|
+
if (!str->getLine(buf, 256)) {
|
658
|
+
break;
|
659
|
+
}
|
660
|
+
p = buf;
|
661
|
+
|
662
|
+
// skip whitespace
|
663
|
+
while (*p && Lexer::isSpace(*p & 0xff)) ++p;
|
664
|
+
|
665
|
+
// got trailer dictionary
|
666
|
+
if (!strncmp(p, "trailer", 7)) {
|
667
|
+
obj.initNull();
|
668
|
+
parser = new Parser(NULL,
|
669
|
+
new Lexer(NULL,
|
670
|
+
str->makeSubStream(pos + 7, gFalse, 0, &obj)),
|
671
|
+
gFalse);
|
672
|
+
parser->getObj(&newTrailerDict);
|
673
|
+
if (newTrailerDict.isDict()) {
|
674
|
+
newTrailerDict.dictLookupNF("Root", &obj);
|
675
|
+
if (obj.isRef()) {
|
676
|
+
rootNum = obj.getRefNum();
|
677
|
+
rootGen = obj.getRefGen();
|
678
|
+
if (!trailerDict.isNone()) {
|
679
|
+
trailerDict.free();
|
680
|
+
}
|
681
|
+
newTrailerDict.copy(&trailerDict);
|
682
|
+
gotRoot = gTrue;
|
683
|
+
}
|
684
|
+
obj.free();
|
685
|
+
}
|
686
|
+
newTrailerDict.free();
|
687
|
+
delete parser;
|
688
|
+
|
689
|
+
// look for object
|
690
|
+
} else if (isdigit(*p)) {
|
691
|
+
num = atoi(p);
|
692
|
+
if (num > 0) {
|
693
|
+
do {
|
694
|
+
++p;
|
695
|
+
} while (*p && isdigit(*p));
|
696
|
+
if (isspace(*p)) {
|
697
|
+
do {
|
698
|
+
++p;
|
699
|
+
} while (*p && isspace(*p));
|
700
|
+
if (isdigit(*p)) {
|
701
|
+
gen = atoi(p);
|
702
|
+
do {
|
703
|
+
++p;
|
704
|
+
} while (*p && isdigit(*p));
|
705
|
+
if (isspace(*p)) {
|
706
|
+
do {
|
707
|
+
++p;
|
708
|
+
} while (*p && isspace(*p));
|
709
|
+
if (!strncmp(p, "obj", 3)) {
|
710
|
+
if (num >= size) {
|
711
|
+
newSize = (num + 1 + 255) & ~255;
|
712
|
+
if (newSize < 0) {
|
713
|
+
error(-1, "Bad object number");
|
714
|
+
return gFalse;
|
715
|
+
}
|
716
|
+
entries = (XRefEntry *)
|
717
|
+
greallocn(entries, newSize, sizeof(XRefEntry));
|
718
|
+
for (i = size; i < newSize; ++i) {
|
719
|
+
entries[i].offset = 0xffffffff;
|
720
|
+
entries[i].type = xrefEntryFree;
|
721
|
+
}
|
722
|
+
size = newSize;
|
723
|
+
}
|
724
|
+
if (entries[num].type == xrefEntryFree ||
|
725
|
+
gen >= entries[num].gen) {
|
726
|
+
entries[num].offset = pos - start;
|
727
|
+
entries[num].gen = gen;
|
728
|
+
entries[num].type = xrefEntryUncompressed;
|
729
|
+
}
|
730
|
+
}
|
731
|
+
}
|
732
|
+
}
|
733
|
+
}
|
734
|
+
}
|
735
|
+
|
736
|
+
} else if (!strncmp(p, "endstream", 9)) {
|
737
|
+
if (streamEndsLen == streamEndsSize) {
|
738
|
+
streamEndsSize += 64;
|
739
|
+
streamEnds = (Guint *)greallocn(streamEnds,
|
740
|
+
streamEndsSize, sizeof(int));
|
741
|
+
}
|
742
|
+
streamEnds[streamEndsLen++] = pos;
|
743
|
+
}
|
744
|
+
}
|
745
|
+
|
746
|
+
if (gotRoot)
|
747
|
+
return gTrue;
|
748
|
+
|
749
|
+
error(-1, "Couldn't find trailer dictionary");
|
750
|
+
return gFalse;
|
751
|
+
}
|
752
|
+
|
753
|
+
void XRef::setEncryption(int permFlagsA, GBool ownerPasswordOkA,
|
754
|
+
Guchar *fileKeyA, int keyLengthA, int encVersionA,
|
755
|
+
CryptAlgorithm encAlgorithmA) {
|
756
|
+
int i;
|
757
|
+
|
758
|
+
encrypted = gTrue;
|
759
|
+
permFlags = permFlagsA;
|
760
|
+
ownerPasswordOk = ownerPasswordOkA;
|
761
|
+
if (keyLengthA <= 16) {
|
762
|
+
keyLength = keyLengthA;
|
763
|
+
} else {
|
764
|
+
keyLength = 16;
|
765
|
+
}
|
766
|
+
for (i = 0; i < keyLength; ++i) {
|
767
|
+
fileKey[i] = fileKeyA[i];
|
768
|
+
}
|
769
|
+
encVersion = encVersionA;
|
770
|
+
encAlgorithm = encAlgorithmA;
|
771
|
+
}
|
772
|
+
|
773
|
+
GBool XRef::okToPrint(GBool ignoreOwnerPW) {
|
774
|
+
return (!ignoreOwnerPW && ownerPasswordOk) || (permFlags & permPrint);
|
775
|
+
}
|
776
|
+
|
777
|
+
GBool XRef::okToChange(GBool ignoreOwnerPW) {
|
778
|
+
return (!ignoreOwnerPW && ownerPasswordOk) || (permFlags & permChange);
|
779
|
+
}
|
780
|
+
|
781
|
+
GBool XRef::okToCopy(GBool ignoreOwnerPW) {
|
782
|
+
return (!ignoreOwnerPW && ownerPasswordOk) || (permFlags & permCopy);
|
783
|
+
}
|
784
|
+
|
785
|
+
GBool XRef::okToAddNotes(GBool ignoreOwnerPW) {
|
786
|
+
return (!ignoreOwnerPW && ownerPasswordOk) || (permFlags & permNotes);
|
787
|
+
}
|
788
|
+
|
789
|
+
Object *XRef::fetch(int num, int gen, Object *obj) {
|
790
|
+
XRefEntry *e;
|
791
|
+
Parser *parser;
|
792
|
+
Object obj1, obj2, obj3;
|
793
|
+
|
794
|
+
// check for bogus ref - this can happen in corrupted PDF files
|
795
|
+
if (num < 0 || num >= size) {
|
796
|
+
goto err;
|
797
|
+
}
|
798
|
+
|
799
|
+
e = &entries[num];
|
800
|
+
switch (e->type) {
|
801
|
+
|
802
|
+
case xrefEntryUncompressed:
|
803
|
+
if (e->gen != gen) {
|
804
|
+
goto err;
|
805
|
+
}
|
806
|
+
obj1.initNull();
|
807
|
+
parser = new Parser(this,
|
808
|
+
new Lexer(this,
|
809
|
+
str->makeSubStream(start + e->offset, gFalse, 0, &obj1)),
|
810
|
+
gTrue);
|
811
|
+
parser->getObj(&obj1);
|
812
|
+
parser->getObj(&obj2);
|
813
|
+
parser->getObj(&obj3);
|
814
|
+
if (!obj1.isInt() || obj1.getInt() != num ||
|
815
|
+
!obj2.isInt() || obj2.getInt() != gen ||
|
816
|
+
!obj3.isCmd("obj")) {
|
817
|
+
obj1.free();
|
818
|
+
obj2.free();
|
819
|
+
obj3.free();
|
820
|
+
delete parser;
|
821
|
+
goto err;
|
822
|
+
}
|
823
|
+
parser->getObj(obj, encrypted ? fileKey : (Guchar *)NULL,
|
824
|
+
encAlgorithm, keyLength, num, gen);
|
825
|
+
obj1.free();
|
826
|
+
obj2.free();
|
827
|
+
obj3.free();
|
828
|
+
delete parser;
|
829
|
+
break;
|
830
|
+
|
831
|
+
case xrefEntryCompressed:
|
832
|
+
if (gen != 0) {
|
833
|
+
goto err;
|
834
|
+
}
|
835
|
+
if (!objStr || objStr->getObjStrNum() != (int)e->offset) {
|
836
|
+
if (objStr) {
|
837
|
+
delete objStr;
|
838
|
+
}
|
839
|
+
objStr = new ObjectStream(this, e->offset);
|
840
|
+
}
|
841
|
+
objStr->getObject(e->gen, num, obj);
|
842
|
+
break;
|
843
|
+
|
844
|
+
default:
|
845
|
+
goto err;
|
846
|
+
}
|
847
|
+
|
848
|
+
return obj;
|
849
|
+
|
850
|
+
err:
|
851
|
+
return obj->initNull();
|
852
|
+
}
|
853
|
+
|
854
|
+
Object *XRef::getDocInfo(Object *obj) {
|
855
|
+
return trailerDict.dictLookup("Info", obj);
|
856
|
+
}
|
857
|
+
|
858
|
+
// Added for the pdftex project.
|
859
|
+
Object *XRef::getDocInfoNF(Object *obj) {
|
860
|
+
return trailerDict.dictLookupNF("Info", obj);
|
861
|
+
}
|
862
|
+
|
863
|
+
GBool XRef::getStreamEnd(Guint streamStart, Guint *streamEnd) {
|
864
|
+
int a, b, m;
|
865
|
+
|
866
|
+
if (streamEndsLen == 0 ||
|
867
|
+
streamStart > streamEnds[streamEndsLen - 1]) {
|
868
|
+
return gFalse;
|
869
|
+
}
|
870
|
+
|
871
|
+
a = -1;
|
872
|
+
b = streamEndsLen - 1;
|
873
|
+
// invariant: streamEnds[a] < streamStart <= streamEnds[b]
|
874
|
+
while (b - a > 1) {
|
875
|
+
m = (a + b) / 2;
|
876
|
+
if (streamStart <= streamEnds[m]) {
|
877
|
+
b = m;
|
878
|
+
} else {
|
879
|
+
a = m;
|
880
|
+
}
|
881
|
+
}
|
882
|
+
*streamEnd = streamEnds[b];
|
883
|
+
return gTrue;
|
884
|
+
}
|
885
|
+
|
886
|
+
Guint XRef::strToUnsigned(char *s) {
|
887
|
+
Guint x;
|
888
|
+
char *p;
|
889
|
+
int i;
|
890
|
+
|
891
|
+
x = 0;
|
892
|
+
for (p = s, i = 0; *p && isdigit(*p) && i < 10; ++p, ++i) {
|
893
|
+
x = 10 * x + (*p - '0');
|
894
|
+
}
|
895
|
+
return x;
|
896
|
+
}
|