diff options
| author | Mathieu Malaterre <mathieu.malaterre@gmail.com> | 2014-09-19 15:48:48 +0000 |
|---|---|---|
| committer | Mathieu Malaterre <mathieu.malaterre@gmail.com> | 2014-09-19 15:48:48 +0000 |
| commit | 31fd8d3fe8ff4ce9207cf26793fdbe07d57f1a43 (patch) | |
| tree | d82b96f429dab8e16fe18aefab2932de220bc7cf /tests | |
| parent | 6868ee373ecc69ac472b6d61decc4741723c1540 (diff) | |
trunk: extend support for pdf2jp2
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/pdf2jp2.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/pdf2jp2.c b/tests/pdf2jp2.c index 830cbf4e..38aa739f 100644 --- a/tests/pdf2jp2.c +++ b/tests/pdf2jp2.c @@ -37,6 +37,11 @@ * only work on linux since I need memmem function */ +/* + * Add support for other signatures: + * + * obj<</Subtype/Image/Length 110494/Filter/JPXDecode/BitsPerComponent 8/ColorSpace/DeviceRGB/Width 712/Height 1052>>stream + */ #define _GNU_SOURCE #include <string.h> #include <stdio.h> @@ -98,7 +103,17 @@ int main(int argc, char *argv[]) assert( r ); /*fprintf( stderr, "DEBUG: %s", r );*/ s = sscanf(r, "JPXDecode]/Length %d/Width %*d/BitsPerComponent %*d/Height %*d", &len); - assert( s == 1 ); + if( s == 0 ) + { // try again harder + const int ret = fseek(f, offets[i] - 40, SEEK_SET); // 40 is magic number + assert( ret == 0 ); + r = fgets(buffer, sizeof(buffer), f); + assert( r ); + const char needle2[] = "/Length"; + char * s2 = strstr(buffer, needle2); + s = sscanf(s2, "/Length %d/", &len); + } + if( s == 1 ) { FILE *jp2; int j; |
