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,187 @@
|
|
1
|
+
//========================================================================
|
2
|
+
//
|
3
|
+
// Page.h
|
4
|
+
//
|
5
|
+
// Copyright 1996-2003 Glyph & Cog, LLC
|
6
|
+
//
|
7
|
+
//========================================================================
|
8
|
+
|
9
|
+
#ifndef PAGE_H
|
10
|
+
#define PAGE_H
|
11
|
+
|
12
|
+
#include <aconf.h>
|
13
|
+
|
14
|
+
#ifdef USE_GCC_PRAGMAS
|
15
|
+
#pragma interface
|
16
|
+
#endif
|
17
|
+
|
18
|
+
#include "Object.h"
|
19
|
+
|
20
|
+
class Dict;
|
21
|
+
class XRef;
|
22
|
+
class OutputDev;
|
23
|
+
class Links;
|
24
|
+
class Catalog;
|
25
|
+
|
26
|
+
//------------------------------------------------------------------------
|
27
|
+
|
28
|
+
class PDFRectangle {
|
29
|
+
public:
|
30
|
+
double x1, y1, x2, y2;
|
31
|
+
|
32
|
+
PDFRectangle() { x1 = y1 = x2 = y2 = 0; }
|
33
|
+
PDFRectangle(double x1A, double y1A, double x2A, double y2A)
|
34
|
+
{ x1 = x1A; y1 = y1A; x2 = x2A; y2 = y2A; }
|
35
|
+
GBool isValid() { return x1 != 0 || y1 != 0 || x2 != 0 || y2 != 0; }
|
36
|
+
void clipTo(PDFRectangle *rect);
|
37
|
+
};
|
38
|
+
|
39
|
+
//------------------------------------------------------------------------
|
40
|
+
// PageAttrs
|
41
|
+
//------------------------------------------------------------------------
|
42
|
+
|
43
|
+
class PageAttrs {
|
44
|
+
public:
|
45
|
+
|
46
|
+
// Construct a new PageAttrs object by merging a dictionary
|
47
|
+
// (of type Pages or Page) into another PageAttrs object. If
|
48
|
+
// <attrs> is NULL, uses defaults.
|
49
|
+
PageAttrs(PageAttrs *attrs, Dict *dict);
|
50
|
+
|
51
|
+
// Destructor.
|
52
|
+
~PageAttrs();
|
53
|
+
|
54
|
+
// Accessors.
|
55
|
+
PDFRectangle *getMediaBox() { return &mediaBox; }
|
56
|
+
PDFRectangle *getCropBox() { return &cropBox; }
|
57
|
+
GBool isCropped() { return haveCropBox; }
|
58
|
+
PDFRectangle *getBleedBox() { return &bleedBox; }
|
59
|
+
PDFRectangle *getTrimBox() { return &trimBox; }
|
60
|
+
PDFRectangle *getArtBox() { return &artBox; }
|
61
|
+
int getRotate() { return rotate; }
|
62
|
+
GString *getLastModified()
|
63
|
+
{ return lastModified.isString()
|
64
|
+
? lastModified.getString() : (GString *)NULL; }
|
65
|
+
Dict *getBoxColorInfo()
|
66
|
+
{ return boxColorInfo.isDict() ? boxColorInfo.getDict() : (Dict *)NULL; }
|
67
|
+
Dict *getGroup()
|
68
|
+
{ return group.isDict() ? group.getDict() : (Dict *)NULL; }
|
69
|
+
Stream *getMetadata()
|
70
|
+
{ return metadata.isStream() ? metadata.getStream() : (Stream *)NULL; }
|
71
|
+
Dict *getPieceInfo()
|
72
|
+
{ return pieceInfo.isDict() ? pieceInfo.getDict() : (Dict *)NULL; }
|
73
|
+
Dict *getSeparationInfo()
|
74
|
+
{ return separationInfo.isDict()
|
75
|
+
? separationInfo.getDict() : (Dict *)NULL; }
|
76
|
+
Dict *getResourceDict()
|
77
|
+
{ return resources.isDict() ? resources.getDict() : (Dict *)NULL; }
|
78
|
+
|
79
|
+
private:
|
80
|
+
|
81
|
+
GBool readBox(Dict *dict, char *key, PDFRectangle *box);
|
82
|
+
|
83
|
+
PDFRectangle mediaBox;
|
84
|
+
PDFRectangle cropBox;
|
85
|
+
GBool haveCropBox;
|
86
|
+
PDFRectangle bleedBox;
|
87
|
+
PDFRectangle trimBox;
|
88
|
+
PDFRectangle artBox;
|
89
|
+
int rotate;
|
90
|
+
Object lastModified;
|
91
|
+
Object boxColorInfo;
|
92
|
+
Object group;
|
93
|
+
Object metadata;
|
94
|
+
Object pieceInfo;
|
95
|
+
Object separationInfo;
|
96
|
+
Object resources;
|
97
|
+
};
|
98
|
+
|
99
|
+
//------------------------------------------------------------------------
|
100
|
+
// Page
|
101
|
+
//------------------------------------------------------------------------
|
102
|
+
|
103
|
+
class Page {
|
104
|
+
public:
|
105
|
+
|
106
|
+
// Constructor.
|
107
|
+
Page(XRef *xrefA, int numA, Dict *pageDict, PageAttrs *attrsA);
|
108
|
+
|
109
|
+
// Destructor.
|
110
|
+
~Page();
|
111
|
+
|
112
|
+
// Is page valid?
|
113
|
+
GBool isOk() { return ok; }
|
114
|
+
|
115
|
+
// Get page parameters.
|
116
|
+
int getNum() { return num; }
|
117
|
+
PDFRectangle *getMediaBox() { return attrs->getMediaBox(); }
|
118
|
+
PDFRectangle *getCropBox() { return attrs->getCropBox(); }
|
119
|
+
GBool isCropped() { return attrs->isCropped(); }
|
120
|
+
double getMediaWidth()
|
121
|
+
{ return attrs->getMediaBox()->x2 - attrs->getMediaBox()->x1; }
|
122
|
+
double getMediaHeight()
|
123
|
+
{ return attrs->getMediaBox()->y2 - attrs->getMediaBox()->y1; }
|
124
|
+
double getCropWidth()
|
125
|
+
{ return attrs->getCropBox()->x2 - attrs->getCropBox()->x1; }
|
126
|
+
double getCropHeight()
|
127
|
+
{ return attrs->getCropBox()->y2 - attrs->getCropBox()->y1; }
|
128
|
+
PDFRectangle *getBleedBox() { return attrs->getBleedBox(); }
|
129
|
+
PDFRectangle *getTrimBox() { return attrs->getTrimBox(); }
|
130
|
+
PDFRectangle *getArtBox() { return attrs->getArtBox(); }
|
131
|
+
int getRotate() { return attrs->getRotate(); }
|
132
|
+
GString *getLastModified() { return attrs->getLastModified(); }
|
133
|
+
Dict *getBoxColorInfo() { return attrs->getBoxColorInfo(); }
|
134
|
+
Dict *getGroup() { return attrs->getGroup(); }
|
135
|
+
Stream *getMetadata() { return attrs->getMetadata(); }
|
136
|
+
Dict *getPieceInfo() { return attrs->getPieceInfo(); }
|
137
|
+
Dict *getSeparationInfo() { return attrs->getSeparationInfo(); }
|
138
|
+
|
139
|
+
// Get resource dictionary.
|
140
|
+
Dict *getResourceDict() { return attrs->getResourceDict(); }
|
141
|
+
|
142
|
+
// Get annotations array.
|
143
|
+
Object *getAnnots(Object *obj) { return annots.fetch(xref, obj); }
|
144
|
+
|
145
|
+
// Return a list of links.
|
146
|
+
Links *getLinks(Catalog *catalog);
|
147
|
+
|
148
|
+
// Get contents.
|
149
|
+
Object *getContents(Object *obj) { return contents.fetch(xref, obj); }
|
150
|
+
|
151
|
+
// Display a page.
|
152
|
+
void display(OutputDev *out, double hDPI, double vDPI,
|
153
|
+
int rotate, GBool useMediaBox, GBool crop,
|
154
|
+
Links *links, GBool printing, Catalog *catalog,
|
155
|
+
GBool (*abortCheckCbk)(void *data) = NULL,
|
156
|
+
void *abortCheckCbkData = NULL);
|
157
|
+
|
158
|
+
// Display part of a page.
|
159
|
+
void displaySlice(OutputDev *out, double hDPI, double vDPI,
|
160
|
+
int rotate, GBool useMediaBox, GBool crop,
|
161
|
+
int sliceX, int sliceY, int sliceW, int sliceH,
|
162
|
+
Links *links, GBool printing, Catalog *catalog,
|
163
|
+
GBool (*abortCheckCbk)(void *data) = NULL,
|
164
|
+
void *abortCheckCbkData = NULL);
|
165
|
+
|
166
|
+
void makeBox(double hDPI, double vDPI, int rotate,
|
167
|
+
GBool useMediaBox, GBool upsideDown,
|
168
|
+
double sliceX, double sliceY, double sliceW, double sliceH,
|
169
|
+
PDFRectangle *box, GBool *crop);
|
170
|
+
|
171
|
+
void processLinks(OutputDev *out, Catalog *catalog);
|
172
|
+
|
173
|
+
// Get the page's default CTM.
|
174
|
+
void getDefaultCTM(double *ctm, double hDPI, double vDPI,
|
175
|
+
int rotate, GBool useMediaBox, GBool upsideDown);
|
176
|
+
|
177
|
+
private:
|
178
|
+
|
179
|
+
XRef *xref; // the xref table for this PDF file
|
180
|
+
int num; // page number
|
181
|
+
PageAttrs *attrs; // page attributes
|
182
|
+
Object annots; // annotations array
|
183
|
+
Object contents; // page contents
|
184
|
+
GBool ok; // true if page is valid
|
185
|
+
};
|
186
|
+
|
187
|
+
#endif
|
Binary file
|
@@ -0,0 +1,227 @@
|
|
1
|
+
//========================================================================
|
2
|
+
//
|
3
|
+
// Parser.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 <stddef.h>
|
16
|
+
#include "Object.h"
|
17
|
+
#include "Array.h"
|
18
|
+
#include "Dict.h"
|
19
|
+
#include "Decrypt.h"
|
20
|
+
#include "Parser.h"
|
21
|
+
#include "XRef.h"
|
22
|
+
#include "Error.h"
|
23
|
+
|
24
|
+
Parser::Parser(XRef *xrefA, Lexer *lexerA, GBool allowStreamsA) {
|
25
|
+
xref = xrefA;
|
26
|
+
lexer = lexerA;
|
27
|
+
inlineImg = 0;
|
28
|
+
allowStreams = allowStreamsA;
|
29
|
+
lexer->getObj(&buf1);
|
30
|
+
lexer->getObj(&buf2);
|
31
|
+
}
|
32
|
+
|
33
|
+
Parser::~Parser() {
|
34
|
+
buf1.free();
|
35
|
+
buf2.free();
|
36
|
+
delete lexer;
|
37
|
+
}
|
38
|
+
|
39
|
+
Object *Parser::getObj(Object *obj, Guchar *fileKey,
|
40
|
+
CryptAlgorithm encAlgorithm, int keyLength,
|
41
|
+
int objNum, int objGen) {
|
42
|
+
char *key;
|
43
|
+
Stream *str;
|
44
|
+
Object obj2;
|
45
|
+
int num;
|
46
|
+
DecryptStream *decrypt;
|
47
|
+
GString *s, *s2;
|
48
|
+
int c;
|
49
|
+
|
50
|
+
// refill buffer after inline image data
|
51
|
+
if (inlineImg == 2) {
|
52
|
+
buf1.free();
|
53
|
+
buf2.free();
|
54
|
+
lexer->getObj(&buf1);
|
55
|
+
lexer->getObj(&buf2);
|
56
|
+
inlineImg = 0;
|
57
|
+
}
|
58
|
+
|
59
|
+
// array
|
60
|
+
if (buf1.isCmd("[")) {
|
61
|
+
shift();
|
62
|
+
obj->initArray(xref);
|
63
|
+
while (!buf1.isCmd("]") && !buf1.isEOF())
|
64
|
+
obj->arrayAdd(getObj(&obj2, fileKey, encAlgorithm, keyLength,
|
65
|
+
objNum, objGen));
|
66
|
+
if (buf1.isEOF())
|
67
|
+
error(getPos(), "End of file inside array");
|
68
|
+
shift();
|
69
|
+
|
70
|
+
// dictionary or stream
|
71
|
+
} else if (buf1.isCmd("<<")) {
|
72
|
+
shift();
|
73
|
+
obj->initDict(xref);
|
74
|
+
while (!buf1.isCmd(">>") && !buf1.isEOF()) {
|
75
|
+
if (!buf1.isName()) {
|
76
|
+
error(getPos(), "Dictionary key must be a name object");
|
77
|
+
shift();
|
78
|
+
} else {
|
79
|
+
key = copyString(buf1.getName());
|
80
|
+
shift();
|
81
|
+
if (buf1.isEOF() || buf1.isError()) {
|
82
|
+
gfree(key);
|
83
|
+
break;
|
84
|
+
}
|
85
|
+
obj->dictAdd(key, getObj(&obj2, fileKey, encAlgorithm, keyLength,
|
86
|
+
objNum, objGen));
|
87
|
+
}
|
88
|
+
}
|
89
|
+
if (buf1.isEOF())
|
90
|
+
error(getPos(), "End of file inside dictionary");
|
91
|
+
// stream objects are not allowed inside content streams or
|
92
|
+
// object streams
|
93
|
+
if (allowStreams && buf2.isCmd("stream")) {
|
94
|
+
if ((str = makeStream(obj, fileKey, encAlgorithm, keyLength,
|
95
|
+
objNum, objGen))) {
|
96
|
+
obj->initStream(str);
|
97
|
+
} else {
|
98
|
+
obj->free();
|
99
|
+
obj->initError();
|
100
|
+
}
|
101
|
+
} else {
|
102
|
+
shift();
|
103
|
+
}
|
104
|
+
|
105
|
+
// indirect reference or integer
|
106
|
+
} else if (buf1.isInt()) {
|
107
|
+
num = buf1.getInt();
|
108
|
+
shift();
|
109
|
+
if (buf1.isInt() && buf2.isCmd("R")) {
|
110
|
+
obj->initRef(num, buf1.getInt());
|
111
|
+
shift();
|
112
|
+
shift();
|
113
|
+
} else {
|
114
|
+
obj->initInt(num);
|
115
|
+
}
|
116
|
+
|
117
|
+
// string
|
118
|
+
} else if (buf1.isString() && fileKey) {
|
119
|
+
s = buf1.getString();
|
120
|
+
s2 = new GString();
|
121
|
+
obj2.initNull();
|
122
|
+
decrypt = new DecryptStream(new MemStream(s->getCString(), 0,
|
123
|
+
s->getLength(), &obj2),
|
124
|
+
fileKey, encAlgorithm, keyLength,
|
125
|
+
objNum, objGen);
|
126
|
+
decrypt->reset();
|
127
|
+
while ((c = decrypt->getChar()) != EOF) {
|
128
|
+
s2->append((char)c);
|
129
|
+
}
|
130
|
+
delete decrypt;
|
131
|
+
obj->initString(s2);
|
132
|
+
shift();
|
133
|
+
|
134
|
+
// simple object
|
135
|
+
} else {
|
136
|
+
buf1.copy(obj);
|
137
|
+
shift();
|
138
|
+
}
|
139
|
+
|
140
|
+
return obj;
|
141
|
+
}
|
142
|
+
|
143
|
+
Stream *Parser::makeStream(Object *dict, Guchar *fileKey,
|
144
|
+
CryptAlgorithm encAlgorithm, int keyLength,
|
145
|
+
int objNum, int objGen) {
|
146
|
+
Object obj;
|
147
|
+
BaseStream *baseStr;
|
148
|
+
Stream *str;
|
149
|
+
Guint pos, endPos, length;
|
150
|
+
|
151
|
+
// get stream start position
|
152
|
+
lexer->skipToNextLine();
|
153
|
+
pos = lexer->getPos();
|
154
|
+
|
155
|
+
// get length
|
156
|
+
dict->dictLookup("Length", &obj);
|
157
|
+
if (obj.isInt()) {
|
158
|
+
length = (Guint)obj.getInt();
|
159
|
+
obj.free();
|
160
|
+
} else {
|
161
|
+
error(getPos(), "Bad 'Length' attribute in stream");
|
162
|
+
obj.free();
|
163
|
+
return NULL;
|
164
|
+
}
|
165
|
+
|
166
|
+
// check for length in damaged file
|
167
|
+
if (xref && xref->getStreamEnd(pos, &endPos)) {
|
168
|
+
length = endPos - pos;
|
169
|
+
}
|
170
|
+
|
171
|
+
// in badly damaged PDF files, we can run off the end of the input
|
172
|
+
// stream immediately after the "stream" token
|
173
|
+
if (!lexer->getStream()) {
|
174
|
+
return NULL;
|
175
|
+
}
|
176
|
+
baseStr = lexer->getStream()->getBaseStream();
|
177
|
+
|
178
|
+
// skip over stream data
|
179
|
+
lexer->setPos(pos + length);
|
180
|
+
|
181
|
+
// refill token buffers and check for 'endstream'
|
182
|
+
shift(); // kill '>>'
|
183
|
+
shift(); // kill 'stream'
|
184
|
+
if (buf1.isCmd("endstream")) {
|
185
|
+
shift();
|
186
|
+
} else {
|
187
|
+
error(getPos(), "Missing 'endstream'");
|
188
|
+
// kludge for broken PDF files: just add 5k to the length, and
|
189
|
+
// hope its enough
|
190
|
+
length += 5000;
|
191
|
+
}
|
192
|
+
|
193
|
+
// make base stream
|
194
|
+
str = baseStr->makeSubStream(pos, gTrue, length, dict);
|
195
|
+
|
196
|
+
// handle decryption
|
197
|
+
if (fileKey) {
|
198
|
+
str = new DecryptStream(str, fileKey, encAlgorithm, keyLength,
|
199
|
+
objNum, objGen);
|
200
|
+
}
|
201
|
+
|
202
|
+
// get filters
|
203
|
+
str = str->addFilters(dict);
|
204
|
+
|
205
|
+
return str;
|
206
|
+
}
|
207
|
+
|
208
|
+
void Parser::shift() {
|
209
|
+
if (inlineImg > 0) {
|
210
|
+
if (inlineImg < 2) {
|
211
|
+
++inlineImg;
|
212
|
+
} else {
|
213
|
+
// in a damaged content stream, if 'ID' shows up in the middle
|
214
|
+
// of a dictionary, we need to reset
|
215
|
+
inlineImg = 0;
|
216
|
+
}
|
217
|
+
} else if (buf2.isCmd("ID")) {
|
218
|
+
lexer->skipChar(); // skip char after 'ID' command
|
219
|
+
inlineImg = 1;
|
220
|
+
}
|
221
|
+
buf1.free();
|
222
|
+
buf1 = buf2;
|
223
|
+
if (inlineImg > 0) // don't buffer inline image data
|
224
|
+
buf2.initNull();
|
225
|
+
else
|
226
|
+
lexer->getObj(&buf2);
|
227
|
+
}
|
@@ -0,0 +1,59 @@
|
|
1
|
+
//========================================================================
|
2
|
+
//
|
3
|
+
// Parser.h
|
4
|
+
//
|
5
|
+
// Copyright 1996-2003 Glyph & Cog, LLC
|
6
|
+
//
|
7
|
+
//========================================================================
|
8
|
+
|
9
|
+
#ifndef PARSER_H
|
10
|
+
#define PARSER_H
|
11
|
+
|
12
|
+
#include <aconf.h>
|
13
|
+
|
14
|
+
#ifdef USE_GCC_PRAGMAS
|
15
|
+
#pragma interface
|
16
|
+
#endif
|
17
|
+
|
18
|
+
#include "Lexer.h"
|
19
|
+
|
20
|
+
//------------------------------------------------------------------------
|
21
|
+
// Parser
|
22
|
+
//------------------------------------------------------------------------
|
23
|
+
|
24
|
+
class Parser {
|
25
|
+
public:
|
26
|
+
|
27
|
+
// Constructor.
|
28
|
+
Parser(XRef *xrefA, Lexer *lexerA, GBool allowStreamsA);
|
29
|
+
|
30
|
+
// Destructor.
|
31
|
+
~Parser();
|
32
|
+
|
33
|
+
// Get the next object from the input stream.
|
34
|
+
Object *getObj(Object *obj, Guchar *fileKey = NULL,
|
35
|
+
CryptAlgorithm encAlgorithm = cryptRC4, int keyLength = 0,
|
36
|
+
int objNum = 0, int objGen = 0);
|
37
|
+
|
38
|
+
// Get stream.
|
39
|
+
Stream *getStream() { return lexer->getStream(); }
|
40
|
+
|
41
|
+
// Get current position in file.
|
42
|
+
int getPos() { return lexer->getPos(); }
|
43
|
+
|
44
|
+
private:
|
45
|
+
|
46
|
+
XRef *xref; // the xref table for this PDF file
|
47
|
+
Lexer *lexer; // input stream
|
48
|
+
GBool allowStreams; // parse stream objects?
|
49
|
+
Object buf1, buf2; // next two tokens
|
50
|
+
int inlineImg; // set when inline image data is encountered
|
51
|
+
|
52
|
+
Stream *makeStream(Object *dict, Guchar *fileKey,
|
53
|
+
CryptAlgorithm encAlgorithm, int keyLength,
|
54
|
+
int objNum, int objGen);
|
55
|
+
void shift();
|
56
|
+
};
|
57
|
+
|
58
|
+
#endif
|
59
|
+
|