diff options
author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2006-02-10 18:04:38 +0100 |
---|---|---|
committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2006-02-10 18:04:38 +0100 |
commit | 263c3dafed233ed2040f53f19f5d20809e9ef42d (patch) | |
tree | 00a0c180d0ad26ec8091cc5aaca5f97e216c9fcd /src | |
parent | f2646e054ce3d1bfa86471553e663b426a143ad8 (diff) |
use first occurence of BoundingBox declaration in DSC
Diffstat (limited to 'src')
-rw-r--r-- | src/PostscriptDSC.cxx | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/PostscriptDSC.cxx b/src/PostscriptDSC.cxx index 985722d..22cfe40 100644 --- a/src/PostscriptDSC.cxx +++ b/src/PostscriptDSC.cxx @@ -51,6 +51,7 @@ PostscriptDSC::parse(int fd) { int x, y, w, h; int p1, p2, ps; int i = 0; + int bb_read = 0; bb_x = 0; bb_y = 0; @@ -75,11 +76,13 @@ PostscriptDSC::parse(int fd) { } while (fgets(linebuf, sizeof(linebuf), fp) != NULL) { - if (sscanf(linebuf, "%%%%BoundingBox: %d %d %d %d", &x, &y, &w, &h) == 4) { + if (!bb_read && + sscanf(linebuf, "%%%%BoundingBox: %d %d %d %d", &x, &y, &w, &h) == 4) { bb_x = x; bb_y = y; bb_w = w; bb_h = h; + bb_read++; } else if (strncmp(linebuf, "%%EndSetup", strlen("%%EndSetup")) == 0) { setup_len = ftello(fp); } else if (sscanf(linebuf, "%%%%Pages: %d", &ps) == 1) { |