|
With the HOOPS 3D Application
Framework, you can now export PDF files directly from your
application. There's built-in support for both 2d and 3d
PDF files. The MVO class HIOUtilityPDF can be used to save
both 2D and 3D PDF files. When creating a 2D PDF, the PDF
driver is used. When creating a 3D PDF file, the MVO class
HIOUtilityU3D is used to embed a U3D model directly into
a skeleton PDF Document that is created on the fly.
Two-Dimensional PDF Documents
Creation of 2D PDF Documents
is accomplished by including your scene in an instance of
the PDF driver. The PDF driver exports both vector and raster
data. The width and height of the page is accessible via
the Driver Option “physical size” while the
resolution of the raster data is set via the “hardcopy
resolution” Driver Option. The MVO class HIOUtilityPDF
uses the two pass printing approach to rasterize the facet
data and draw vector data over the raster data. The vector
data will be hidden surface removed before being placed
in the scene so that it seamlessly draws into the scene
with the rasterized data. The scene may also be included
in a PDF driver segment if rasterization of facets isn't
necessary. PDF documents created with the PDF driver are
ZLib compressed to minimize file size. As of HOOPS 14.0
the only fonts directly supported by the PDF driver at this
time are the generic fonts Roman, Sans Serif and Typewriter.
The other fonts in the scene will be embedded either as
polygons or polylines.
Example:
Using the PDF driver directly:
HC_Open_Segment("/driver/pdf/output.pdf");{
HC_Set_Driver_Options("hardcopy resolution
= 300, isolated");
HC_Include_Segment_By_Key(m_pHView->GetModelKey());
HC_Update_One_Display(".");
}HC_Close_Segment();
HC_Delete_Segment("/driver/pdf/output.pdf");
Using the MVO class HIOUtilityU3D:
HIOUtilityPDF output;
HPDFOutputHandlerOptions options(8.5*72, 11*72);
HFileOutputResult result;
options.m_Image_Dpi = 500;
options.m_pHBaseView = m_pHView;
result = output.FileOutputByKey("output.pdf",
m_pHView->GetSceneKey(), &options);
if(result != OutputOK){
/* show some error */
}
Three Dimensional PDF Documents
PDF Documents are now able to
embed 3D models that the user can interact with. U3D is
the 3D format of these embedded models. When HOOPS is built
with U3D support, 3D PDF files are exported using the HIOUtilityPDF
class. Setting the member m_b3dpdf in PDFOutputHandlerOptions
to true and calling FileOutputByKey will export a 3D PDF
file.
Example:
HIOUtilityPDF output;
HPDFOutputHandlerOptions options(8.5*72, 11*72);
HFileOutputResult result;
options.m_Image_Dpi = 500;
options.m_pHBaseView = m_pHView;
options.m_b3dpdf = true;
result = output.FileOutputByKey("output.pdf",
m_pHView->GetSceneKey(), &options);
if(result != OutputOK){
/* show some error */
}
|