DATAKIT SDK  V2026.2
PdfWrite.hpp File Reference

Go to the source code of this file.

Functions

void ActivatePdfDump (Dtk_bool inDumpPDF)
 
Dtk_bool IsPdfDumpActivated ()
 
void PdfEndComponent ()
 
void PdfEndInstance (Dtk_ID pdfInstID, Dtk_ID childID)
 
void PdfEndNode ()
 
void PdfEndWrite (const Dtk_string &inInputFile)
 
Dtk_ID PdfInitComponent (Dtk_ComponentPtr inComponent)
 
Dtk_ID PdfInitInstance (Dtk_ComponentPtr inComponent)
 
Dtk_ID PdfInitNode (Dtk_NodePtr inNode)
 
Dtk_ErrorStatus PdfInitWrite (const Dtk_string &inInputFileName, const Dtk_string &inOutputFolder)
 
void PdfInstanceExistingPrototype (Dtk_ID ComponentIndex)
 
void PdfWriteDrawingNode (Dtk_NodePtr inNode)
 
void PdfWriteEntity (Dtk_EntityPtr inEntity)
 
void PdfWriteMetaData (Dtk_ComponentPtr inComponent)
 
void PdfWriteMetaData (Dtk_tab< Dtk_MetaDataPtr > &inTabMetadata)
 

Function Documentation

◆ ActivatePdfDump()

void ActivatePdfDump ( Dtk_bool  inDumpPDF)
25 {
26  toDumpPDF = inDumpPDF;
27 }

◆ IsPdfDumpActivated()

Dtk_bool IsPdfDumpActivated ( )
30 {
31  return toDumpPDF;
32 }

◆ PdfEndComponent()

void PdfEndComponent ( )
155 {
156  Pdfw::EndNode();
157 }

◆ PdfEndInstance()

void PdfEndInstance ( Dtk_ID  pdfInstID,
Dtk_ID  childID 
)
112 {
113  if ( ProcessedComponents.find(childID) < 0)
114  {
115  PdfComponents.push_back(pdfInstID);
116  }
117  Pdfw::EndNode();
118 }

◆ PdfEndNode()

void PdfEndNode ( )
172 {
173  Pdfw::EndNode();
174 }

◆ PdfEndWrite()

void PdfEndWrite ( const Dtk_string inInputFile)
84 {
85  Dtk_UInt32 artworkIndex = 0;
86  Pdfw::Layout::End3DArtwork(artworkIndex);
87  CreatePDFLayout(inInputFile, artworkIndex, modelInventory);
88  modelInventory.clear();
91 }

◆ PdfInitComponent()

Dtk_ID PdfInitComponent ( Dtk_ComponentPtr  inComponent)
147 {
148  Dtk_InfoPtr infos = inComponent->GetInfos();
149  Dtk_string name = inComponent->Name();
150  Dtk_ID pdfID;
151  Pdfw::InitNode(name, Dtk_transfo(), infos, pdfID);
152  return pdfID;
153 }

◆ PdfInitInstance()

Dtk_ID PdfInitInstance ( Dtk_ComponentPtr  inComponent)
94 {
95  Dtk_ID pdfInstID;
96  Dtk_string ComponentName;
97  ComponentName = inComponent->Name();//Component name
98 
99  Dtk_InfoPtr infos = inComponent->GetInfos();
100  Dtk_transfo instanceTransfo;
101 
102  if (inComponent->InstanceName().len() > 0)
103  ComponentName += " (" + inComponent->InstanceName() + ")";
104 
105  instanceTransfo = inComponent->TransformationMatrix();
106  Pdfw::InitNode(ComponentName, instanceTransfo, infos, pdfInstID);
107  Pdfw::StorePrototype(pdfInstID);
108  return pdfInstID;
109 }

◆ PdfInitNode()

