diff --git a/ChangeLog b/ChangeLog index 220b490..1b47981 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,8 @@ 0.28: (not yet released) * Update to the latest Leptonica (1.68) * pdf.py now correctly retains DPI from input images (thanks to RubyPDF) - * autotools support + * autotools support, VC++ 2008 solution + * fix binary file open mode on Windows 0.27: * Update to the latest Leptonica (1.58) diff --git a/INSTALL b/INSTALL index 7a68582..4df3e05 100644 --- a/INSTALL +++ b/INSTALL @@ -10,3 +10,18 @@ If you're running a Unix-like OS, such as Linux, BSD, Mac OS X or msys ./configure make make install (or sudo make install) + + +VC++ 2008 Notes +=============== + +Download leptonica-1.68-win32-lib-include-dirs.zip from +http://leptonica.com/download.html and unpack it so 'include', 'lib' and +'jbig2enc' directories are at the same directory (or adjust include path +in VC++ project). + +Download stdint.h for Microsoft Visual Studio (part of package +msinttypes-r26.zip from http://code.google.com/p/msinttypes/downloads/list) +and place it to 'include' directory. + +Them open vs2008/jbig2enc.sln in Visual C++ 2008 and build solution. \ No newline at end of file diff --git a/pdf.py b/pdf.py old mode 100644 new mode 100755 index cd37c9f..a3c5f0a --- a/pdf.py +++ b/pdf.py @@ -117,7 +117,7 @@ def main(symboltable='symboltable', pagefiles=glob.glob('page-*')): pagefiles.sort() for p in pagefiles: try: - contents = file(p).read() + contents = file(p, mode='rb').read() except IOError: sys.stderr.write("error reading page file %s\n"% p) continue diff --git a/src/jbig2.cc b/src/jbig2.cc index fd84ae1..b5311f1 100644 --- a/src/jbig2.cc +++ b/src/jbig2.cc @@ -22,7 +22,11 @@ #include #include #include +#ifdef _MSC_VER +#include +#else #include +#endif #include @@ -205,6 +209,12 @@ main(int argc, char **argv) { const char *img_ext = "png"; bool segment = false; int i; + + #ifdef WIN32 + int result = _setmode(_fileno(stdout), _O_BINARY); + if (result == -1) + fprintf(stderr, "Cannot set mode to binary for stdout\n"); + #endif for (i = 1; i < argc; ++i) { if (strcmp(argv[i], "-h") == 0 || @@ -343,8 +353,9 @@ main(int argc, char **argv) { if (subimage==numsubimages) { subimage = numsubimages = 0; FILE *fp; - if ((fp=fopen(argv[i], "r"))==NULL) { - fprintf(stderr, "Unable to open \"%s\"", argv[i]); + if (verbose) fprintf(stderr, "Processing \"%s\"...\n", argv[i]); + if ((fp=fopen(argv[i], "r"))==NULL) { + fprintf(stderr, "Unable to open \"%s\"\n", argv[i]); return 1; } l_int32 filetype; diff --git a/vs2008/jbig2/jbig2.vcproj b/vs2008/jbig2/jbig2.vcproj new file mode 100644 index 0000000..2cd97a8 --- /dev/null +++ b/vs2008/jbig2/jbig2.vcproj @@ -0,0 +1,203 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vs2008/jbig2enc.sln b/vs2008/jbig2enc.sln new file mode 100644 index 0000000..dcbff84 --- /dev/null +++ b/vs2008/jbig2enc.sln @@ -0,0 +1,29 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual C++ Express 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jbig2", "jbig2\jbig2.vcproj", "{3898E38A-63BE-4D73-828C-8AD70AF8B321}" + ProjectSection(ProjectDependencies) = postProject + {6091B063-4892-490F-8538-91475A5DF370} = {6091B063-4892-490F-8538-91475A5DF370} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libjbig2enc", "libjbig2enc\libjbig2enc.vcproj", "{6091B063-4892-490F-8538-91475A5DF370}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {3898E38A-63BE-4D73-828C-8AD70AF8B321}.Debug|Win32.ActiveCfg = Debug|Win32 + {3898E38A-63BE-4D73-828C-8AD70AF8B321}.Debug|Win32.Build.0 = Debug|Win32 + {3898E38A-63BE-4D73-828C-8AD70AF8B321}.Release|Win32.ActiveCfg = Release|Win32 + {3898E38A-63BE-4D73-828C-8AD70AF8B321}.Release|Win32.Build.0 = Release|Win32 + {6091B063-4892-490F-8538-91475A5DF370}.Debug|Win32.ActiveCfg = Debug|Win32 + {6091B063-4892-490F-8538-91475A5DF370}.Debug|Win32.Build.0 = Debug|Win32 + {6091B063-4892-490F-8538-91475A5DF370}.Release|Win32.ActiveCfg = Release|Win32 + {6091B063-4892-490F-8538-91475A5DF370}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/vs2008/libjbig2enc/libjbig2enc.vcproj b/vs2008/libjbig2enc/libjbig2enc.vcproj new file mode 100644 index 0000000..c7b99da --- /dev/null +++ b/vs2008/libjbig2enc/libjbig2enc.vcproj @@ -0,0 +1,201 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +