From 2942f8214e8462e14d6ef74bc82076b12b46131a Mon Sep 17 00:00:00 2001 From: kramm Date: Mon, 5 Jul 2004 10:59:01 +0000 Subject: [PATCH] startPage function now takes a crop box as parameter. --- pdf2swf/SWFOutputDev.cc | 19 ++++++++++++++----- pdf2swf/xpdf/OutputDev.h | 2 +- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/pdf2swf/SWFOutputDev.cc b/pdf2swf/SWFOutputDev.cc index 2809efc..ea19016 100644 --- a/pdf2swf/SWFOutputDev.cc +++ b/pdf2swf/SWFOutputDev.cc @@ -144,7 +144,7 @@ public: void startDoc(XRef *xref); // Start a page. - virtual void startPage(int pageNum, GfxState *state) ; + virtual void startPage(int pageNum, GfxState *state, double x1, double y1, double x2, double y2) ; //----- link borders virtual void drawLink(Link *link, Catalog *catalog) ; @@ -700,18 +700,27 @@ void SWFOutputDev::endType3Char(GfxState *state) msg(" endType3Char"); } -void SWFOutputDev::startPage(int pageNum, GfxState *state) +void SWFOutputDev::startPage(int pageNum, GfxState *state, double crop_x1, double crop_y1, double crop_x2, double crop_y2) { double x1,y1,x2,y2; laststate = state; msg(" startPage %d\n", pageNum); msg(" processing page %d", pageNum); - state->transform(state->getX1(),state->getY1(),&x1,&y1); + /*state->transform(state->getX1(),state->getY1(),&x1,&y1); state->transform(state->getX2(),state->getY2(),&x2,&y2); + */ + x1 = crop_x1; + y1 = crop_y1; + x2 = crop_x2; + y2 = crop_y2; + + if(x2 Bounding box is (%f,%f)-(%f,%f)", x1,y1,x2,y2); - swfoutput_init(&output, swffilename, abs((int)(x2-x1)),abs((int)(y2-y1))); + msg(" Bounding box is (%f,%f)-(%f,%f)", crop_x1,crop_y1,crop_x2,crop_y2); + swfoutput_init(&output, swffilename,(int)crop_x1,(int)crop_y1,(int)crop_y2,(int)crop_y2); outputstarted = 1; } else diff --git a/pdf2swf/xpdf/OutputDev.h b/pdf2swf/xpdf/OutputDev.h index cb825e0..4a05f1a 100644 --- a/pdf2swf/xpdf/OutputDev.h +++ b/pdf2swf/xpdf/OutputDev.h @@ -59,7 +59,7 @@ public: virtual void setDefaultCTM(double *ctm); // Start a page. - virtual void startPage(int pageNum, GfxState *state) {} + virtual void startPage(int pageNum, GfxState *state, double x1,double y1,double x2,double y2) {} // End a page. virtual void endPage() {} -- 1.7.10.4