Dtk_ID PdfInitNode ( Dtk_NodePtr  inNode)
160 {
161  Dtk_ID pdfID;
162  Dtk_string NodeName = inNode->Name();
163  Dtk_InfoPtr nodeInfo = inNode->GetInfos();
164  Dtk_bool nodeVisi = nodeInfo->GetBlankedStatus() ? DTK_FALSE : DTK_TRUE;
165  Pdfw::InitNode(NodeName, Dtk_transfo(), nodeVisi, pdfID);
166  if (nodeInfo.IsNotNULL())
168  return pdfID;
169 }

◆ PdfInitWrite()

Dtk_ErrorStatus PdfInitWrite ( const Dtk_string inInputFileName,
const Dtk_string inOutputFolder 
)
35 {// Initialize writing
36  Dtk_ErrorStatus stErrorPdf;
37  Dtk_string outputPDFFile;
38  Pdfw::WriteOptions options;
39 
40  // Pdf options :
41  // We choose between PRC or U3D 3D format
42  options.WritePRC = DTK_TRUE;
43  // We will generate our own layout
45 #ifndef Linux
46  // We choose the font to use
47  options.Layout.TTF_Font = "C:/Windows/Fonts/arial.ttf";
49 #endif
50  // We handle line thickness
52  // We set a transparent background
54 
55  outputPDFFile = inInputFileName + "_dtk.pdf";
56  if (inOutputFolder.len() > 0)
57  outputPDFFile = inOutputFolder + inInputFileName.filename() +inInputFileName.extension() + "_dtk.pdf";
58  // Initializing the writer
59  stErrorPdf = Pdfw::InitWrite(outputPDFFile, "", NULL, options);
60 
61  if (stErrorPdf == dtkNoError)
62  cout << "Creating Pdf file... " << outputPDFFile.c_str() << endl;
63  else
64  cout << "Warning : Pdf Write failed : " << dtkTypeError(stErrorPdf).c_str() << endl;
65 
66 
67 
68  //**************************************************************************************************************//
69  //layout
70  //**************************************************************************************************************//
71  // Page creation
73  // Size of Page
75 
76  // PDF 3D Artwork initialization
77  Pdfw::Layout::Init3DArtwork(inInputFileName.filename());
78 
79  modelInventory.clear();
80  return stErrorPdf;
81 }

◆ PdfInstanceExistingPrototype()

void PdfInstanceExistingPrototype ( Dtk_ID  ComponentIndex)
142 {
144 }

◆ PdfWriteDrawingNode()

void PdfWriteDrawingNode ( Dtk_NodePtr  inNode)
188 {
189  Dtk_DrawingPtr TmpDrawing = inNode->GetDtk_DrawingPtr();
190 
191  //Count Drawing
193 }

◆ PdfWriteEntity()

void PdfWriteEntity ( Dtk_EntityPtr  inEntity)
177 {
178  Pdfw::WriteEntity(inEntity);
179  if (inEntity->get_type_detk() == DTK_TYPE_BODY)
181  if (inEntity->get_type_detk() == DTK_TYPE_MESH)
183  if (inEntity->get_type_detk() == DTK_TYPE_FDT)
185 }

◆ PdfWriteMetaData() [1/2]

void PdfWriteMetaData ( Dtk_ComponentPtr  inComponent)
121 {
122  Dtk_Size_t i,NumMetaData;
123  NumMetaData = inComponent->GetNumMetaData();
124  if (NumMetaData)
125  {
126  Dtk_tab<Dtk_MetaDataPtr> tabMetadata;
127  for (i = 0; i < NumMetaData; i++)
128  {
129  tabMetadata.push_back(inComponent->GetMetaData(i));
130  }
131  Pdfw::AddNodeMetadata(tabMetadata);
132  }
133 }

◆ PdfWriteMetaData() [2/2]

void PdfWriteMetaData ( Dtk_tab< Dtk_MetaDataPtr > &  inTabMetadata)
136 {
137  Pdfw::AddNodeMetadata(inTabMetadata);
138 }
Dtk_ID
uint32_t Dtk_ID
Definition: define.h:681
Dtk_transfo
This is the Transformation dedicated class.
Definition: dtk_transfo.hpp:19
Pdfw::AddNodeMetadata
DtkErrorStatus AddNodeMetadata(Dtk_tab< Dtk_MetaDataPtr > &inTabMetadata)
Add table of metadata to current node.
Dtk_Info::GetBlankedStatus
int GetBlankedStatus() const
Retrieves the entity Blanked Status.
Dtk_Node::FdtType
@ FdtType
Definition: dtk_maindoc.hpp:252
Pdfw::WriteOptions
This class provides several options to tune Pdf Writer. It must be provided to Pdfw::InitWrite method...
Definition: pdfw.hpp:113
DTK_TYPE_MESH
@ DTK_TYPE_MESH
Definition: define.h:468
Pdfw::InitWrite
DtkErrorStatus InitWrite(const Dtk_string &inOutputFile, const Dtk_string &inLogFile, Licence_dtk inLicFct, WriteOptions &inOptions)
Initialize the PDF Writer
Pdfw::WriteOptions::Layout
LayoutOptions Layout
Definition: pdfw.hpp:193
Dtk_SmartPtr::IsNotNULL
Dtk_bool IsNotNULL() const
Definition: util_ptr_dtk.hpp:119
ProcessedComponents
Dtk_tab< Dtk_ID > ProcessedComponents
Definition: WritePrototype.cpp:16
Pdfw::Layout::EndPage
Dtk_ErrorStatus EndPage()
End of page.
Pdfw::LayoutOptions::CreateAutomaticLayout
Dtk_bool CreateAutomaticLayout
DTK_TRUE : Creates automatic layout (One page with filled with 3D Annotation), DTK_FALSE : You must u...
Definition: pdfw.hpp:37
DTK_TRUE
#define DTK_TRUE
Definition: define.h:719
Dtk_UInt32
uint32_t Dtk_UInt32
Definition: define.h:680
Dtk_string
This is a high level string class.
Definition: dtk_string.hpp:53
Dtk_Size_t
size_t Dtk_Size_t
Definition: define.h:704
Dtk_Node::BodyType
@ BodyType
Definition: dtk_maindoc.hpp:249
DTK_FALSE
#define DTK_FALSE
Definition: define.h:720
Dtk_bool
char Dtk_bool
Definition: define.h:717
Pdfw::AddNodeRenderInfo
DtkErrorStatus AddNodeRenderInfo(Dtk_RenderInfosPtr inRenderInfos)
Add rendering informations to current node.
Dtk_Entity::get_type_detk
virtual enum type_detk get_type_detk() const =0
Pdfw::LayoutOptions::WriteLineThickness
Dtk_bool WriteLineThickness
DTK_TRUE : write line thickness, DTK_FALSE : Writes lines with thickness value equals to 0....
Definition: pdfw.hpp:41
Pdfw::Layout::SetCurrentPageSize
Dtk_ErrorStatus SetCurrentPageSize(PageSizes inSize, PageDirection inDirection)
Sets current page size.
Pdfw::ReinstanciatePrototype
DtkErrorStatus ReinstanciatePrototype(Dtk_ID inID)
Reinstanciate children of node to reinstanciate in current node.
Pdfw::Layout::Init3DArtwork
DtkErrorStatus Init3DArtwork(Dtk_string inAnnotName=Dtk_string(), Pdfw::WriteOptions *inWriteOptions=NULL)
Starts Writing of 3D Artwork (3D model)
Pdfw::StorePrototype
void StorePrototype(Dtk_ID inID)
Stores the identifier of a node.
Dtk_string::filename
Dtk_string filename() const
File Utility : Retrieves the filename in Dtk_string form.
Pdfw::EndWrite
DtkErrorStatus EndWrite()
Creation of the output file and free the PDF Writer
modelInventory
std::map< Dtk_Node::NodeDataTypeEnum, Dtk_Size_t > modelInventory
Definition: PdfWrite.cpp:22
DTK_TYPE_BODY
@ DTK_TYPE_BODY
Definition: define.h:481
Pdfw::EndNode
DtkErrorStatus EndNode()
End the node.
Pdfw::LayoutOptions::RasterizeTexts
Dtk_bool RasterizeTexts
DTK_TRUE : rasterizing texts, DTK_FALSE : Converts texts as texts with the font you provide.
Definition: pdfw.hpp:39
Pdfw::Layout::LANDSCAPE
@ LANDSCAPE
Definition: pdfw.hpp:478
Dtk_ErrorStatus
Dtk_ErrorStatus
Definition: error_dtk.hpp:6
Dtk_Info::GetRenderInfos
Dtk_RenderInfosPtr GetRenderInfos() const
Retrieves the entity RenderInfos of the entity.
DTK_TYPE_FDT
@ DTK_TYPE_FDT
Definition: define.h:424
Pdfw::LayoutOptions::TTF_Font
Dtk_string TTF_Font
Definition: pdfw.hpp:45
Pdfw::Layout::SIZE_A5
@ SIZE_A5
Definition: pdfw.hpp:463
Dtk_SmartPtr< Dtk_Info >
dtkTypeError
Dtk_string dtkTypeError(Dtk_Int32 errNumero)
Dtk_string::c_str
const char * c_str() const
Retrieve the ASCII conversion string.
PdfComponents
Dtk_tab< Dtk_ID > PdfComponents
Definition: PdfWrite.cpp:20
Dtk_string::extension
Dtk_string extension() const
File Utility : Retrieves the extension in Dtk_string form.
Pdfw::Layout::End3DArtwork
DtkErrorStatus End3DArtwork(Dtk_UInt32 &outartworkIndex)
Ends Writing of 3D Artwork.
toDumpPDF
Dtk_bool toDumpPDF
Definition: PdfWrite.cpp:18
Pdfw::WriteEntity
Dtk_ErrorStatus WriteEntity(const Dtk_EntityPtr &inEntity)
Write the entity provided in parameter in a node.
Dtk_tab
This is a high level array class.
Definition: util_stl_dtk.hpp:84
Pdfw::InitNode
DtkErrorStatus InitNode(Dtk_string &inNodeName, const Dtk_transfo &inTransfo=Dtk_transfo())
Initialize a node.
Pdfw::WriteOptions::WritePRC
Dtk_bool WritePRC
DTK_TRUE : Embedding PRC file, DTK_FALSE : Embedding U3D file.
Definition: pdfw.hpp:161
Dtk_string::len
int len() const
Retrieve the length of the Dtk_string.
dtkNoError
@ dtkNoError
Definition: error_dtk.hpp:149
Dtk_tab::push_back
void push_back(const T &x)
Inserts an element at the end of the array.
Definition: util_stl_dtk.hpp:416
Dtk_Node::DrawingType
@ DrawingType
Definition: dtk_maindoc.hpp:253
CreatePDFLayout
void CreatePDFLayout(const Dtk_string &inFileName, Dtk_Int32 artworkIndex, std::map< Dtk_Node::NodeDataTypeEnum, Dtk_Size_t > &inModelInventory)
Definition: PdfWriteLayout.cpp:283
Pdfw::WriteOptions::TransparentBackground
Dtk_bool TransparentBackground
DTK_TRUE : Transparent Background, DTK_FALSE : Opaque Background.
Definition: pdfw.hpp:153
Pdfw::Layout::InitPage
Dtk_ErrorStatus InitPage(Dtk_RGB inColor=Dtk_RGB(255, 255, 255), Dtk_Double64 inWidth=842, Dtk_Double64 inHeight=595)
LAYOUT METHODS.
Dtk_Node::MeshType
@ MeshType
Definition: dtk_maindoc.hpp:250