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,307 @@
|
|
1
|
+
//========================================================================
|
2
|
+
//
|
3
|
+
// ImgOutputDev.h
|
4
|
+
//
|
5
|
+
// Copyright 1997 Derek B. Noonburg
|
6
|
+
//
|
7
|
+
// Changed 1999 by G.Ovtcharov
|
8
|
+
//========================================================================
|
9
|
+
|
10
|
+
#ifndef HTMLOUTPUTDEV_H
|
11
|
+
#define HTMLOUTPUTDEV_H
|
12
|
+
|
13
|
+
#ifdef __GNUC__
|
14
|
+
#pragma interface
|
15
|
+
#endif
|
16
|
+
|
17
|
+
#include <stdio.h>
|
18
|
+
#include "gtypes.h"
|
19
|
+
#include "GList.h"
|
20
|
+
#include "GfxFont.h"
|
21
|
+
#include "OutputDev.h"
|
22
|
+
#include "XmlLinks.h"
|
23
|
+
#include "XmlFonts.h"
|
24
|
+
#include "Link.h"
|
25
|
+
#include "Catalog.h"
|
26
|
+
#include "UnicodeMap.h"
|
27
|
+
|
28
|
+
|
29
|
+
#ifdef WIN32
|
30
|
+
# define SLASH '\\'
|
31
|
+
#else
|
32
|
+
# define SLASH '/'
|
33
|
+
#endif
|
34
|
+
|
35
|
+
#define xoutRound(x) ((int)(x + 0.5))
|
36
|
+
#define xoutRoundLower(x) ((int)(x - 0.5))
|
37
|
+
|
38
|
+
#define DOCTYPE "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">"
|
39
|
+
#define DOCTYPE_FRAMES "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\"\n\"http://www.w3.org/TR/html4/frameset.dtd\">"
|
40
|
+
|
41
|
+
class GfxState;
|
42
|
+
class GString;
|
43
|
+
//------------------------------------------------------------------------
|
44
|
+
// HtmlString
|
45
|
+
//------------------------------------------------------------------------
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
class HtmlString {
|
50
|
+
public:
|
51
|
+
|
52
|
+
// Constructor.
|
53
|
+
HtmlString(GfxState *state, double fontSize, double charspace, XmlFontAccu* fonts);
|
54
|
+
|
55
|
+
// Destructor.
|
56
|
+
~HtmlString();
|
57
|
+
|
58
|
+
// Add a character to the string.
|
59
|
+
void addChar(GfxState *state, double x, double y,
|
60
|
+
double dx, double dy,
|
61
|
+
Unicode u);
|
62
|
+
XmlLink* getLink() { return link; }
|
63
|
+
void endString(); // postprocessing
|
64
|
+
|
65
|
+
private:
|
66
|
+
// aender die text variable
|
67
|
+
XmlLink *link;
|
68
|
+
double xMin, xMax; // bounding box x coordinates
|
69
|
+
double yMin, yMax; // bounding box y coordinates
|
70
|
+
int col; // starting column
|
71
|
+
Unicode *text; // the text
|
72
|
+
double *xRight; // right-hand x coord of each char
|
73
|
+
HtmlString *yxNext; // next string in y-major order
|
74
|
+
HtmlString *xyNext; // next string in x-major order
|
75
|
+
int fontpos;
|
76
|
+
GString* htext;
|
77
|
+
GString* htext2;
|
78
|
+
int strSize;
|
79
|
+
int len; // length of text and xRight
|
80
|
+
int size; // size of text and xRight arrays
|
81
|
+
UnicodeTextDirection dir; // direction (left to right/right to left)
|
82
|
+
|
83
|
+
friend class HtmlPage;
|
84
|
+
|
85
|
+
};
|
86
|
+
|
87
|
+
|
88
|
+
//------------------------------------------------------------------------
|
89
|
+
// HtmlPage
|
90
|
+
//------------------------------------------------------------------------
|
91
|
+
class HtmlPage {
|
92
|
+
public:
|
93
|
+
|
94
|
+
// Constructor.
|
95
|
+
HtmlPage(GBool rawOrder, GBool textAsJSON, GBool compressData, char *imgExtVal);
|
96
|
+
|
97
|
+
// Destructor.
|
98
|
+
~HtmlPage();
|
99
|
+
|
100
|
+
// Begin a new string.
|
101
|
+
void beginString(GfxState *state, GString *s);
|
102
|
+
|
103
|
+
// Add a character to the current string.
|
104
|
+
void addChar(GfxState *state, double x, double y,
|
105
|
+
double dx, double dy,
|
106
|
+
double ox, double oy,
|
107
|
+
Unicode *u, int uLen); //Guchar c);
|
108
|
+
|
109
|
+
void updateFont(GfxState *state);
|
110
|
+
void updateCharSpace(GfxState *state);
|
111
|
+
|
112
|
+
// End the current string, sorting it into the list of strings.
|
113
|
+
void endString();
|
114
|
+
|
115
|
+
// Coalesce strings that look like parts of the same line.
|
116
|
+
void coalesce();
|
117
|
+
|
118
|
+
// Find a string. If <top> is true, starts looking at top of page;
|
119
|
+
// otherwise starts looking at <xMin>,<yMin>. If <bottom> is true,
|
120
|
+
// stops looking at bottom of page; otherwise stops looking at
|
121
|
+
// <xMax>,<yMax>. If found, sets the text bounding rectange and
|
122
|
+
// returns true; otherwise returns false.
|
123
|
+
|
124
|
+
|
125
|
+
// new functions
|
126
|
+
void AddLink(const XmlLink& x){
|
127
|
+
links->AddLink(x);
|
128
|
+
}
|
129
|
+
|
130
|
+
void dump(FILE *f, int pageNum, GBool passedFirstPage);
|
131
|
+
|
132
|
+
// Clear the page.
|
133
|
+
void clear();
|
134
|
+
|
135
|
+
void conv();
|
136
|
+
private:
|
137
|
+
XmlFont* getFont(HtmlString *hStr) { return fonts->Get(hStr->fontpos); }
|
138
|
+
|
139
|
+
double fontSize; // current font size
|
140
|
+
GBool rawOrder; // keep strings in content stream order
|
141
|
+
GBool textAsJSON; // print text data in JSON format
|
142
|
+
GBool compressData; // compress data to a minimum format
|
143
|
+
double charspace;
|
144
|
+
HtmlString *curStr; // currently active string
|
145
|
+
|
146
|
+
HtmlString *yxStrings; // strings in y-major order
|
147
|
+
HtmlString *xyStrings; // strings in x-major order
|
148
|
+
HtmlString *yxCur1, *yxCur2; // cursors for yxStrings list
|
149
|
+
|
150
|
+
void setDocName(char* fname);
|
151
|
+
void dumpAsXML(FILE* f,int page, GBool passedFirstPage);
|
152
|
+
void dumpComplex(FILE* f, int page);
|
153
|
+
|
154
|
+
// marks the position of the fonts that belong to current page (for noframes)
|
155
|
+
int fontsPageMarker;
|
156
|
+
XmlFontAccu *fonts;
|
157
|
+
XmlLinks *links;
|
158
|
+
|
159
|
+
GString *DocName;
|
160
|
+
GString *imgExt;
|
161
|
+
int pageWidth;
|
162
|
+
int pageHeight;
|
163
|
+
int X1;
|
164
|
+
int X2;
|
165
|
+
int Y1;
|
166
|
+
int Y2;
|
167
|
+
static int pgNum;
|
168
|
+
int firstPage; // used to begin the numeration of pages
|
169
|
+
|
170
|
+
friend class ImgOutputDev;
|
171
|
+
};
|
172
|
+
|
173
|
+
//------------------------------------------------------------------------
|
174
|
+
// HtmlMetaVar
|
175
|
+
//------------------------------------------------------------------------
|
176
|
+
class HtmlMetaVar {
|
177
|
+
public:
|
178
|
+
HtmlMetaVar(char *_name, char *_content);
|
179
|
+
~HtmlMetaVar();
|
180
|
+
|
181
|
+
GString* toString();
|
182
|
+
|
183
|
+
private:
|
184
|
+
|
185
|
+
GString *name;
|
186
|
+
GString *content;
|
187
|
+
};
|
188
|
+
|
189
|
+
//------------------------------------------------------------------------
|
190
|
+
// ImgOutputDev
|
191
|
+
//------------------------------------------------------------------------
|
192
|
+
|
193
|
+
class ImgOutputDev: public OutputDev {
|
194
|
+
public:
|
195
|
+
|
196
|
+
// Open a text output file. If <fileName> is NULL, no file is written
|
197
|
+
// (this is useful, e.g., for searching text). If <useASCII7> is true,
|
198
|
+
// text is converted to 7-bit ASCII; otherwise, text is converted to
|
199
|
+
// 8-bit ISO Latin-1. <useASCII7> should also be set for Japanese
|
200
|
+
// (EUC-JP) text. If <rawOrder> is true, the text is kept in content
|
201
|
+
// stream order.
|
202
|
+
ImgOutputDev(char *fileName, char *title,
|
203
|
+
char *author,
|
204
|
+
char *keywords,
|
205
|
+
char *subject,
|
206
|
+
char *date,
|
207
|
+
char *extension,
|
208
|
+
GBool rawOrder,
|
209
|
+
GBool textAsJSON,
|
210
|
+
GBool compressData,
|
211
|
+
int firstPage = 1,
|
212
|
+
GBool outline = 0,
|
213
|
+
int numPages = 0);
|
214
|
+
|
215
|
+
// Destructor.
|
216
|
+
virtual ~ImgOutputDev();
|
217
|
+
|
218
|
+
// Check if file was successfully created.
|
219
|
+
virtual GBool isOk() { return ok; }
|
220
|
+
|
221
|
+
//---- get info about output device
|
222
|
+
|
223
|
+
// Does this device use upside-down coordinates?
|
224
|
+
// (Upside-down means (0,0) is the top left corner of the page.)
|
225
|
+
virtual GBool upsideDown() { return gTrue; }
|
226
|
+
|
227
|
+
// Does this device use drawChar() or drawString()?
|
228
|
+
virtual GBool useDrawChar() { return gTrue; }
|
229
|
+
|
230
|
+
// Does this device use beginType3Char/endType3Char? Otherwise,
|
231
|
+
// text in Type 3 fonts will be drawn with drawChar/drawString.
|
232
|
+
virtual GBool interpretType3Chars() { return gFalse; }
|
233
|
+
|
234
|
+
// Does this device need non-text content?
|
235
|
+
virtual GBool needNonText() { return gFalse; }
|
236
|
+
|
237
|
+
//----- initialization and control
|
238
|
+
|
239
|
+
// Start a page.
|
240
|
+
virtual void startPage(int pageNum, GfxState *state, double x1,double y1,double x2,double y2);
|
241
|
+
|
242
|
+
// End a page.
|
243
|
+
virtual void endPage();
|
244
|
+
|
245
|
+
//----- update text state
|
246
|
+
virtual void updateFont(GfxState *state);
|
247
|
+
virtual void updateCharSpace(GfxState *state);
|
248
|
+
|
249
|
+
//----- text drawing
|
250
|
+
virtual void beginString(GfxState *state, GString *s);
|
251
|
+
virtual void endString(GfxState *state);
|
252
|
+
virtual void drawChar(GfxState *state, double x, double y,
|
253
|
+
double dx, double dy,
|
254
|
+
double originX, double originY,
|
255
|
+
CharCode code,int nBytes, Unicode *u, int uLen);
|
256
|
+
|
257
|
+
virtual void drawImageMask(GfxState *state, Object *ref,
|
258
|
+
Stream *str,
|
259
|
+
int width, int height, GBool invert,
|
260
|
+
GBool inlineImg);
|
261
|
+
virtual void drawImage(GfxState *state, Object *ref, Stream *str,
|
262
|
+
int width, int height, GfxImageColorMap *colorMap,
|
263
|
+
int *maskColors, GBool inlineImg);
|
264
|
+
|
265
|
+
//new feature
|
266
|
+
virtual int DevType() {return 1234;}
|
267
|
+
virtual void drawLink(Link *link,Catalog *cat);
|
268
|
+
|
269
|
+
int getPageWidth() { return maxPageWidth; }
|
270
|
+
int getPageHeight() { return maxPageHeight; }
|
271
|
+
|
272
|
+
GBool dumpDocOutline(Catalog* catalog);
|
273
|
+
|
274
|
+
private:
|
275
|
+
// convert encoding into a HTML standard, or encoding->getCString if not
|
276
|
+
// recognized
|
277
|
+
static char* mapEncodingToHtml(GString* encoding);
|
278
|
+
GString* getLinkDest(Link *link,Catalog *catalog);
|
279
|
+
void dumpMetaVars(FILE *);
|
280
|
+
void doFrame(int firstPage);
|
281
|
+
GBool newOutlineLevel(FILE *output, Object *node, Catalog* catalog, int level = 1);
|
282
|
+
|
283
|
+
FILE *fContentsFrame;
|
284
|
+
FILE *page; // html file
|
285
|
+
//FILE *tin; // image log file
|
286
|
+
//GBool write;
|
287
|
+
GBool needClose; // need to close the file?
|
288
|
+
HtmlPage *pages; // text for the current page
|
289
|
+
GBool rawOrder; // keep text in content stream order
|
290
|
+
GBool textAsJSON; // print text data in JSON format
|
291
|
+
GBool compressData; // use compressed data mode
|
292
|
+
GBool doOutline; // output document outline
|
293
|
+
GBool ok; // set up ok?
|
294
|
+
GBool dumpJPEG;
|
295
|
+
GBool passedFirstPage;
|
296
|
+
int pageNum;
|
297
|
+
int maxPageWidth;
|
298
|
+
int maxPageHeight;
|
299
|
+
static int imgNum;
|
300
|
+
GString *Docname;
|
301
|
+
GString *docTitle;
|
302
|
+
GList *glMetaVars;
|
303
|
+
int numPages;
|
304
|
+
friend class HtmlPage;
|
305
|
+
};
|
306
|
+
|
307
|
+
#endif
|
Binary file
|
@@ -0,0 +1,68 @@
|
|
1
|
+
|
2
|
+
SHELL = /bin/sh
|
3
|
+
|
4
|
+
SRCDIR = .
|
5
|
+
XPDFSRCDIR = ../xpdf
|
6
|
+
XPDFLIBDIR = ../xpdf
|
7
|
+
GOOSRCDIR = ../goo
|
8
|
+
GOOLIBDIR = ../goo
|
9
|
+
FOFISRCDIR = ../fofi
|
10
|
+
FOFILIBDIR = ../fofi
|
11
|
+
SPLASHSRCDIR = ../splash
|
12
|
+
SPLASHLIBDIR = ../splash
|
13
|
+
|
14
|
+
CXXFLAGS = -I/usr/local/include -g -O2 -DHAVE_CONFIG_H -DHAVE_DIRENT_H=1 -I.. -DHAVE_REWINDDIR=1 -DHAVE_POPEN=1 -I.. -I$(GOOSRCDIR) -I$(XPDFSRCDIR) -I$(FOFISRCDIR) -I$(SPLASHSRCDIR) -I$(srcdir) -I/usr/X11R6/include
|
15
|
+
|
16
|
+
LDFLAGS =
|
17
|
+
FTLIBS =
|
18
|
+
|
19
|
+
OTHERLIBS =
|
20
|
+
|
21
|
+
CXX ?= c++
|
22
|
+
|
23
|
+
LIBPREFIX = lib
|
24
|
+
EXE =
|
25
|
+
|
26
|
+
#------------------------------------------------------------------------
|
27
|
+
|
28
|
+
.SUFFIXES: .cc
|
29
|
+
|
30
|
+
.cc.o:
|
31
|
+
$(CXX) $(CXXFLAGS) -c $<
|
32
|
+
|
33
|
+
#------------------------------------------------------------------------
|
34
|
+
|
35
|
+
CXX_SRC = \
|
36
|
+
$(SRCDIR)/pdf2json.cc \
|
37
|
+
$(SRCDIR)/ImgOutputDev.cc \
|
38
|
+
$(SRCDIR)/XmlFonts.cc \
|
39
|
+
$(SRCDIR)/XmlLinks.cc
|
40
|
+
|
41
|
+
#------------------------------------------------------------------------
|
42
|
+
|
43
|
+
all: pdf2json$(EXE)
|
44
|
+
|
45
|
+
#-------------------------------------------------------------------------
|
46
|
+
|
47
|
+
PDF2JSON_OBJS = ImgOutputDev.o XmlFonts.o XmlLinks.o \
|
48
|
+
pdf2json.o
|
49
|
+
PDF2JSON_LIBS = -L$(GOOLIBDIR) -L$(FOFILIBDIR) -L$(SPLASHLIBDIR) $(FTLIBS) -L$(XPDFLIBDIR) $(OTHERLIBS) -lXpdf -lGoo -lfofi -lsplash -lm
|
50
|
+
|
51
|
+
pdf2json$(EXE): $(PDF2JSON_OBJS) $(GOOLIBDIR)/$(LIBPREFIX)Goo.a
|
52
|
+
$(CXX) $(CXXFLAGS) $(LDFLAGS) -o pdf2json$(EXE) $(PDF2JSON_OBJS) \
|
53
|
+
$(PDF2JSON_LIBS)
|
54
|
+
|
55
|
+
#-------------------------------------------------------------------------
|
56
|
+
PDF2JSON_WINOBJS = pdf2json.exe ImgOutPutDev.obj pdf2json.obj XmlFonts.obj XmlLinks.obj
|
57
|
+
|
58
|
+
clean:
|
59
|
+
rm -f $(PDF2JSON_OBJS) pdf2json$(EXE)
|
60
|
+
rm -f $(PDF2JSON_WINOBJS)
|
61
|
+
|
62
|
+
#------------------------------------------------------------------------
|
63
|
+
|
64
|
+
distdepend:
|
65
|
+
cp Makefile.in Makefile.in.bak
|
66
|
+
sed '/^#----- dependences -----/q' Makefile.in.bak >Makefile.in
|
67
|
+
$(CXX) $(CXXFLAGS) -MM $(CXX_SRC) >>Makefile.in
|
68
|
+
|
@@ -0,0 +1,68 @@
|
|
1
|
+
|
2
|
+
SHELL = /bin/sh
|
3
|
+
|
4
|
+
SRCDIR = .
|
5
|
+
XPDFSRCDIR = ../xpdf
|
6
|
+
XPDFLIBDIR = ../xpdf
|
7
|
+
GOOSRCDIR = ../goo
|
8
|
+
GOOLIBDIR = ../goo
|
9
|
+
FOFISRCDIR = ../fofi
|
10
|
+
FOFILIBDIR = ../fofi
|
11
|
+
SPLASHSRCDIR = ../splash
|
12
|
+
SPLASHLIBDIR = ../splash
|
13
|
+
|
14
|
+
CXXFLAGS = -I/usr/local/include -g -O2 -DHAVE_CONFIG_H -DHAVE_DIRENT_H=1 -I.. -DHAVE_REWINDDIR=1 -DHAVE_POPEN=1 -I.. -I$(GOOSRCDIR) -I$(XPDFSRCDIR) -I$(FOFISRCDIR) -I$(SPLASHSRCDIR) -I$(srcdir) -I/usr/X11R6/include
|
15
|
+
|
16
|
+
LDFLAGS =
|
17
|
+
FTLIBS =
|
18
|
+
|
19
|
+
OTHERLIBS =
|
20
|
+
|
21
|
+
CXX ?= c++
|
22
|
+
|
23
|
+
LIBPREFIX = lib
|
24
|
+
EXE =
|
25
|
+
|
26
|
+
#------------------------------------------------------------------------
|
27
|
+
|
28
|
+
.SUFFIXES: .cc
|
29
|
+
|
30
|
+
.cc.o:
|
31
|
+
$(CXX) $(CXXFLAGS) -c $<
|
32
|
+
|
33
|
+
#------------------------------------------------------------------------
|
34
|
+
|
35
|
+
CXX_SRC = \
|
36
|
+
$(SRCDIR)/pdf2json.cc \
|
37
|
+
$(SRCDIR)/ImgOutputDev.cc \
|
38
|
+
$(SRCDIR)/XmlFonts.cc \
|
39
|
+
$(SRCDIR)/XmlLinks.cc
|
40
|
+
|
41
|
+
#------------------------------------------------------------------------
|
42
|
+
|
43
|
+
all: pdf2json$(EXE)
|
44
|
+
|
45
|
+
#-------------------------------------------------------------------------
|
46
|
+
|
47
|
+
PDF2JSON_OBJS = ImgOutputDev.o XmlFonts.o XmlLinks.o \
|
48
|
+
pdf2json.o
|
49
|
+
PDF2JSON_LIBS = -L$(GOOLIBDIR) -L$(FOFILIBDIR) -L$(SPLASHLIBDIR) $(FTLIBS) -L$(XPDFLIBDIR) $(OTHERLIBS) -lXpdf -lGoo -lfofi -lsplash -lm
|
50
|
+
|
51
|
+
pdf2json$(EXE): $(PDF2JSON_OBJS) $(GOOLIBDIR)/$(LIBPREFIX)Goo.a
|
52
|
+
$(CXX) $(CXXFLAGS) $(LDFLAGS) -o pdf2json$(EXE) $(PDF2JSON_OBJS) \
|
53
|
+
$(PDF2JSON_LIBS)
|
54
|
+
|
55
|
+
#-------------------------------------------------------------------------
|
56
|
+
PDF2JSON_WINOBJS = pdf2json.exe ImgOutPutDev.obj pdf2json.obj XmlFonts.obj XmlLinks.obj
|
57
|
+
|
58
|
+
clean:
|
59
|
+
rm -f $(PDF2JSON_OBJS) pdf2json$(EXE)
|
60
|
+
rm -f $(PDF2JSON_WINOBJS)
|
61
|
+
|
62
|
+
#------------------------------------------------------------------------
|
63
|
+
|
64
|
+
distdepend:
|
65
|
+
cp Makefile.in Makefile.in.bak
|
66
|
+
sed '/^#----- dependences -----/q' Makefile.in.bak >Makefile.in
|
67
|
+
$(CXX) $(CXXFLAGS) -MM $(CXX_SRC) >>Makefile.in
|
68
|
+
|
@@ -0,0 +1,367 @@
|
|
1
|
+
#include "XmlFonts.h"
|
2
|
+
#include "GlobalParams.h"
|
3
|
+
#include "UnicodeMap.h"
|
4
|
+
#include <stdio.h>
|
5
|
+
|
6
|
+
#ifndef _WIN32
|
7
|
+
#include <unistd.h>
|
8
|
+
#endif
|
9
|
+
|
10
|
+
struct Fonts{
|
11
|
+
char *Fontname;
|
12
|
+
char *name;
|
13
|
+
};
|
14
|
+
|
15
|
+
const int font_num=13;
|
16
|
+
|
17
|
+
static Fonts fonts[font_num+1]={
|
18
|
+
{"Courier", "Courier" },
|
19
|
+
{"Courier-Bold", "Courier"},
|
20
|
+
{"Courier-BoldOblique", "Courier"},
|
21
|
+
{"Courier-Oblique", "Courier"},
|
22
|
+
{"Helvetica", "Helvetica"},
|
23
|
+
{"Helvetica-Bold", "Helvetica"},
|
24
|
+
{"Helvetica-BoldOblique", "Helvetica"},
|
25
|
+
{"Helvetica-Oblique", "Helvetica"},
|
26
|
+
{"Symbol", "Symbol" },
|
27
|
+
{"Times-Bold", "Times" },
|
28
|
+
{"Times-BoldItalic", "Times" },
|
29
|
+
{"Times-Italic", "Times" },
|
30
|
+
{"Times-Roman", "Times" },
|
31
|
+
{" " , "Times" },
|
32
|
+
};
|
33
|
+
|
34
|
+
#define xoutRound(x) ((int)(x + 0.5))
|
35
|
+
extern GBool xml;
|
36
|
+
|
37
|
+
GString* XmlFont::DefaultFont=new GString("Times"); // Arial,Helvetica,sans-serif
|
38
|
+
|
39
|
+
XmlFontColor::XmlFontColor(GfxRGB rgb){
|
40
|
+
/*
|
41
|
+
r=static_cast<int>(255*rgb.r);
|
42
|
+
g=static_cast<int>(255*rgb.g);
|
43
|
+
b=static_cast<int>(255*rgb.b);
|
44
|
+
*/
|
45
|
+
r=colToByte(rgb.r);
|
46
|
+
g=colToByte(rgb.g);
|
47
|
+
b=colToByte(rgb.b);
|
48
|
+
if (!(Ok(r)&&Ok(b)&&Ok(g))) {printf("Error : Bad color \n");r=0;g=0;b=0;}
|
49
|
+
|
50
|
+
}
|
51
|
+
|
52
|
+
GString *XmlFontColor::convtoX(unsigned int xcol) const{
|
53
|
+
GString *xret=new GString();
|
54
|
+
char tmp;
|
55
|
+
unsigned int k;
|
56
|
+
k = (xcol/16);
|
57
|
+
if ((k>=0)&&(k<10)) tmp=(char) ('0'+k); else tmp=(char)('a'+k-10);
|
58
|
+
xret->append(tmp);
|
59
|
+
k = (xcol%16);
|
60
|
+
if ((k>=0)&&(k<10)) tmp=(char) ('0'+k); else tmp=(char)('a'+k-10);
|
61
|
+
xret->append(tmp);
|
62
|
+
return xret;
|
63
|
+
}
|
64
|
+
|
65
|
+
GString *XmlFontColor::toString() const{
|
66
|
+
GString *tmp=new GString("#");
|
67
|
+
GString *tmpr=convtoX(r);
|
68
|
+
GString *tmpg=convtoX(g);
|
69
|
+
GString *tmpb=convtoX(b);
|
70
|
+
tmp->append(tmpr);
|
71
|
+
tmp->append(tmpg);
|
72
|
+
tmp->append(tmpb);
|
73
|
+
delete tmpr;
|
74
|
+
delete tmpg;
|
75
|
+
delete tmpb;
|
76
|
+
return tmp;
|
77
|
+
}
|
78
|
+
|
79
|
+
XmlFont::XmlFont(GString* ftname,int _size, double _charspace, GfxRGB rgb){
|
80
|
+
//if (col) color=XmlFontColor(col);
|
81
|
+
//else color=XmlFontColor();
|
82
|
+
color=XmlFontColor(rgb);
|
83
|
+
|
84
|
+
GString *fontname = NULL;
|
85
|
+
charspace = _charspace;
|
86
|
+
|
87
|
+
if( ftname ){
|
88
|
+
fontname = new GString(ftname);
|
89
|
+
FontName=new GString(ftname);
|
90
|
+
}
|
91
|
+
else {
|
92
|
+
fontname = NULL;
|
93
|
+
FontName = NULL;
|
94
|
+
}
|
95
|
+
|
96
|
+
lineSize = -1;
|
97
|
+
|
98
|
+
size=(_size-1);
|
99
|
+
italic = gFalse;
|
100
|
+
bold = gFalse;
|
101
|
+
oblique = gFalse;
|
102
|
+
|
103
|
+
if (fontname){
|
104
|
+
if (strstr(fontname->lowerCase()->getCString(),"bold")) bold=gTrue;
|
105
|
+
if (strstr(fontname->lowerCase()->getCString(),"italic")) italic=gTrue;
|
106
|
+
if (strstr(fontname->lowerCase()->getCString(),"oblique")) oblique=gTrue;
|
107
|
+
/*||strstr(fontname->lowerCase()->getCString(),"oblique")) italic=gTrue;*/
|
108
|
+
|
109
|
+
int i=0;
|
110
|
+
while (strcmp(ftname->getCString(),fonts[i].Fontname)&&(i<font_num))
|
111
|
+
{
|
112
|
+
i++;
|
113
|
+
}
|
114
|
+
pos=i;
|
115
|
+
delete fontname;
|
116
|
+
}
|
117
|
+
if (!DefaultFont) DefaultFont=new GString(fonts[font_num].name);
|
118
|
+
|
119
|
+
}
|
120
|
+
|
121
|
+
XmlFont::XmlFont(const XmlFont& x){
|
122
|
+
size=x.size;
|
123
|
+
lineSize=x.lineSize;
|
124
|
+
italic=x.italic;
|
125
|
+
oblique=x.oblique;
|
126
|
+
bold=x.bold;
|
127
|
+
pos=x.pos;
|
128
|
+
charspace=x.charspace;
|
129
|
+
color=x.color;
|
130
|
+
if (x.FontName) FontName=new GString(x.FontName);
|
131
|
+
}
|
132
|
+
|
133
|
+
|
134
|
+
XmlFont::~XmlFont(){
|
135
|
+
if (FontName) delete FontName;
|
136
|
+
}
|
137
|
+
|
138
|
+
XmlFont& XmlFont::operator=(const XmlFont& x){
|
139
|
+
if (this==&x) return *this;
|
140
|
+
size=x.size;
|
141
|
+
lineSize=x.lineSize;
|
142
|
+
italic=x.italic;
|
143
|
+
oblique=x.oblique;
|
144
|
+
bold=x.bold;
|
145
|
+
pos=x.pos;
|
146
|
+
color=x.color;
|
147
|
+
charspace=x.charspace;
|
148
|
+
if (FontName) delete FontName;
|
149
|
+
if (x.FontName) FontName=new GString(x.FontName);
|
150
|
+
return *this;
|
151
|
+
}
|
152
|
+
|
153
|
+
void XmlFont::clear(){
|
154
|
+
if(DefaultFont) delete DefaultFont;
|
155
|
+
DefaultFont = NULL;
|
156
|
+
}
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
/*
|
161
|
+
This function is used to compare font uniquily for insertion into
|
162
|
+
the list of all encountered fonts
|
163
|
+
*/
|
164
|
+
GBool XmlFont::isEqual(const XmlFont& x) const{
|
165
|
+
return ((size==x.size) && (lineSize==x.lineSize) && (charspace==x.charspace) &&
|
166
|
+
(pos==x.pos) && (bold==x.bold) && (oblique==x.oblique) && (italic==x.italic) &&
|
167
|
+
(color.isEqual(x.getColor())));
|
168
|
+
}
|
169
|
+
|
170
|
+
/*
|
171
|
+
This one is used to decide whether two pieces of text can be joined together
|
172
|
+
and therefore we don't care about bold/italics properties
|
173
|
+
*/
|
174
|
+
GBool XmlFont::isEqualIgnoreBold(const XmlFont& x) const{
|
175
|
+
return ((size==x.size) &&
|
176
|
+
(color.isEqual(x.getColor())));
|
177
|
+
}
|
178
|
+
|
179
|
+
GString* XmlFont::getFontName(){
|
180
|
+
if (pos!=font_num) return new GString(fonts[pos].name);
|
181
|
+
else return new GString(DefaultFont);
|
182
|
+
}
|
183
|
+
|
184
|
+
GString* XmlFont::getFullName(){
|
185
|
+
if (FontName)
|
186
|
+
return new GString(FontName);
|
187
|
+
else return new GString(DefaultFont);
|
188
|
+
}
|
189
|
+
|
190
|
+
void XmlFont::setDefaultFont(GString* defaultFont){
|
191
|
+
if (DefaultFont) delete DefaultFont;
|
192
|
+
DefaultFont=new GString(defaultFont);
|
193
|
+
}
|
194
|
+
|
195
|
+
|
196
|
+
GString* XmlFont::getDefaultFont(){
|
197
|
+
return DefaultFont;
|
198
|
+
}
|
199
|
+
|
200
|
+
// this method if plain wrong todo
|
201
|
+
GString* XmlFont::HtmlFilter(Unicode* u, int uLen) {
|
202
|
+
GString *tmp = new GString();
|
203
|
+
UnicodeMap *uMap;
|
204
|
+
char buf[8];
|
205
|
+
int n;
|
206
|
+
|
207
|
+
// get the output encoding
|
208
|
+
if (!(uMap = globalParams->getTextEncoding())) {
|
209
|
+
return tmp;
|
210
|
+
}
|
211
|
+
|
212
|
+
for (int i = 0; i < uLen; ++i) {
|
213
|
+
switch (u[i])
|
214
|
+
{
|
215
|
+
case '"': tmp->append("""); break;
|
216
|
+
case '&': tmp->append("&"); break;
|
217
|
+
case '<': tmp->append("<"); break;
|
218
|
+
case '>': tmp->append(">"); break;
|
219
|
+
default:
|
220
|
+
{
|
221
|
+
// convert unicode to string
|
222
|
+
if ((n = uMap->mapUnicode(u[i], buf, sizeof(buf))) > 0) {
|
223
|
+
tmp->append(buf, n);
|
224
|
+
}
|
225
|
+
}
|
226
|
+
}
|
227
|
+
}
|
228
|
+
|
229
|
+
uMap->decRefCnt();
|
230
|
+
return tmp;
|
231
|
+
}
|
232
|
+
|
233
|
+
GString* XmlFont::simple(XmlFont* font, Unicode* content, int uLen){
|
234
|
+
GString *cont=HtmlFilter (content, uLen);
|
235
|
+
|
236
|
+
/*if (font.isBold()) {
|
237
|
+
cont->insert(0,"<b>",3);
|
238
|
+
cont->append("</b>",4);
|
239
|
+
}
|
240
|
+
if (font.isItalic()) {
|
241
|
+
cont->insert(0,"<i>",3);
|
242
|
+
cont->append("</i>",4);x.oblique
|
243
|
+
} */
|
244
|
+
|
245
|
+
return cont;
|
246
|
+
}
|
247
|
+
|
248
|
+
XmlFontAccu::XmlFontAccu(){
|
249
|
+
accu=new GVector<XmlFont>();
|
250
|
+
}
|
251
|
+
|
252
|
+
XmlFontAccu::~XmlFontAccu(){
|
253
|
+
if (accu) delete accu;
|
254
|
+
}
|
255
|
+
|
256
|
+
int XmlFontAccu::AddFont(const XmlFont& font){
|
257
|
+
GVector<XmlFont>::iterator i;
|
258
|
+
for (i=accu->begin();i!=accu->end();i++)
|
259
|
+
{
|
260
|
+
if (font.isEqual(*i))
|
261
|
+
{
|
262
|
+
return (int)(i-(accu->begin()));
|
263
|
+
}
|
264
|
+
}
|
265
|
+
|
266
|
+
accu->push_back(font);
|
267
|
+
return (accu->size()-1);
|
268
|
+
}
|
269
|
+
|
270
|
+
static GString* EscapeSpecialChars( GString* s)
|
271
|
+
{
|
272
|
+
GString* tmp = NULL;
|
273
|
+
for( int i = 0, j = 0; i < s->getLength(); i++, j++ ){
|
274
|
+
const char *replace = NULL;
|
275
|
+
switch ( s->getChar(i) ){
|
276
|
+
case '"': replace = "\\u0022"; break;
|
277
|
+
case '\\': replace = "\\u005C"; break;
|
278
|
+
case '<': replace = "\\u003C"; break;
|
279
|
+
case '>': replace = "\\u003E"; break;
|
280
|
+
case '\'': replace = "\\u0027"; break;
|
281
|
+
case '&': replace = "\\u0026"; break;
|
282
|
+
case '\n': replace = ""; break;
|
283
|
+
case '\r': replace = ""; break;
|
284
|
+
case '\t': replace = ""; break;
|
285
|
+
default: continue;
|
286
|
+
}
|
287
|
+
if( replace ){
|
288
|
+
if( !tmp ) tmp = new GString( s );
|
289
|
+
if( tmp ){
|
290
|
+
tmp->del( j, 1 );
|
291
|
+
int l = strlen( replace );
|
292
|
+
tmp->insert( j, replace, l );
|
293
|
+
j += l - 1;
|
294
|
+
}
|
295
|
+
}
|
296
|
+
}
|
297
|
+
return tmp ? tmp : s;
|
298
|
+
}
|
299
|
+
|
300
|
+
// get CSS font name for font #i
|
301
|
+
GString* XmlFontAccu::getCSStyle(int i, GString* content){
|
302
|
+
GString *tmp;
|
303
|
+
GString *iStr=GString::fromInt(i);
|
304
|
+
|
305
|
+
if (!xml) {
|
306
|
+
tmp = new GString("<span class=\"ft");
|
307
|
+
tmp->append(iStr);
|
308
|
+
tmp->append("\">");
|
309
|
+
tmp->append(content);
|
310
|
+
tmp->append("</span>");
|
311
|
+
} else {
|
312
|
+
tmp = EscapeSpecialChars(content);
|
313
|
+
//tmp->append(content);
|
314
|
+
}
|
315
|
+
|
316
|
+
delete iStr;
|
317
|
+
return tmp;
|
318
|
+
}
|
319
|
+
|
320
|
+
|
321
|
+
// get CSS font definition for font #i
|
322
|
+
GString* XmlFontAccu::CSStyle(int i,GBool textAsJSON){
|
323
|
+
GString *tmp=new GString();
|
324
|
+
GString *iStr=GString::fromInt(i);
|
325
|
+
|
326
|
+
GVector<XmlFont>::iterator g=accu->begin();
|
327
|
+
g+=i;
|
328
|
+
XmlFont font=*g;
|
329
|
+
GString *Size=GString::fromInt(font.getSize());
|
330
|
+
GString *colorStr=font.getColor().toString();
|
331
|
+
GString *fontName=font.getFontName();
|
332
|
+
GString *lSize;
|
333
|
+
double _charspace = font.getCharSpace();
|
334
|
+
char *cspace = new char [20];
|
335
|
+
sprintf(cspace,"%0.05f",_charspace);
|
336
|
+
|
337
|
+
if (xml && !textAsJSON) {
|
338
|
+
tmp->append("<fontspec id=\"");
|
339
|
+
tmp->append(iStr);
|
340
|
+
tmp->append("\" size=\"");
|
341
|
+
tmp->append(Size);
|
342
|
+
tmp->append("\" family=\"");
|
343
|
+
tmp->append(fontName); //font.getFontName());
|
344
|
+
tmp->append("\" color=\"");
|
345
|
+
tmp->append(colorStr);
|
346
|
+
tmp->append("\"/>");
|
347
|
+
}else if(textAsJSON){
|
348
|
+
tmp->append("{\"fontspec\":\"");
|
349
|
+
tmp->append(iStr);
|
350
|
+
tmp->append("\",\"size\":\"");
|
351
|
+
tmp->append(Size);
|
352
|
+
tmp->append("\",\"family\":\"");
|
353
|
+
tmp->append(fontName); //font.getFontName());
|
354
|
+
tmp->append("\",\"color\":\"");
|
355
|
+
tmp->append(colorStr);
|
356
|
+
tmp->append("\"}");
|
357
|
+
}
|
358
|
+
|
359
|
+
delete fontName;
|
360
|
+
delete colorStr;
|
361
|
+
delete iStr;
|
362
|
+
delete Size;
|
363
|
+
delete cspace;
|
364
|
+
return tmp;
|
365
|
+
}
|
366
|
+
|
367
|
+
|