/////////////////////////////////////////////////////////////////////////////// // Copyright (C) 2002-2025, Open Design Alliance (the "Alliance"). // All rights reserved. // // This software and its documentation and related materials are owned by // the Alliance. The software may only be incorporated into application // programs owned by members of the Alliance, subject to a signed // Membership Agreement and Supplemental Software License Agreement with the // Alliance. The structure and organization of this software are the valuable // trade secrets of the Alliance and its suppliers. The software is also // protected by copyright law and international treaty provisions. Application // programs incorporating this software must include the following statement // with their copyright notices: // // This application incorporates Open Design Alliance software pursuant to a license // agreement with Open Design Alliance. // Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance. // All rights reserved. // // By use of this software, its documentation or related materials, you // acknowledge and accept the above terms. /////////////////////////////////////////////////////////////////////////////// #ifndef _OD_EX_PDF_TO_RASTER_H_ #define _OD_EX_PDF_TO_RASTER_H_ #include "TD_PackPush.h" #include "Gi/GiRasterImage.h" #include "RxPdfToRasterServices.h" #include "oda_files/oda_functions.h" typedef void* PDFDOC; /** \details This class implements platform-dependent loading and converting of PDF files for ODA SDK. Library: Source code provided. */ class OdPdf2ImageConverterPdfium : public OdPdf2ImageConverter { public: ODRX_DECLARE_MEMBERS(OdPdf2ImageConverterPdfium); OdPdf2ImageConverterPdfium(); ~OdPdf2ImageConverterPdfium() override; /** \details Loads the specified PDF file. */ OdResult loadPdf(const OdString &filename, const OdString &password = "") override; /** \details Loads the PDF file from memory. */ OdResult loadPdf(OdStreamBufPtr &pBuf, const OdString &password = "") override; /** \details Check if the pdf is loaded into converter. */ bool isLoaded() override; /** \details Gets the name of the PDF file, if it was loaded from disk. Otherwise returns empty string. */ OdString getFilename() override; /** \details Gets the page count of the PDF file. */ OdUInt16 getPagesCount() override; /** \details Sets the active page of the loaded PDF. */ OdResult setActivePage(OdUInt16 pageNum = 1) override; /** \details Gets the active page of the PDF file. */ OdUInt16 getActivePage() override; /** \details Get layers list for active page in PDF. */ OdResult getLayers(OdPdfLayerArray& layers) override; /** \details Get page size for active page in PDF. */ OdResult getPageSize(OdGsDCRect& rect) override; /** \details Convert PDF to raster image. */ OdGiRasterImagePtr convertPdf(const OdPdf2ImageConversionParams* params = 0) override; private: virtual OdGiRasterImagePtr convertBmpToRaster(const BITMAPINFOHEADER &bmi, const unsigned char *imagedata) const; virtual bool setupLayers(PDFDOC pDoc, const OdPdfLayerArray& layers); virtual OdResult unloadPdf(); PDFDOC m_pDoc; OdBinaryData m_data; OdString m_fileName; OdUInt16 m_activePage; FPDF_PageLayerInfo m_info; }; /** */ class ExPdfToRasterModule : public OdRxPdfToRasterServices { public: /** \details Initialize module. */ void initApp() override; /** \details Uninitialize module. */ void uninitApp() override; OdPdf2ImageConverterPtr createConverter() override; }; #include "TD_PackPop.h" #endif //#ifndef _OD_EX_PDF_TO_RASTER_H_