PDFDraw.h

Go to the documentation of this file.
00001 //---------------------------------------------------------------------------------------
00002 // Copyright (c) 2001-2008 by PDFTron Systems Inc. All Rights Reserved.
00003 // Consult legal.txt regarding legal and license information.
00004 //---------------------------------------------------------------------------------------
00005 
00006 #ifndef   H_CPPPDFDraw
00007 #define   H_CPPPDFDraw
00008 
00009 #include <PDF/PDFRasterizer.h>
00010 #include <C/PDF/TRN_PDFDraw.h>
00011 
00013 #if defined(_WIN32) && !defined(WINCE)
00014   // A forward declaration for GDI+ Bitmap-s which can be directly created using PDFDraw::GetBitmap() method.
00015   namespace Gdiplus { class Bitmap; };
00016 #endif
00018 
00019 
00020 
00021 namespace pdftron { 
00022         namespace PDF {
00023 
00031 class PDFDraw
00032 {
00033 public: 
00034 
00042         PDFDraw(double dpi = 92);
00043         ~PDFDraw();
00044 
00053         void SetRasterizerType (PDFRasterizer::Type type);
00054 
00074         void SetDPI(double dpi);
00075 
00088         void SetImageSize(int width, int height, bool preserve_aspect_ratio = true);
00089 
00096         void SetPageBox(Page::Box region);
00097 
00104         void SetFlipYAxis(bool flip_y);
00105 
00115         void SetRotate(Page::Rotate r);
00116 
00123         void SetDrawAnnotations(bool render_annots);
00124 
00134         void SetAntiAliasing(bool enable_aa);
00135 
00149         void SetImageSmoothing(bool smoothing_enabled = true);
00150 
00157         void SetCaching(bool enabled = true);
00158 
00171         void SetGamma(double exp);
00172 
00182         void SetOCGContext(OCG::Context* ctx);
00183 
00217         void Export(Page page, const UString& filename, const char* format = "PNG", SDF::Obj encoder_params = 0);
00218 
00227         #ifdef __DOTNET
00228         System::Drawing::Bitmap* GetBitmap(Page page);
00229         #endif
00230 
00243         void DrawInRect(Page& page, void* hdc, const Rect& rect);
00244 
00245         enum PixelFormat {
00246                 e_rgba,
00247                 e_bgra,
00248                 e_rgb,
00249                 e_bgr,
00250                 e_gray
00251         };
00252 
00274         const UChar* GetBitmap(Page page, int& out_width, int& out_height, int& out_stride, double& out_dpi, PixelFormat pix_fmt = e_bgra);
00275 
00283         void SetErrorReportProc(PDFRasterizer::ErrorReportProc error_proc, void* data);
00284 
00286         TRN_PDFDraw mp_draw;
00288 };
00289 
00290 
00291 #include <Impl/PDFDraw.inl>
00292 
00293 
00294         };      // namespace PDF
00295 };      // namespace pdftron
00296 
00297 
00298 #endif 
00299 
00300 
00301 

© 2002-2008 PDFTron Systems Inc.