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
Binary file
|
Binary file
|
File without changes
|
Binary file
|
@@ -0,0 +1,101 @@
|
|
1
|
+
#ifndef _VECTOR_H
|
2
|
+
#define _VECTOR_H
|
3
|
+
#include "gtypes.h"
|
4
|
+
|
5
|
+
|
6
|
+
template<class T>
|
7
|
+
class GVector{
|
8
|
+
private:
|
9
|
+
|
10
|
+
int _size;
|
11
|
+
T* last;
|
12
|
+
T* storage;
|
13
|
+
|
14
|
+
void resize(){
|
15
|
+
if (_size==0) _size=2;else _size=2*_size;
|
16
|
+
T *tmp=new T[_size];
|
17
|
+
if (storage){
|
18
|
+
last=copy(storage,last,tmp);
|
19
|
+
delete [] storage;
|
20
|
+
}
|
21
|
+
else last=tmp;
|
22
|
+
storage=tmp;
|
23
|
+
}
|
24
|
+
|
25
|
+
T* copy(T* src1,T* scr2,T* dest){
|
26
|
+
T* tmp=src1;
|
27
|
+
T* d=dest;
|
28
|
+
while(tmp!=scr2){
|
29
|
+
*d=*tmp;
|
30
|
+
d++;tmp++;
|
31
|
+
}
|
32
|
+
return d;
|
33
|
+
}
|
34
|
+
|
35
|
+
public:
|
36
|
+
typedef T* iterator;
|
37
|
+
|
38
|
+
GVector(){
|
39
|
+
_size=0;
|
40
|
+
last=0;
|
41
|
+
storage=0;
|
42
|
+
}
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
virtual ~GVector(){
|
47
|
+
delete[] storage ;
|
48
|
+
}
|
49
|
+
|
50
|
+
void reset(){
|
51
|
+
last=storage;
|
52
|
+
}
|
53
|
+
|
54
|
+
int size(){
|
55
|
+
return (last-storage);
|
56
|
+
}
|
57
|
+
void push_back(const T& elem){
|
58
|
+
if (!storage||(size() >=_size)) resize();
|
59
|
+
*last=elem;
|
60
|
+
last++;
|
61
|
+
|
62
|
+
|
63
|
+
}
|
64
|
+
|
65
|
+
|
66
|
+
T pop_back() {
|
67
|
+
if (last!=storage) last--;
|
68
|
+
|
69
|
+
return *last;
|
70
|
+
}
|
71
|
+
|
72
|
+
|
73
|
+
T operator[](unsigned int i){
|
74
|
+
return *(storage+i);
|
75
|
+
}
|
76
|
+
|
77
|
+
|
78
|
+
GBool isEmpty() const{
|
79
|
+
return !_size || (last==storage) ;
|
80
|
+
}
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
iterator begin() const{
|
85
|
+
return storage;
|
86
|
+
}
|
87
|
+
|
88
|
+
iterator end() const {
|
89
|
+
return last;
|
90
|
+
}
|
91
|
+
};
|
92
|
+
#endif
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
@@ -0,0 +1,1243 @@
|
|
1
|
+
//========================================================================
|
2
|
+
//
|
3
|
+
// ImgOutputDev.cc
|
4
|
+
//
|
5
|
+
// Copyright 2011 Devaldi Ltd
|
6
|
+
//
|
7
|
+
// Copyright 1997-2002 Glyph & Cog, LLC
|
8
|
+
//
|
9
|
+
// Changed 1999-2000 by G.Ovtcharov
|
10
|
+
//
|
11
|
+
// Changed 2002 by Mikhail Kruk
|
12
|
+
//
|
13
|
+
//========================================================================
|
14
|
+
|
15
|
+
#ifdef __GNUC__
|
16
|
+
#pragma implementation
|
17
|
+
#endif
|
18
|
+
|
19
|
+
#include <stdio.h>
|
20
|
+
#include <stdlib.h>
|
21
|
+
#include <stdarg.h>
|
22
|
+
#include <stddef.h>
|
23
|
+
#include <ctype.h>
|
24
|
+
#include <math.h>
|
25
|
+
#include "GString.h"
|
26
|
+
#include "GList.h"
|
27
|
+
#include "UnicodeMap.h"
|
28
|
+
#include "gmem.h"
|
29
|
+
#include "config.h"
|
30
|
+
#include "Error.h"
|
31
|
+
#include "GfxState.h"
|
32
|
+
#include "GlobalParams.h"
|
33
|
+
#include "ImgOutputDev.h"
|
34
|
+
#include "XmlFonts.h"
|
35
|
+
|
36
|
+
|
37
|
+
int HtmlPage::pgNum=0;
|
38
|
+
int ImgOutputDev::imgNum=1;
|
39
|
+
|
40
|
+
extern double scale;
|
41
|
+
extern GBool complexMode;
|
42
|
+
extern GBool ignore;
|
43
|
+
extern GBool printCommands;
|
44
|
+
extern GBool printHtml;
|
45
|
+
extern GBool noframes;
|
46
|
+
extern GBool stout;
|
47
|
+
extern GBool xml;
|
48
|
+
extern GBool showHidden;
|
49
|
+
extern GBool noMerge;
|
50
|
+
|
51
|
+
static GString* basename(GString* str){
|
52
|
+
|
53
|
+
char *p=str->getCString();
|
54
|
+
int len=str->getLength();
|
55
|
+
for (int i=len-1;i>=0;i--)
|
56
|
+
if (*(p+i)==SLASH)
|
57
|
+
return new GString((p+i+1),len-i-1);
|
58
|
+
return new GString(str);
|
59
|
+
}
|
60
|
+
|
61
|
+
static GString* Dirname(GString* str){
|
62
|
+
|
63
|
+
char *p=str->getCString();
|
64
|
+
int len=str->getLength();
|
65
|
+
for (int i=len-1;i>=0;i--)
|
66
|
+
if (*(p+i)==SLASH)
|
67
|
+
return new GString(p,i+1);
|
68
|
+
return new GString();
|
69
|
+
}
|
70
|
+
|
71
|
+
//------------------------------------------------------------------------
|
72
|
+
// HtmlString
|
73
|
+
//------------------------------------------------------------------------
|
74
|
+
|
75
|
+
HtmlString::HtmlString(GfxState *state, double fontSize, double _charspace, XmlFontAccu* fonts) {
|
76
|
+
GfxFont *font;
|
77
|
+
double x, y;
|
78
|
+
|
79
|
+
state->transform(state->getCurX(), state->getCurY(), &x, &y);
|
80
|
+
if ((font = state->getFont())) {
|
81
|
+
yMin = y - font->getAscent() * fontSize;
|
82
|
+
yMax = y - font->getDescent() * fontSize;
|
83
|
+
GfxRGB rgb;
|
84
|
+
state->getFillRGB(&rgb);
|
85
|
+
GString *name = state->getFont()->getName();
|
86
|
+
if (!name) name = XmlFont::getDefaultFont(); //new GString("default");
|
87
|
+
// XmlFont hfont=XmlFont(name, static_cast<int>(fontSize-1),_charspace, rgb);
|
88
|
+
XmlFont hfont=XmlFont(name, static_cast<int>(fontSize-1),0.0, rgb);
|
89
|
+
fontpos = fonts->AddFont(hfont);
|
90
|
+
} else {
|
91
|
+
// this means that the PDF file draws text without a current font,
|
92
|
+
// which should never happen
|
93
|
+
yMin = y - 0.95 * fontSize;
|
94
|
+
yMax = y + 0.35 * fontSize;
|
95
|
+
fontpos=0;
|
96
|
+
}
|
97
|
+
if (yMin == yMax) {
|
98
|
+
// this is a sanity check for a case that shouldn't happen -- but
|
99
|
+
// if it does happen, we want to avoid dividing by zero later
|
100
|
+
yMin = y;
|
101
|
+
yMax = y + 1;
|
102
|
+
}
|
103
|
+
col = 0;
|
104
|
+
text = NULL;
|
105
|
+
xRight = NULL;
|
106
|
+
link = NULL;
|
107
|
+
len = size = 0;
|
108
|
+
yxNext = NULL;
|
109
|
+
xyNext = NULL;
|
110
|
+
strSize = 0;
|
111
|
+
htext=new GString();
|
112
|
+
htext2=new GString();
|
113
|
+
dir = textDirUnknown;
|
114
|
+
}
|
115
|
+
|
116
|
+
|
117
|
+
HtmlString::~HtmlString() {
|
118
|
+
delete text;
|
119
|
+
delete htext;
|
120
|
+
delete htext2;
|
121
|
+
// delete strSize;
|
122
|
+
gfree(xRight);
|
123
|
+
}
|
124
|
+
|
125
|
+
void HtmlString::addChar(GfxState *state, double x, double y,
|
126
|
+
double dx, double dy, Unicode u) {
|
127
|
+
if (dir == textDirUnknown) {
|
128
|
+
dir = UnicodeMap::getDirection(u);
|
129
|
+
}
|
130
|
+
|
131
|
+
if (len == size) {
|
132
|
+
size += 16;
|
133
|
+
text = (Unicode *)grealloc(text, size * sizeof(Unicode));
|
134
|
+
xRight = (double *)grealloc(xRight, size * sizeof(double));
|
135
|
+
}
|
136
|
+
text[len] = u;
|
137
|
+
if (len == 0) {
|
138
|
+
xMin = x;
|
139
|
+
}
|
140
|
+
xMax = xRight[len] = x + dx;
|
141
|
+
//xMax = xRight[len] = x;
|
142
|
+
++strSize;
|
143
|
+
//printf("added char: %f %f xright = %f\n", x, dx, x+dx);
|
144
|
+
++len;
|
145
|
+
}
|
146
|
+
|
147
|
+
void HtmlString::endString()
|
148
|
+
{
|
149
|
+
if( dir == textDirRightLeft && len > 1 )
|
150
|
+
{
|
151
|
+
//printf("will reverse!\n");
|
152
|
+
for (int i = 0; i < len / 2; i++)
|
153
|
+
{
|
154
|
+
Unicode ch = text[i];
|
155
|
+
text[i] = text[len - i - 1];
|
156
|
+
text[len - i - 1] = ch;
|
157
|
+
}
|
158
|
+
}
|
159
|
+
}
|
160
|
+
|
161
|
+
//------------------------------------------------------------------------
|
162
|
+
// HtmlPage
|
163
|
+
//------------------------------------------------------------------------
|
164
|
+
|
165
|
+
HtmlPage::HtmlPage(GBool rawOrder, GBool textAsJSON, GBool compressData, char *imgExtVal) {
|
166
|
+
this->rawOrder = rawOrder;
|
167
|
+
this->textAsJSON = textAsJSON;
|
168
|
+
this->compressData = compressData;
|
169
|
+
curStr = NULL;
|
170
|
+
yxStrings = NULL;
|
171
|
+
xyStrings = NULL;
|
172
|
+
yxCur1 = yxCur2 = NULL;
|
173
|
+
fonts=new XmlFontAccu();
|
174
|
+
links=new XmlLinks();
|
175
|
+
pageWidth=0;
|
176
|
+
pageHeight=0;
|
177
|
+
X1=0;
|
178
|
+
X2=0;
|
179
|
+
Y1=0;
|
180
|
+
Y2=0;
|
181
|
+
fontsPageMarker = 0;
|
182
|
+
DocName=NULL;
|
183
|
+
firstPage = -1;
|
184
|
+
imgExt = new GString(imgExtVal);
|
185
|
+
}
|
186
|
+
|
187
|
+
HtmlPage::~HtmlPage() {
|
188
|
+
clear();
|
189
|
+
if (DocName) delete DocName;
|
190
|
+
if (fonts) delete fonts;
|
191
|
+
if (links) delete links;
|
192
|
+
if (imgExt) delete imgExt;
|
193
|
+
}
|
194
|
+
|
195
|
+
void HtmlPage::updateFont(GfxState *state) {
|
196
|
+
GfxFont *font;
|
197
|
+
double *fm;
|
198
|
+
char *name;
|
199
|
+
int code;
|
200
|
+
double w;
|
201
|
+
|
202
|
+
// adjust the font size
|
203
|
+
fontSize = state->getTransformedFontSize();
|
204
|
+
if ((font = state->getFont()) && font->getType() == fontType3) {
|
205
|
+
// This is a hack which makes it possible to deal with some Type 3
|
206
|
+
// fonts. The problem is that it's impossible to know what the
|
207
|
+
// base coordinate system used in the font is without actually
|
208
|
+
// rendering the font. This code tries to guess by looking at the
|
209
|
+
// width of the character 'm' (which breaks if the font is a
|
210
|
+
// subset that doesn't contain 'm').
|
211
|
+
for (code = 0; code < 256; ++code) {
|
212
|
+
if ((name = ((Gfx8BitFont *)font)->getCharName(code)) &&
|
213
|
+
name[0] == 'm' && name[1] == '\0') {
|
214
|
+
break;
|
215
|
+
}
|
216
|
+
}
|
217
|
+
if (code < 256) {
|
218
|
+
w = ((Gfx8BitFont *)font)->getWidth(code);
|
219
|
+
if (w != 0) {
|
220
|
+
// 600 is a generic average 'm' width -- yes, this is a hack
|
221
|
+
fontSize *= w / 0.6;
|
222
|
+
}
|
223
|
+
}
|
224
|
+
fm = font->getFontMatrix();
|
225
|
+
if (fm[0] != 0) {
|
226
|
+
fontSize *= fabs(fm[3] / fm[0]);
|
227
|
+
}
|
228
|
+
}
|
229
|
+
}
|
230
|
+
|
231
|
+
void HtmlPage::beginString(GfxState *state, GString *s) {
|
232
|
+
curStr = new HtmlString(state, fontSize,charspace, fonts);
|
233
|
+
}
|
234
|
+
|
235
|
+
|
236
|
+
void HtmlPage::conv(){
|
237
|
+
HtmlString *tmp;
|
238
|
+
|
239
|
+
int linkIndex = 0;
|
240
|
+
XmlFont* h;
|
241
|
+
|
242
|
+
for(tmp=yxStrings;tmp;tmp=tmp->yxNext){
|
243
|
+
int pos=tmp->fontpos;
|
244
|
+
// printf("%d\n",pos);
|
245
|
+
h=fonts->Get(pos);
|
246
|
+
|
247
|
+
if (tmp->htext) delete tmp->htext;
|
248
|
+
tmp->htext=XmlFont::simple(h,tmp->text,tmp->len);
|
249
|
+
tmp->htext2=XmlFont::simple(h,tmp->text,tmp->len);
|
250
|
+
|
251
|
+
if (links->inLink(tmp->xMin,tmp->yMin,tmp->xMax,tmp->yMax, linkIndex)){
|
252
|
+
tmp->link = links->getLink(linkIndex);
|
253
|
+
/*GString *t=tmp->htext;
|
254
|
+
tmp->htext=links->getLink(k)->Link(tmp->htext);
|
255
|
+
delete t;*/
|
256
|
+
}
|
257
|
+
}
|
258
|
+
|
259
|
+
}
|
260
|
+
|
261
|
+
|
262
|
+
void HtmlPage::addChar(GfxState *state, double x, double y,
|
263
|
+
double dx, double dy,
|
264
|
+
double ox, double oy, Unicode *u, int uLen) {
|
265
|
+
double x1, y1, w1, h1, dx2, dy2;
|
266
|
+
int n, i, d;
|
267
|
+
state->transform(x, y, &x1, &y1);
|
268
|
+
n = curStr->len;
|
269
|
+
d = 0;
|
270
|
+
|
271
|
+
// check that new character is in the same direction as current string
|
272
|
+
// and is not too far away from it before adding
|
273
|
+
/* if ((UnicodeMap::getDirection(u[0]) != curStr->dir) ||
|
274
|
+
(n > 0 &&
|
275
|
+
fabs(x1 - curStr->xRight[n-1]) > 0.1 * (curStr->yMax - curStr->yMin))) {
|
276
|
+
endString();
|
277
|
+
beginString(state, NULL);
|
278
|
+
}*/
|
279
|
+
state->textTransformDelta(state->getCharSpace() * state->getHorizScaling(),
|
280
|
+
0, &dx2, &dy2);
|
281
|
+
dx -= dx2;
|
282
|
+
dy -= dy2;
|
283
|
+
state->transformDelta(dx, dy, &w1, &h1);
|
284
|
+
if (uLen != 0) {
|
285
|
+
w1 /= uLen;
|
286
|
+
h1 /= uLen;
|
287
|
+
}
|
288
|
+
/* if (d != 3)
|
289
|
+
{
|
290
|
+
endString();
|
291
|
+
beginString(state, NULL);
|
292
|
+
}
|
293
|
+
*/
|
294
|
+
|
295
|
+
|
296
|
+
for (i = 0; i < uLen; ++i)
|
297
|
+
{
|
298
|
+
if (u[i] == ' ')
|
299
|
+
{
|
300
|
+
curStr->addChar(state, x1 + i*w1, y1 + i*h1, w1, h1, u[i]);
|
301
|
+
endString();
|
302
|
+
beginString(state, NULL);
|
303
|
+
}
|
304
|
+
else {
|
305
|
+
curStr->addChar(state, x1 + i*w1, y1 + i*h1, w1, h1, u[i]); /* xyString */
|
306
|
+
}
|
307
|
+
}
|
308
|
+
|
309
|
+
/*
|
310
|
+
for (i = 0; i < uLen; ++i) {
|
311
|
+
curStr->addChar(state, x1 + i*w1, y1 + i*h1, w1, h1, u[i]);
|
312
|
+
}
|
313
|
+
*/
|
314
|
+
}
|
315
|
+
|
316
|
+
void HtmlPage::endString() {
|
317
|
+
HtmlString *p1, *p2;
|
318
|
+
double h, y1, y2;
|
319
|
+
|
320
|
+
// throw away zero-length strings -- they don't have valid xMin/xMax
|
321
|
+
// values, and they're useless anyway
|
322
|
+
|
323
|
+
if (curStr->len == 0) {
|
324
|
+
delete curStr;
|
325
|
+
curStr = NULL;
|
326
|
+
return;
|
327
|
+
}
|
328
|
+
|
329
|
+
curStr->endString();
|
330
|
+
|
331
|
+
#if 0 //~tmp
|
332
|
+
if (curStr->yMax - curStr->yMin > 20) {
|
333
|
+
delete curStr;
|
334
|
+
curStr = NULL;
|
335
|
+
return;
|
336
|
+
}
|
337
|
+
#endif
|
338
|
+
|
339
|
+
// insert string in y-major list
|
340
|
+
h = curStr->yMax - curStr->yMin;
|
341
|
+
y1 = curStr->yMin + 0.5 * h;
|
342
|
+
y2 = curStr->yMin + 0.8 * h;
|
343
|
+
|
344
|
+
if (rawOrder) {
|
345
|
+
p1 = yxCur1;
|
346
|
+
p2 = NULL;
|
347
|
+
} else if ((!yxCur1 ||
|
348
|
+
(y1 >= yxCur1->yMin &&
|
349
|
+
(y2 >= yxCur1->yMax || curStr->xMax >= yxCur1->xMin))) &&
|
350
|
+
(!yxCur2 ||
|
351
|
+
(y1 < yxCur2->yMin ||
|
352
|
+
(y2 < yxCur2->yMax && curStr->xMax < yxCur2->xMin)))) { /* add space */
|
353
|
+
p1 = yxCur1;
|
354
|
+
p2 = yxCur2;
|
355
|
+
} else {
|
356
|
+
for (p1 = NULL, p2 = yxStrings; p2; p1 = p2, p2 = p2->yxNext) {
|
357
|
+
if (y1 < p2->yMin || (y2 < p2->yMax && curStr->xMax < p2->xMin))
|
358
|
+
break;
|
359
|
+
}
|
360
|
+
yxCur2 = p2;
|
361
|
+
}
|
362
|
+
|
363
|
+
yxCur1 = curStr;
|
364
|
+
|
365
|
+
if (p1)
|
366
|
+
p1->yxNext = curStr;
|
367
|
+
else
|
368
|
+
yxStrings = curStr;
|
369
|
+
|
370
|
+
curStr->yxNext = p2;
|
371
|
+
curStr = NULL;
|
372
|
+
}
|
373
|
+
|
374
|
+
void HtmlPage::coalesce() {
|
375
|
+
HtmlString *str1, *str2;
|
376
|
+
XmlFont *hfont1, *hfont2;
|
377
|
+
double space, horSpace, vertSpace, vertOverlap;
|
378
|
+
GBool addSpace, addLineBreak;
|
379
|
+
int n, i;
|
380
|
+
double curX, curY, lastX, lastY;
|
381
|
+
int sSize = 0;
|
382
|
+
double diff = 0.0;
|
383
|
+
double pxSize = 0.0;
|
384
|
+
double strSize = 0.0;
|
385
|
+
double cspace = 0.0;
|
386
|
+
|
387
|
+
#if 0 //~ for debugging
|
388
|
+
for (str1 = yxStrings; str1; str1 = str1->yxNext) {
|
389
|
+
printf("x=%f..%f y=%f..%f size=%2d '",
|
390
|
+
str1->xMin, str1->xMax, str1->yMin, str1->yMax,
|
391
|
+
(int)(str1->yMax - str1->yMin));
|
392
|
+
for (i = 0; i < str1->len; ++i) {
|
393
|
+
fputc(str1->text[i] & 0xff, stdout);
|
394
|
+
}
|
395
|
+
printf("'\n");
|
396
|
+
}
|
397
|
+
printf("\n------------------------------------------------------------\n\n");
|
398
|
+
#endif
|
399
|
+
|
400
|
+
|
401
|
+
str1 = yxStrings;
|
402
|
+
if( !str1 ) return;
|
403
|
+
|
404
|
+
hfont1 = getFont(str1);
|
405
|
+
|
406
|
+
str1->htext2->append(str1->htext);
|
407
|
+
if( str1->getLink() != NULL ) {
|
408
|
+
GString *ls = str1->getLink()->getLinkStart();
|
409
|
+
str1->htext->insert(0, ls);
|
410
|
+
delete ls;
|
411
|
+
}
|
412
|
+
|
413
|
+
curX = str1->xMin; curY = str1->yMin;
|
414
|
+
lastX = str1->xMin; lastY = str1->yMin;
|
415
|
+
|
416
|
+
while (str1 && (str2 = str1->yxNext)) {
|
417
|
+
hfont2 = getFont(str2);
|
418
|
+
space = str1->yMax - str1->yMin;
|
419
|
+
horSpace = str2->xMin - str1->xMax;
|
420
|
+
addLineBreak = !noMerge && (fabs(str1->xMin - str2->xMin) < 0.4);
|
421
|
+
vertSpace = str2->yMin - str1->yMax;
|
422
|
+
|
423
|
+
//printf("coalesce %d %d %f? ", str1->dir, str2->dir, d);
|
424
|
+
|
425
|
+
if (str2->yMin >= str1->yMin && str2->yMin <= str1->yMax)
|
426
|
+
{
|
427
|
+
vertOverlap = str1->yMax - str2->yMin;
|
428
|
+
} else
|
429
|
+
if (str2->yMax >= str1->yMin && str2->yMax <= str1->yMax)
|
430
|
+
{
|
431
|
+
vertOverlap = str2->yMax - str1->yMin;
|
432
|
+
} else
|
433
|
+
{
|
434
|
+
vertOverlap = 0;
|
435
|
+
}
|
436
|
+
|
437
|
+
// str1->dir == str2->dir, in complex mode fonts must be the same, in other modes fonts do not metter
|
438
|
+
if ((((
|
439
|
+
(rawOrder && vertOverlap > 0.5 * space)
|
440
|
+
||
|
441
|
+
(!rawOrder && str2->yMin < str1->yMax)
|
442
|
+
) &&
|
443
|
+
(horSpace > -0.5 * space && horSpace < space)
|
444
|
+
) ||
|
445
|
+
(vertSpace >= 0 && vertSpace < 0.5 * space && addLineBreak)
|
446
|
+
)
|
447
|
+
&&
|
448
|
+
str1->dir == str2->dir // text direction the same
|
449
|
+
&&
|
450
|
+
!(str2->len == 1 && str2->htext->getCString()[0] == ' ')
|
451
|
+
&&
|
452
|
+
!(str1->htext->getCString()[str1->len-1] == ' ')
|
453
|
+
)
|
454
|
+
{
|
455
|
+
diff = str2->xMax - str1->xMin;
|
456
|
+
|
457
|
+
n = str1->len + str2->len;
|
458
|
+
|
459
|
+
str1->size = (n + 15) & ~15;
|
460
|
+
str1->text = (Unicode *)grealloc(str1->text,
|
461
|
+
str1->size * sizeof(Unicode));
|
462
|
+
str1->xRight = (double *)grealloc(str1->xRight,
|
463
|
+
str1->size * sizeof(double));
|
464
|
+
|
465
|
+
str1->htext2->append(str2->htext2);
|
466
|
+
|
467
|
+
XmlLink *hlink1 = str1->getLink();
|
468
|
+
XmlLink *hlink2 = str2->getLink();
|
469
|
+
|
470
|
+
for (i = 0; i < str2->len; ++i) {
|
471
|
+
str1->text[str1->len] = str2->text[i];
|
472
|
+
str1->xRight[str1->len] = str2->xRight[i];
|
473
|
+
++str1->len;
|
474
|
+
}
|
475
|
+
|
476
|
+
if( !hlink1 || !hlink2 || !hlink1->isEqualDest(*hlink2) ) {
|
477
|
+
|
478
|
+
if(hlink1 != NULL ){
|
479
|
+
//str1->htext->append("\"]");
|
480
|
+
}
|
481
|
+
if(hlink2 != NULL ) {
|
482
|
+
GString *ls = hlink2->getLinkStart();
|
483
|
+
str1->htext->append(ls);
|
484
|
+
delete ls;
|
485
|
+
}
|
486
|
+
}
|
487
|
+
|
488
|
+
str1->htext->append(str2->htext);
|
489
|
+
sSize = str1->htext2->getLength();
|
490
|
+
pxSize = xoutRoundLower(hfont1->getSize()/scale);
|
491
|
+
strSize = (pxSize*(sSize-2));
|
492
|
+
cspace = (diff / strSize);//(strSize-pxSize));
|
493
|
+
// we check if the fonts are the same and create a new font to ajust the text
|
494
|
+
// double diff = str2->xMin - str1->xMin;
|
495
|
+
// printf("%s\n",str1->htext2->getCString());
|
496
|
+
// str1 now contains href for link of str2 (if it is defined)
|
497
|
+
str1->link = str2->link;
|
498
|
+
|
499
|
+
//XmlFont *newfnt = new XmlFont(*hfont1);
|
500
|
+
//newfnt->setCharSpace(cspace);
|
501
|
+
//newfnt->setLineSize(curLineSize);
|
502
|
+
//str1->fontpos = fonts->AddFont(*newfnt);
|
503
|
+
//delete newfnt;
|
504
|
+
hfont1 = getFont(str1);
|
505
|
+
// we have to reget hfont2 because it's location could have
|
506
|
+
// changed on resize GStri;ng *iStr=GString::fromInt(i);
|
507
|
+
hfont2 = getFont(str2);
|
508
|
+
|
509
|
+
hfont1 = hfont2;
|
510
|
+
|
511
|
+
if (str2->xMax > str1->xMax) {
|
512
|
+
str1->xMax = str2->xMax;
|
513
|
+
}
|
514
|
+
|
515
|
+
if (str2->yMax > str1->yMax) {
|
516
|
+
str1->yMax = str2->yMax;
|
517
|
+
}
|
518
|
+
|
519
|
+
str1->yxNext = str2->yxNext;
|
520
|
+
|
521
|
+
delete str2;
|
522
|
+
} else {
|
523
|
+
|
524
|
+
// printf("startX = %f, endX = %f, diff = %f, fontsize = %d, pxSize = %f, stringSize = %d, cspace = %f, strSize = %f\n",str1->xMin,str1->xMax,diff,hfont1->getSize(),pxSize,sSize,cspace,strSize);
|
525
|
+
|
526
|
+
// keep strings separate
|
527
|
+
// printf("no\n");
|
528
|
+
// if( hfont1->isBold() )
|
529
|
+
// if(str1->getLink() != NULL )
|
530
|
+
// str1->htext->append("\"]");
|
531
|
+
|
532
|
+
str1->xMin = curX; str1->yMin = curY;
|
533
|
+
str1 = str2;
|
534
|
+
curX = str1->xMin; curY = str1->yMin;
|
535
|
+
hfont1 = hfont2;
|
536
|
+
|
537
|
+
if( str1->getLink() != NULL ) {
|
538
|
+
GString *ls = str1->getLink()->getLinkStart();
|
539
|
+
str1->htext->insert(0, ls);
|
540
|
+
delete ls;
|
541
|
+
}
|
542
|
+
}
|
543
|
+
}
|
544
|
+
str1->xMin = curX; str1->yMin = curY;
|
545
|
+
|
546
|
+
// if(str1->getLink() != NULL )
|
547
|
+
// str1->htext->append("]");
|
548
|
+
|
549
|
+
#if 0 //~ for debugging
|
550
|
+
for (str1 = yxStrings; str1; str1 = str1->yxNext) {
|
551
|
+
printf("x=%3d..%3d y=%3d..%3d size=%2d ",
|
552
|
+
(int)str1->xMin, (int)str1->xMax, (int)str1->yMin, (int)str1->yMax,
|
553
|
+
(int)(str1->yMax - str1->yMin));
|
554
|
+
printf("'%s'\n", str1->htext->getCString());
|
555
|
+
}
|
556
|
+
printf("\n-end--------------------------------------------------------\n\n");
|
557
|
+
#endif
|
558
|
+
|
559
|
+
}
|
560
|
+
|
561
|
+
|
562
|
+
void HtmlPage::dumpAsXML(FILE* f,int page, GBool passedFirstPage){
|
563
|
+
if(textAsJSON){
|
564
|
+
if(passedFirstPage){
|
565
|
+
fprintf(f, ",");
|
566
|
+
}
|
567
|
+
fprintf(f, "{\"number\":%d,\"height\":%d,\"width\":%d,", page,pageHeight,pageWidth);
|
568
|
+
}else{
|
569
|
+
fprintf(f, "<page number=\"%d\"", page);
|
570
|
+
fprintf(f," height=\"%d\" width=\"%d\">", pageHeight,pageWidth);
|
571
|
+
}
|
572
|
+
|
573
|
+
GBool passedFirst = false;
|
574
|
+
|
575
|
+
/* if(textAsJSON){fprintf(f,"\"fonts\":[");}
|
576
|
+
for(int i=fontsPageMarker;i < fonts->size();i++) {
|
577
|
+
GString *fontCSStyle = fonts->CSStyle(i,textAsJSON);
|
578
|
+
if(textAsJSON && passedFirst) {fprintf(f,",");}
|
579
|
+
fprintf(f,"%s",fontCSStyle->getCString());
|
580
|
+
passedFirst = true;
|
581
|
+
delete fontCSStyle;
|
582
|
+
}
|
583
|
+
if(textAsJSON){fprintf(f,"]");}
|
584
|
+
*/
|
585
|
+
GString *str, *str1;
|
586
|
+
|
587
|
+
passedFirst = false;
|
588
|
+
if(textAsJSON){
|
589
|
+
//fprintf(f,",\"text\":[");
|
590
|
+
fprintf(f,"\"text\":[");
|
591
|
+
}
|
592
|
+
|
593
|
+
for(HtmlString *tmp=yxStrings;tmp;tmp=tmp->yxNext){
|
594
|
+
if (tmp->htext){
|
595
|
+
str=new GString(tmp->htext);
|
596
|
+
|
597
|
+
if(!compressData){
|
598
|
+
if(textAsJSON){
|
599
|
+
if(passedFirst){
|
600
|
+
fprintf(f,",");
|
601
|
+
}
|
602
|
+
fprintf(f,"{\"top\":%d,\"left\":%d,",xoutRound(tmp->yMin),xoutRound(tmp->xMin));
|
603
|
+
fprintf(f,"\"width\":%d,\"height\":%d,",xoutRound(tmp->xMax-tmp->xMin),xoutRound(tmp->yMax-tmp->yMin));
|
604
|
+
fprintf(f,"\"font\":%d,\"data\":\"", tmp->fontpos);
|
605
|
+
if (tmp->fontpos!=-1){
|
606
|
+
str1=fonts->getCSStyle(tmp->fontpos, str);
|
607
|
+
}
|
608
|
+
fputs(str1->getCString(),f);
|
609
|
+
fprintf(f,"\"}");
|
610
|
+
//fprintf(f,"\"}");
|
611
|
+
passedFirst = true;
|
612
|
+
}else{
|
613
|
+
fprintf(f,"<text top=\"%d\" left=\"%d\" ",xoutRound(tmp->yMin),xoutRound(tmp->xMin));
|
614
|
+
fprintf(f,"width=\"%d\" height=\"%d\" ",xoutRound(tmp->xMax-tmp->xMin),xoutRound(tmp->yMax-tmp->yMin));
|
615
|
+
fprintf(f,"font=\"%d\">", tmp->fontpos);
|
616
|
+
if (tmp->fontpos!=-1){
|
617
|
+
str1=fonts->getCSStyle(tmp->fontpos, str);
|
618
|
+
}
|
619
|
+
fputs(str1->getCString(),f);
|
620
|
+
delete str;
|
621
|
+
delete str1;
|
622
|
+
fputs("</text>\n",f);
|
623
|
+
}
|
624
|
+
}else{
|
625
|
+
if(textAsJSON){
|
626
|
+
if(passedFirst){
|
627
|
+
fprintf(f,",");
|
628
|
+
}
|
629
|
+
|
630
|
+
//fprintf(f,"{\"t\":%d,\"l\":%d,",xoutRound(tmp->yMin),xoutRound(tmp->xMin));
|
631
|
+
//fprintf(f,"\"w\":%d,\"h\":%d,",xoutRound(tmp->xMax-tmp->xMin),xoutRound(tmp->yMax-tmp->yMin));
|
632
|
+
//fprintf(f,"\"f\":%d,\"d\":\"", tmp->fontpos);
|
633
|
+
fprintf(f,"[%d,%d,",xoutRound(tmp->yMin),xoutRound(tmp->xMin));
|
634
|
+
fprintf(f,"%d,%d,",xoutRound(tmp->xMax-tmp->xMin),xoutRound(tmp->yMax-tmp->yMin));
|
635
|
+
fprintf(f,"%d,\"", tmp->fontpos);
|
636
|
+
|
637
|
+
if (tmp->fontpos!=-1){
|
638
|
+
str1=fonts->getCSStyle(tmp->fontpos, str);
|
639
|
+
}
|
640
|
+
fputs(str1->getCString(),f);
|
641
|
+
fprintf(f,"\"]");
|
642
|
+
|
643
|
+
passedFirst = true;
|
644
|
+
}else{
|
645
|
+
fprintf(f,"<t t=\"%d\" l=\"%d\" ",xoutRound(tmp->yMin),xoutRound(tmp->xMin));
|
646
|
+
fprintf(f,"w=\"%d\" h=\"%d\" ",xoutRound(tmp->xMax-tmp->xMin),xoutRound(tmp->yMax-tmp->yMin));
|
647
|
+
fprintf(f,"f=\"%d\">", tmp->fontpos);
|
648
|
+
if (tmp->fontpos!=-1){
|
649
|
+
str1=fonts->getCSStyle(tmp->fontpos, str);
|
650
|
+
}
|
651
|
+
fputs(str1->getCString(),f);
|
652
|
+
delete str;
|
653
|
+
delete str1;
|
654
|
+
fputs("</t>\n",f);
|
655
|
+
}
|
656
|
+
}
|
657
|
+
}
|
658
|
+
}
|
659
|
+
|
660
|
+
if(textAsJSON){
|
661
|
+
fputs("]}",f);
|
662
|
+
}else{
|
663
|
+
fputs("</page>",f);
|
664
|
+
}
|
665
|
+
}
|
666
|
+
|
667
|
+
void HtmlPage::dump(FILE *f, int pageNum, GBool passedFirstPage)
|
668
|
+
{
|
669
|
+
if (complexMode)
|
670
|
+
{
|
671
|
+
if (xml) dumpAsXML(f, pageNum, passedFirstPage);
|
672
|
+
}
|
673
|
+
}
|
674
|
+
|
675
|
+
void HtmlPage::clear() {
|
676
|
+
HtmlString *p1, *p2;
|
677
|
+
|
678
|
+
if (curStr) {
|
679
|
+
delete curStr;
|
680
|
+
curStr = NULL;
|
681
|
+
}
|
682
|
+
for (p1 = yxStrings; p1; p1 = p2) {
|
683
|
+
p2 = p1->yxNext;
|
684
|
+
delete p1;
|
685
|
+
}
|
686
|
+
yxStrings = NULL;
|
687
|
+
xyStrings = NULL;
|
688
|
+
yxCur1 = yxCur2 = NULL;
|
689
|
+
|
690
|
+
if( !noframes )
|
691
|
+
{
|
692
|
+
delete fonts;
|
693
|
+
fonts=new XmlFontAccu();
|
694
|
+
fontsPageMarker = 0;
|
695
|
+
}
|
696
|
+
else
|
697
|
+
{
|
698
|
+
fontsPageMarker = fonts->size();
|
699
|
+
}
|
700
|
+
|
701
|
+
delete links;
|
702
|
+
links=new XmlLinks();
|
703
|
+
|
704
|
+
|
705
|
+
}
|
706
|
+
|
707
|
+
void HtmlPage::setDocName(char *fname){
|
708
|
+
DocName=new GString(fname);
|
709
|
+
}
|
710
|
+
|
711
|
+
void HtmlPage::updateCharSpace(GfxState *state)
|
712
|
+
{
|
713
|
+
charspace = state->getCharSpace();
|
714
|
+
}
|
715
|
+
|
716
|
+
//------------------------------------------------------------------------
|
717
|
+
// HtmlMetaVar
|
718
|
+
//------------------------------------------------------------------------
|
719
|
+
|
720
|
+
HtmlMetaVar::HtmlMetaVar(char *_name, char *_content)
|
721
|
+
{
|
722
|
+
name = new GString(_name);
|
723
|
+
content = new GString(_content);
|
724
|
+
}
|
725
|
+
|
726
|
+
HtmlMetaVar::~HtmlMetaVar()
|
727
|
+
{
|
728
|
+
delete name;
|
729
|
+
delete content;
|
730
|
+
}
|
731
|
+
|
732
|
+
GString* HtmlMetaVar::toString()
|
733
|
+
{
|
734
|
+
GString *result = new GString("<META name=\"");
|
735
|
+
result->append(name);
|
736
|
+
result->append("\" content=\"");
|
737
|
+
result->append(content);
|
738
|
+
result->append("\">");
|
739
|
+
return result;
|
740
|
+
}
|
741
|
+
|
742
|
+
//------------------------------------------------------------------------
|
743
|
+
// ImgOutputDev
|
744
|
+
//------------------------------------------------------------------------
|
745
|
+
|
746
|
+
static char* HtmlEncodings[][2] = {
|
747
|
+
{"Latin1", "ISO-8859-1"},
|
748
|
+
{NULL, NULL}
|
749
|
+
};
|
750
|
+
|
751
|
+
|
752
|
+
char* ImgOutputDev::mapEncodingToHtml(GString* encoding)
|
753
|
+
{
|
754
|
+
char* enc = encoding->getCString();
|
755
|
+
for(int i = 0; HtmlEncodings[i][0] != NULL; i++)
|
756
|
+
{
|
757
|
+
if( strcmp(enc, HtmlEncodings[i][0]) == 0 )
|
758
|
+
{
|
759
|
+
return HtmlEncodings[i][1];
|
760
|
+
}
|
761
|
+
}
|
762
|
+
return enc;
|
763
|
+
}
|
764
|
+
|
765
|
+
ImgOutputDev::ImgOutputDev(char *fileName, char *title,
|
766
|
+
char *author, char *keywords, char *subject, char *date,
|
767
|
+
char *extension,
|
768
|
+
GBool rawOrder, GBool textAsJSON, GBool compressData, int firstPage, GBool outline, int numPages)
|
769
|
+
{
|
770
|
+
char *htmlEncoding;
|
771
|
+
this->numPages = numPages;
|
772
|
+
fContentsFrame = NULL;
|
773
|
+
docTitle = new GString(title);
|
774
|
+
pages = NULL;
|
775
|
+
dumpJPEG=gTrue;
|
776
|
+
//write = gTrue;
|
777
|
+
this->rawOrder = rawOrder;
|
778
|
+
this->textAsJSON = textAsJSON;
|
779
|
+
this->compressData = compressData;
|
780
|
+
this->doOutline = outline;
|
781
|
+
ok = gFalse;
|
782
|
+
passedFirstPage = gFalse;
|
783
|
+
imgNum=1;
|
784
|
+
//this->firstPage = firstPage;
|
785
|
+
//pageNum=firstPage;
|
786
|
+
// open file
|
787
|
+
needClose = gFalse;
|
788
|
+
pages = new HtmlPage(rawOrder, textAsJSON, compressData, extension);
|
789
|
+
|
790
|
+
glMetaVars = new GList();
|
791
|
+
glMetaVars->append(new HtmlMetaVar("generator", "pdf2json 0.52"));
|
792
|
+
if( author ) glMetaVars->append(new HtmlMetaVar("author", author));
|
793
|
+
if( keywords ) glMetaVars->append(new HtmlMetaVar("keywords", keywords));
|
794
|
+
if( date ) glMetaVars->append(new HtmlMetaVar("date", date));
|
795
|
+
if( subject ) glMetaVars->append(new HtmlMetaVar("subject", subject));
|
796
|
+
|
797
|
+
maxPageWidth = 0;
|
798
|
+
maxPageHeight = 0;
|
799
|
+
|
800
|
+
pages->setDocName(fileName);
|
801
|
+
Docname=new GString (fileName);
|
802
|
+
|
803
|
+
if (noframes) {
|
804
|
+
if (stout) page=stdout;
|
805
|
+
else {
|
806
|
+
GString* right=new GString(fileName);
|
807
|
+
//if (xml && !textAsJSON) right->append(".xml");
|
808
|
+
//else if (textAsJSON) right->append(".js");
|
809
|
+
if (!(page=fopen(right->getCString(),"w"))){
|
810
|
+
delete right;
|
811
|
+
error(-1, "Couldn't open html file '%s'", right->getCString());
|
812
|
+
return;
|
813
|
+
}
|
814
|
+
delete right;
|
815
|
+
}
|
816
|
+
|
817
|
+
htmlEncoding = mapEncodingToHtml(globalParams->getTextEncodingName());
|
818
|
+
if (xml && !textAsJSON)
|
819
|
+
{
|
820
|
+
fprintf(page, "<?xml version=\"1.0\" encoding=\"%s\"?>\n", htmlEncoding);
|
821
|
+
fputs("<!DOCTYPE pdf2xml SYSTEM \"pdf2xml.dtd\">\n\n", page);
|
822
|
+
fputs("<pdf2xml>\n",page);
|
823
|
+
}else if(textAsJSON){
|
824
|
+
fputs("[",page);
|
825
|
+
}
|
826
|
+
}
|
827
|
+
ok = gTrue;
|
828
|
+
}
|
829
|
+
|
830
|
+
ImgOutputDev::~ImgOutputDev() {
|
831
|
+
XmlFont::clear();
|
832
|
+
|
833
|
+
delete Docname;
|
834
|
+
delete docTitle;
|
835
|
+
|
836
|
+
deleteGList(glMetaVars, HtmlMetaVar);
|
837
|
+
|
838
|
+
if (xml && !textAsJSON) {
|
839
|
+
fputs("</pdf2xml>\n",page);
|
840
|
+
fclose(page);
|
841
|
+
} else if(textAsJSON){
|
842
|
+
fputs("]",page);
|
843
|
+
fclose(page);
|
844
|
+
}
|
845
|
+
if (pages)
|
846
|
+
delete pages;
|
847
|
+
}
|
848
|
+
|
849
|
+
|
850
|
+
|
851
|
+
void ImgOutputDev::startPage(int pageNum, GfxState *state,double crop_x1, double crop_y1, double crop_x2, double crop_y2) {
|
852
|
+
double x1,y1,x2,y2;
|
853
|
+
state->transform(crop_x1,crop_y1,&x1,&y1);
|
854
|
+
state->transform(crop_x2,crop_y2,&x2,&y2);
|
855
|
+
if(x2<x1) {double x3=x1;x1=x2;x2=x3;}
|
856
|
+
if(y2<y1) {double y3=y1;y1=y2;y2=y3;}
|
857
|
+
|
858
|
+
|
859
|
+
this->pageNum = pageNum;
|
860
|
+
GString *str=basename(Docname);
|
861
|
+
pages->clear();
|
862
|
+
if(!noframes)
|
863
|
+
{
|
864
|
+
if (fContentsFrame)
|
865
|
+
{
|
866
|
+
if (complexMode)
|
867
|
+
fprintf(fContentsFrame,"<A href=\"%s-%d.html\"",str->getCString(),pageNum);
|
868
|
+
else
|
869
|
+
fprintf(fContentsFrame,"<A href=\"%ss.html#%d\"",str->getCString(),pageNum);
|
870
|
+
fprintf(fContentsFrame," target=\"contents\" >Page %d</a><br>\n",pageNum);
|
871
|
+
}
|
872
|
+
}
|
873
|
+
|
874
|
+
// pages->pageWidth=static_cast<int>(state->getPageWidth());
|
875
|
+
//pages->pageHeight=static_cast<int>(state->getPageHeight());
|
876
|
+
pages->pageWidth = (int)(x2-x1);
|
877
|
+
pages->pageHeight = (int)(y2-y1);
|
878
|
+
|
879
|
+
|
880
|
+
delete str;
|
881
|
+
}
|
882
|
+
|
883
|
+
|
884
|
+
void ImgOutputDev::endPage() {
|
885
|
+
pages->conv();
|
886
|
+
pages->coalesce();
|
887
|
+
pages->dump(page, pageNum, passedFirstPage);
|
888
|
+
passedFirstPage = gTrue;
|
889
|
+
// I don't yet know what to do in the case when there are pages of different
|
890
|
+
// sizes and we want complex output: running ghostscript many times
|
891
|
+
// seems very inefficient. So for now I'll just use last page's size
|
892
|
+
maxPageWidth = pages->pageWidth;
|
893
|
+
maxPageHeight = pages->pageHeight;
|
894
|
+
|
895
|
+
if(!stout && !globalParams->getErrQuiet()) printf("Page-%d\n",(pageNum));
|
896
|
+
}
|
897
|
+
|
898
|
+
void ImgOutputDev::updateFont(GfxState *state) {
|
899
|
+
pages->updateFont(state);
|
900
|
+
}
|
901
|
+
|
902
|
+
void ImgOutputDev::beginString(GfxState *state, GString *s) {
|
903
|
+
pages->beginString(state, s);
|
904
|
+
}
|
905
|
+
|
906
|
+
void ImgOutputDev::endString(GfxState *state) {
|
907
|
+
pages->endString();
|
908
|
+
}
|
909
|
+
|
910
|
+
void ImgOutputDev::drawChar(GfxState *state, double x, double y,
|
911
|
+
double dx, double dy,
|
912
|
+
double originX, double originY,
|
913
|
+
CharCode code, int nBytes, Unicode *u, int uLen)
|
914
|
+
{
|
915
|
+
if ( !showHidden && (state->getRender() & 3) == 3) {
|
916
|
+
return;
|
917
|
+
}
|
918
|
+
pages->addChar(state, x, y, dx, dy, originX, originY, u, uLen);
|
919
|
+
}
|
920
|
+
|
921
|
+
void ImgOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str,
|
922
|
+
int width, int height, GBool invert,
|
923
|
+
GBool inlineImg) {
|
924
|
+
|
925
|
+
int i, j;
|
926
|
+
|
927
|
+
if (ignore||complexMode) {
|
928
|
+
OutputDev::drawImageMask(state, ref, str, width, height, invert, inlineImg);
|
929
|
+
return;
|
930
|
+
}
|
931
|
+
|
932
|
+
FILE *f1;
|
933
|
+
int c;
|
934
|
+
|
935
|
+
int x0, y0; // top left corner of image
|
936
|
+
int w0, h0, w1, h1; // size of image
|
937
|
+
double xt, yt, wt, ht;
|
938
|
+
GBool rotate, xFlip, yFlip;
|
939
|
+
GBool dither;
|
940
|
+
int x, y;
|
941
|
+
int ix, iy;
|
942
|
+
int px1, px2, qx, dx;
|
943
|
+
int py1, py2, qy, dy;
|
944
|
+
Gulong pixel;
|
945
|
+
int nComps, nVals, nBits;
|
946
|
+
double r1, g1, b1;
|
947
|
+
|
948
|
+
// get image position and size
|
949
|
+
state->transform(0, 0, &xt, &yt);
|
950
|
+
state->transformDelta(1, 1, &wt, &ht);
|
951
|
+
if (wt > 0) {
|
952
|
+
x0 = xoutRound(xt);
|
953
|
+
w0 = xoutRound(wt);
|
954
|
+
} else {
|
955
|
+
x0 = xoutRound(xt + wt);
|
956
|
+
w0 = xoutRound(-wt);
|
957
|
+
}
|
958
|
+
if (ht > 0) {
|
959
|
+
y0 = xoutRound(yt);
|
960
|
+
h0 = xoutRound(ht);
|
961
|
+
} else {
|
962
|
+
y0 = xoutRound(yt + ht);
|
963
|
+
h0 = xoutRound(-ht);
|
964
|
+
}
|
965
|
+
state->transformDelta(1, 0, &xt, &yt);
|
966
|
+
rotate = fabs(xt) < fabs(yt);
|
967
|
+
if (rotate) {
|
968
|
+
w1 = h0;
|
969
|
+
h1 = w0;
|
970
|
+
xFlip = ht < 0;
|
971
|
+
yFlip = wt > 0;
|
972
|
+
} else {
|
973
|
+
w1 = w0;
|
974
|
+
h1 = h0;
|
975
|
+
xFlip = wt < 0;
|
976
|
+
yFlip = ht > 0;
|
977
|
+
}
|
978
|
+
|
979
|
+
// dump JPEG file
|
980
|
+
if (dumpJPEG && str->getKind() == strDCT) {
|
981
|
+
GString *fName=new GString(Docname);
|
982
|
+
fName->append("-");
|
983
|
+
GString *pgNum=GString::fromInt(pageNum);
|
984
|
+
GString *imgnum=GString::fromInt(imgNum);
|
985
|
+
// open the image file
|
986
|
+
fName->append(pgNum)->append("_")->append(imgnum)->append(".jpg");
|
987
|
+
++imgNum;
|
988
|
+
if (!(f1 = fopen(fName->getCString(), "wb"))) {
|
989
|
+
error(-1, "Couldn't open image file '%s'", fName->getCString());
|
990
|
+
return;
|
991
|
+
}
|
992
|
+
|
993
|
+
// initialize stream
|
994
|
+
str = ((DCTStream *)str)->getRawStream();
|
995
|
+
str->reset();
|
996
|
+
|
997
|
+
// copy the stream
|
998
|
+
while ((c = str->getChar()) != EOF)
|
999
|
+
fputc(c, f1);
|
1000
|
+
|
1001
|
+
fclose(f1);
|
1002
|
+
|
1003
|
+
if (pgNum) delete pgNum;
|
1004
|
+
if (imgnum) delete imgnum;
|
1005
|
+
if (fName) delete fName;
|
1006
|
+
}
|
1007
|
+
else {
|
1008
|
+
OutputDev::drawImageMask(state, ref, str, width, height, invert, inlineImg);
|
1009
|
+
}
|
1010
|
+
}
|
1011
|
+
|
1012
|
+
void ImgOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
|
1013
|
+
int width, int height, GfxImageColorMap *colorMap,
|
1014
|
+
int *maskColors, GBool inlineImg) {
|
1015
|
+
|
1016
|
+
int i, j;
|
1017
|
+
|
1018
|
+
if (ignore||complexMode) {
|
1019
|
+
OutputDev::drawImage(state, ref, str, width, height, colorMap,
|
1020
|
+
maskColors, inlineImg);
|
1021
|
+
return;
|
1022
|
+
}
|
1023
|
+
|
1024
|
+
FILE *f1;
|
1025
|
+
ImageStream *imgStr;
|
1026
|
+
Guchar pixBuf[4];
|
1027
|
+
GfxColor color;
|
1028
|
+
int c;
|
1029
|
+
|
1030
|
+
int x0, y0; // top left corner of image
|
1031
|
+
int w0, h0, w1, h1; // size of image
|
1032
|
+
double xt, yt, wt, ht;
|
1033
|
+
GBool rotate, xFlip, yFlip;
|
1034
|
+
GBool dither;
|
1035
|
+
int x, y;
|
1036
|
+
int ix, iy;
|
1037
|
+
int px1, px2, qx, dx;
|
1038
|
+
int py1, py2, qy, dy;
|
1039
|
+
Gulong pixel;
|
1040
|
+
int nComps, nVals, nBits;
|
1041
|
+
double r1, g1, b1;
|
1042
|
+
|
1043
|
+
// get image position and size
|
1044
|
+
state->transform(0, 0, &xt, &yt);
|
1045
|
+
state->transformDelta(1, 1, &wt, &ht);
|
1046
|
+
if (wt > 0) {
|
1047
|
+
x0 = xoutRound(xt);
|
1048
|
+
w0 = xoutRound(wt);
|
1049
|
+
} else {
|
1050
|
+
x0 = xoutRound(xt + wt);
|
1051
|
+
w0 = xoutRound(-wt);
|
1052
|
+
}
|
1053
|
+
if (ht > 0) {
|
1054
|
+
y0 = xoutRound(yt);
|
1055
|
+
h0 = xoutRound(ht);
|
1056
|
+
} else {
|
1057
|
+
y0 = xoutRound(yt + ht);
|
1058
|
+
h0 = xoutRound(-ht);
|
1059
|
+
}
|
1060
|
+
state->transformDelta(1, 0, &xt, &yt);
|
1061
|
+
rotate = fabs(xt) < fabs(yt);
|
1062
|
+
if (rotate) {
|
1063
|
+
w1 = h0;
|
1064
|
+
h1 = w0;
|
1065
|
+
xFlip = ht < 0;
|
1066
|
+
yFlip = wt > 0;
|
1067
|
+
} else {
|
1068
|
+
w1 = w0;
|
1069
|
+
h1 = h0;
|
1070
|
+
xFlip = wt < 0;
|
1071
|
+
yFlip = ht > 0;
|
1072
|
+
}
|
1073
|
+
|
1074
|
+
/*if( !globalParams->getErrQuiet() )
|
1075
|
+
printf("image stream of kind %d\n", str->getKind());*/
|
1076
|
+
// dump JPEG file
|
1077
|
+
if (dumpJPEG && str->getKind() == strDCT) {
|
1078
|
+
GString *fName=new GString(Docname);
|
1079
|
+
fName->append("-");
|
1080
|
+
GString *pgNum= GString::fromInt(pageNum);
|
1081
|
+
GString *imgnum= GString::fromInt(imgNum);
|
1082
|
+
|
1083
|
+
// open the image file
|
1084
|
+
fName->append(pgNum)->append("_")->append(imgnum)->append(".jpg");
|
1085
|
+
++imgNum;
|
1086
|
+
|
1087
|
+
if (!(f1 = fopen(fName->getCString(), "wb"))) {
|
1088
|
+
error(-1, "Couldn't open image file '%s'", fName->getCString());
|
1089
|
+
return;
|
1090
|
+
}
|
1091
|
+
|
1092
|
+
// initialize stream
|
1093
|
+
str = ((DCTStream *)str)->getRawStream();
|
1094
|
+
str->reset();
|
1095
|
+
|
1096
|
+
// copy the stream
|
1097
|
+
while ((c = str->getChar()) != EOF)
|
1098
|
+
fputc(c, f1);
|
1099
|
+
|
1100
|
+
fclose(f1);
|
1101
|
+
|
1102
|
+
delete fName;
|
1103
|
+
delete pgNum;
|
1104
|
+
delete imgnum;
|
1105
|
+
}
|
1106
|
+
else {
|
1107
|
+
OutputDev::drawImage(state, ref, str, width, height, colorMap,
|
1108
|
+
maskColors, inlineImg);
|
1109
|
+
}
|
1110
|
+
}
|
1111
|
+
|
1112
|
+
void ImgOutputDev::drawLink(Link* link,Catalog *cat){
|
1113
|
+
double _x1,_y1,_x2,_y2,w;
|
1114
|
+
int x1,y1,x2,y2;
|
1115
|
+
|
1116
|
+
link->getBorder(&_x1,&_y1,&_x2,&_y2,&w);
|
1117
|
+
cvtUserToDev(_x1,_y1,&x1,&y1);
|
1118
|
+
|
1119
|
+
cvtUserToDev(_x2,_y2,&x2,&y2);
|
1120
|
+
|
1121
|
+
|
1122
|
+
GString* _dest=getLinkDest(link,cat);
|
1123
|
+
XmlLink t((double) x1,(double) y2,(double) x2,(double) y1,_dest);
|
1124
|
+
pages->AddLink(t);
|
1125
|
+
delete _dest;
|
1126
|
+
}
|
1127
|
+
|
1128
|
+
GString* ImgOutputDev::getLinkDest(Link *link,Catalog* catalog){
|
1129
|
+
char *p;
|
1130
|
+
switch(link->getAction()->getKind())
|
1131
|
+
{
|
1132
|
+
case actionGoTo:
|
1133
|
+
{
|
1134
|
+
GString* file=new GString("actionGoTo:");
|
1135
|
+
int page=1;
|
1136
|
+
LinkGoTo *ha=(LinkGoTo *)link->getAction();
|
1137
|
+
LinkDest *dest=NULL;
|
1138
|
+
if (ha->getDest()==NULL)
|
1139
|
+
dest=catalog->findDest(ha->getNamedDest());
|
1140
|
+
else
|
1141
|
+
dest=ha->getDest()->copy();
|
1142
|
+
if (dest){
|
1143
|
+
if (dest->isPageRef()){
|
1144
|
+
Ref pageref=dest->getPageRef();
|
1145
|
+
page=catalog->findPage(pageref.num,pageref.gen);
|
1146
|
+
}
|
1147
|
+
else {
|
1148
|
+
page=dest->getPageNum();
|
1149
|
+
}
|
1150
|
+
|
1151
|
+
delete dest;
|
1152
|
+
|
1153
|
+
GString *str=GString::fromInt(page);
|
1154
|
+
file->append(str);
|
1155
|
+
file->append(",");
|
1156
|
+
|
1157
|
+
if (printCommands) printf(" link to page %d ",page);
|
1158
|
+
delete str;
|
1159
|
+
return file;
|
1160
|
+
}
|
1161
|
+
else
|
1162
|
+
{
|
1163
|
+
return new GString();
|
1164
|
+
}
|
1165
|
+
}
|
1166
|
+
case actionGoToR:
|
1167
|
+
{
|
1168
|
+
LinkGoToR *ha=(LinkGoToR *) link->getAction();
|
1169
|
+
LinkDest *dest=NULL;
|
1170
|
+
int page=1;
|
1171
|
+
GString *file=new GString("actionGoToR:");
|
1172
|
+
|
1173
|
+
if (ha->getDest()!=NULL) dest=ha->getDest()->copy();
|
1174
|
+
|
1175
|
+
if (dest&&file){
|
1176
|
+
if (!(dest->isPageRef())) page=dest->getPageNum();
|
1177
|
+
delete dest;
|
1178
|
+
|
1179
|
+
if (printCommands) printf(" link to page %d ",page);
|
1180
|
+
if (printHtml){
|
1181
|
+
p=file->getCString()+file->getLength()-4;
|
1182
|
+
file->append(GString::fromInt(page));
|
1183
|
+
file->append(",");
|
1184
|
+
}
|
1185
|
+
}
|
1186
|
+
if (printCommands) printf("filename %s\n",file->getCString());
|
1187
|
+
return file;
|
1188
|
+
}
|
1189
|
+
case actionURI:
|
1190
|
+
{
|
1191
|
+
LinkURI *ha=(LinkURI *) link->getAction();
|
1192
|
+
//GString* file=new GString(ha->getURI()->getCString());
|
1193
|
+
GString *file=new GString("actionURI:");
|
1194
|
+
//file->append(ha->getURI()->getCString());
|
1195
|
+
// printf("uri : %s\n",file->getCString());
|
1196
|
+
return file;
|
1197
|
+
}
|
1198
|
+
case actionLaunch:
|
1199
|
+
{
|
1200
|
+
LinkLaunch *ha=(LinkLaunch *) link->getAction();
|
1201
|
+
GString* file=new GString(ha->getFileName()->getCString());
|
1202
|
+
if (printHtml) {
|
1203
|
+
p=file->getCString()+file->getLength()-4;
|
1204
|
+
if (!strcmp(p, ".pdf") || !strcmp(p, ".PDF")){
|
1205
|
+
file->del(file->getLength()-4,4);
|
1206
|
+
file->append(".html");
|
1207
|
+
}
|
1208
|
+
if (printCommands) printf("filename %s",file->getCString());
|
1209
|
+
|
1210
|
+
return file;
|
1211
|
+
}
|
1212
|
+
}
|
1213
|
+
default:
|
1214
|
+
return new GString();
|
1215
|
+
}
|
1216
|
+
}
|
1217
|
+
|
1218
|
+
void ImgOutputDev::dumpMetaVars(FILE *file)
|
1219
|
+
{
|
1220
|
+
GString *var;
|
1221
|
+
|
1222
|
+
for(int i = 0; i < glMetaVars->getLength(); i++)
|
1223
|
+
{
|
1224
|
+
HtmlMetaVar *t = (HtmlMetaVar*)glMetaVars->get(i);
|
1225
|
+
var = t->toString();
|
1226
|
+
fprintf(file, "%s\n", var->getCString());
|
1227
|
+
delete var;
|
1228
|
+
}
|
1229
|
+
}
|
1230
|
+
|
1231
|
+
GBool ImgOutputDev::dumpDocOutline(Catalog* catalog)
|
1232
|
+
{
|
1233
|
+
FILE * output;
|
1234
|
+
GBool bClose = gFalse;
|
1235
|
+
|
1236
|
+
if (!ok || xml)
|
1237
|
+
return gFalse;
|
1238
|
+
}
|
1239
|
+
|
1240
|
+
void ImgOutputDev::updateCharSpace(GfxState *state)
|
1241
|
+
{
|
1242
|
+
pages->updateCharSpace(state);
|
1243
|
+
}
|