/////////////////////////////////////////////////////////////////////////////// // 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 VISUALIZE2PDF_H #define VISUALIZE2PDF_H #include "TD_PackPush.h" #include "RxDispatchImpl.h" #include "TvExport.h" #include "DbBaseDatabase.h" #include "StaticRxObject.h" #include "Ed/EdCommandContext.h" #include "RxDynamicModule.h" #include "Ed/EdCommandStack.h" /** \details This class implements the properties of the exported to pdf */ class OdTvVisualize2PdfExportProperties : public OdRxDispatchImpl<> { public: OdTvVisualize2PdfExportProperties(); virtual ~OdTvVisualize2PdfExportProperties(); ODRX_DECLARE_DYNAMIC_PROPERTY_MAP(OdTvVisualizePrcFilerProperties); static OdRxDictionaryPtr createObject(); void set3DPdf(bool bIs3DPdf); bool is3DPdf() const; void setBackgroundColor(OdIntPtr background); OdIntPtr getBackgroundColor() const; void setDevices(const OdStringArray& devices); const OdStringArray& getDevices() const; void setPaperSizes(OdDoubleArray paperSizes); const OdDoubleArray getPaperSizes() const; void setZoomToExtents(bool bVal); bool getZoomToExtents() const; void setPublishTemplate(OdUInt8 publishTemplate); OdUInt8 getPublishTemplate() const; void setEmbeddedTTF(bool bVal); bool getEmbeddedTTF() const; void setEmbeddedTTFOptimization(bool bVal); bool getEmbeddedTTFOptimization() const; void setTTFAsGeometry(bool bVal); bool getTTFAsGeometry() const; void setSHXAsGeometry(bool bVal); bool getSHXAsGeometry() const; void setTextSearchable(bool bVal); bool getTextSearchable() const; void setSimpleGeomOptimization(bool bVal); bool getSimpleGeomOptimization() const; void setHiddenLineRemovalAlgorithm(bool bVal); bool getHiddenLineRemovalAlgorithm() const; void setExportHyperLinks(bool bVal); bool getExportHyperLinks() const; void setLinearizePDF(bool bVal); bool getLinearizePDF() const; void setIgnoreVisibleVpBorders(bool bVal); bool getIgnoreVisibleVpBorders() const; void setTransparentShadedVpBg(bool bVal); bool getTransparentShadedVpBg() const; void setFlateCompression(bool bVal); bool getFlateCompression() const; void setASCIIHexEncoding(bool bVal); bool getASCIIHexEncoding() const; protected: enum Options { k3dPdf = 1 << 0, // Flag for publish to pdf kZoomExtents = 1 << 1, // If enabled, layout geometry will be zoomed to paper size, else layout settings will be applied. kEmbeddedTTF = 1 << 2, // Enable embedding of True Type font program to PDF file. The whole True Type font file will be embedded (huge .pdf size). kEmbeddedTTFOptimized = 1 << 3, // Enable embedding of True Type font program to .pdf file. The True Type font will be reduced by removing unused parts (smaller .pdf file size, but limited editing). kTTFAsGeometry = 1 << 4, // Enable True Type font text to geometry conversion. kSHXAsGeometry = 1 << 5, // Enable SHX font text to geometry conversion. kTextSearchable = 1 << 6, // Make text searchable kSimpleGeomOptimization = 1 << 7, // Enable simple geometry optimization (separated segments to one polyline, Bezier curve control points). kHiddenLineRemovalAlg = 1 << 8, // Determines whether software uses vector hidden-line removal for corresponding viewports. kExportHyperlinks = 1 << 9, // Enable hyperlinks export. kLinearizePDF = 1 << 10, // Create linearized .pdf file. kIgnoreVisibleVpBorders = 1 << 11, // Sets the extents calculation mode value. kTransparentShadedVpBg = 1 << 12, // Sets a new value of the shaded views transparency option. kFlateCompression = 1 << 13, // Enable compression of internal PDF streams. kASCIIHexEncoding = 1 << 14, // Enable ASCIIHex encoding of internal PDF streams kDefault = kZoomExtents | kTTFAsGeometry | kSHXAsGeometry | kFlateCompression }; ODCOLORREF m_backgroundColor; // Background color. Default: white. OdStringArray m_devices; // List of devices names OdDoubleArray m_paperSizes; // Paper sizes OdUInt8 m_iTemplate; // Template for publish OdUInt32 m_iFlags; // Flags for options }; typedef OdSmartPtr OdTvVisualize2PdfExportPropertiesPtr; /** \details This class is pdf exporter (from the Visualize database) */ class OdTvVisualize2PdfExport : public OdTvVisualizeExport { public: OdTvVisualize2PdfExport(); OdTvResult exportTo(const OdTvDatabaseId& tvDbId, const OdString& fileName) const; OdTvResult exportTo(const OdTvDatabaseId& tvDbId, OdStreamBuf* pStreamBuf) const; OdRxDictionaryPtr properties() { return m_properties; } OdTvResult appendTo(const OdArray& tvModelIds, const OdString& sourceFileName, const OdString& fileName) const { return tvNotImplementedYet; } private: OdInt32 exportTo2dPdf(const OdTvDatabaseId& tvDbId, OdDbBaseDatabase* pDb, const OdString& fileName) const; OdInt32 exportTo3dPdf(const OdTvDatabaseId& tvDbId, OdDbBaseDatabase* pDb, const OdString& fileName) const; private: OdTvVisualize2PdfExportPropertiesPtr m_properties; }; #define CMD_DEF_CLASS(CmdName, GroupName) #define CMD_DEF(CmdName, GroupName) \ class _##CmdName##_cmd : public OdEdCommand \ { \ public: \ const OdString groupName() const;\ const OdString globalName() const;\ void execute(OdEdCommandContext* pCmdCtx);\ void setTvDatabase(const OdTvDatabaseId& tvDbId) { m_dbId = tvDbId; }\ private:\ OdTvDatabaseId m_dbId;\ }; #include "Visualize2PdfCommands.h" #undef CMD_DEF_CLASS #undef CMD_DEF /** \details This class is pdf exporter module implementation */ class OdTvVisualize2PdfFilerModule : public OdTvVisualizeExportModule { #define CMD_DEF(CmdName, GroupName) \ OdStaticRxObject<_##CmdName##_cmd> m_##CmdName##_cmd; #include "Visualize2PdfCommands.h" #undef CMD_DEF public: OdTvVisualizeExportPtr getVisualizeExporter() const; void initApp(); void uninitApp(); }; #include "TD_PackPop.h" #endif // VISUALIZE2PDF_H