Drawings SDK Developer Guide > Working with .dwg Files > Working with Other File Formats > Importing from Other Formats > Importing PDF Files > PDF Import Parameters
PDF Import Parameters

Drawings SDK supports a set of PDF import parameters. These parameters are stored in a dictionary object that can be retrieved for reading and modifying by calling the properties() method of the OdPdfImport class. Each parameter is accessible by its name represented with a string. To set a new parameter value, use the putAt() method of the dictionary object, which assumes two arguments:

  • Parameter name
  • A new value for the parameter

There are two mandatory PDF import parameters:

  • Target drawing database where the imported PDF file content should be stored:
    
    pdfImporter->properties()->putAt(OD_T("Database"), db);
            
  • Full path to the source PDF file:
    
    pdfImporter->properties()->putAt(OD_T("PdfPath"), OdRxVariantValue(path));
            

The full list of import parameters with their access names are described in the following table.

Parameter Name Parameter Brief Parameter Description
Database Database for Import An OdDbDatabase object where the contents of a PDF file should be imported.
PdfPath PDF File Path Full path to the input PDF file.
Password PDF File Password Password for the input PDF file. By default this property is empty.
PageNumber Page Number to Import Number of the page to import from the PDF file. Starts with 1. By default the property is equal to 1. Only one page from the original PDF document can be imported.
LayersUseType Layer Import Handling Defines how imported objects are assigned to layers in the target drawing database:
  • 0 — Uses PDF layers. Layers are created based on layer names from the input PDF document. Each layer's visibility is determined by its visibility in the PDF document. If the origin object is not assigned a layer, it is assigned to a layer according to option 1 for creating object layers. If the object in the PDF document is located on more than one layer, when it is imported it is set to the "inner" layer.
  • 1 — Creates object layers. Creates a predefined list of layers for visible objects in the target database:
    • PDF_Geometry
    • PDF_Solid Fills
    • PDF_Images
    • PDF_Text, etc.
    For invisible objects, specific layers are created as well:
    • PDF_Geometry_Invisible
    • PDF_Solid Fills_Invisible
    • PDF_Images_Invisible
    • PDF_Text _Invisible, etc.
  • 2 — Uses the current layer. Imports all visible PDF objects to the current layer. For invisible objects, invisible layers are created (PDF_Geometry_Invisible, PDF_Solid Fills_Invisible, PDF_Images_Invisible, and PDF_Text _Invisible).
By default this property is equal to 1.
ImportVectorGeometry Vector Geometry Import Handling A Boolean parameter that determines whether a vector geometry data type (such as linear paths, Bezier curves, and solid-filled areas) are imported as polylines and 2D solids or solid-filled hatches. By default this property is true.
ImportSolidFills Solid Fill Import Handling A Boolean parameter that determines whether all solid filled areas are imported (if equal to true) or not (if equal to false). By default this property is equal to true.
ImportTrueTypeText TrueType Text Import Handling A Boolean parameter that determines whether text objects that use TrueType fonts are imported (if equal to true) or not (if equal to false). By default this property is equal to true. Some symbols imported from a PDF document may display incorrectly if the PDF document uses symbols that the origin TrueType font does not contain. To display all symbols correctly, switch on the ImportTrueTypeTextAsGeometry option.
ImportWidgets Widgets Import Flag A flag that determines whether widgets (such as text fields, buttons, etc.) are imported. Widgets are imported as a set of geometric objects, solid-filled objects, images, and text, so enabling or disabling options to import these corresponding objects also affects widget importing. By default, the property value is equal to true.
ImportRasterImages Raster Image Import Handling A Boolean parameter that determines whether raster images are saved as PNG files and are attached to the current drawing database (if equal to true). By default this property is equal to true. The directory used for saving is specified by the system variable PDFIMPORTIMAGEPATH. If the variable value is not set, the images are saved in the application's temporary directory.
ImportGradientFills Gradient Fills Import Handling A Boolean parameter that determines whether shaded objects are saved as PNG image files and are attached to the current drawing database (if equal to true). By default this property is equal to true.
ImportAsBlock Importing as a Block A Boolean parameter that determines whether the PDF file is imported as a block (if equal to true) or as separate objects (if equal to false). By default this property is equal to false.
JoinLineAndArcSegments Join Polyline and Arcs A Boolean parameter that determines whether contiguous segments are joined into a polyline when possible (if equal to true). By default this property is equal to true.
ConvertSolidsToHatches Solids Conversion Handling A Boolean parameter that determines whether two-dimensional solid objects are converted to solid filled hatches (if equal to true). By default this property is equal to true.
ApplyLineweight Lineweight Handling A Boolean parameter that determines whether lineweight properties are retained (if equal to true) or ignored (if equal to false) during the import. By default this property is equal to true.
ImportTrueTypeTextAsGeometry TrueType Text as Geometry A Boolean parameter that determines whether text objects that use TrueType fonts are imported as polylines and solid filled hatches (if equal to true). By default this property is equal to false.

To import text as geometry, also switch on the ImportVectorGeometry and ImportSolidFills options.

Scaling Import Scaling Specifies a different import scale factor for imported objects. By default this property is equal to 1.0.
Rotation Import Rotation Specifies a different rotation angle for imported objects. By default this property is equal to 0.0.
InsertionPointX Insertion Point X An x-axis coordinate of the imported PDF content location relative to the location of the current UCS. By default this property is equal to 0.0.
InsertionPointY Insertion Point Y A y-axis coordinate of the imported PDF content location relative to the location of the current UCS. By default this property is equal to 0.0.
UseProgressMeter Progress Meter A Boolean parameter that determines whether progress metering should be used during the import operation (if equal to true). By default this property is equal to true. Note that using progress metering can reduce performance.
UseGeometryOptimization Geometry Optimization A Boolean parameter that determines whether geometry optimization should be used during import (if equal to true). By default this property is equal to true. With geometry optimization turned on, objects that resemble arcs, circles, and ellipses are interpolated as such within a tolerance. Using geometry optimization can reduce operation performance.
ImportType3AsTrueTypeText Type3 to TrueType Text Conversion A Boolean parameter that determines whether text objects that use Type3 fonts are imported as objects that use TrueType fonts (false by default). It is useful to set this parameter to true when some symbols from the input PDF document are displayed incorrectly in the target database. This can happen when the PDF document uses Type3 font glyphs that the origin TrueType font does not contain.
UseRgbColor Color Import Handling A Boolean parameter that determines whether the import process uses RGB colors (if equal to true) or colors are selected from the palette are used (if the flag is equal to false). The parameter is equal to false by default.
ImportInvalidTTTextAsGeometry Import of Invalid TrueType Text A Boolean parameter that determines whether text objects that use invalid TrueType fonts are imported as polylines and solid-filled hatches (if the flag value is equal to true) or are not imported at all (if the flag value is equal to false). The parameter is equal to true by default.
UseClipping Clipping Flag A flag that determines whether clipping is used during import. By default, the flag value is equal to false.
UsePageBorderClipping A flag that determines whether clipping support is used at the border of the page. Only applies if UseClipping is switched on (false by default).
UseImageClipping A flag that determines whether image clipping is used. When turned on, images are modified during import so the clipped part of the image becomes transparent. Applies only when the UseClipping flag is switched on. By default, the flag value is equal to false.
TakeAddMeasurementFactors Additional Measurement Factors A flag that determines whether additional measurement factors are used for the PDF page (true by default).
CombineTextObjects Text Combination Flag A flag that determines whether text objects that use the same font and are on the same line are combined (false by default).
CharSpaceFactor Width of the Space between Characters Specifies the factor for the width of space between characters in words. If the distance between the text objects in the string is less than the width of the space taken from the font metric multiplied by this factor, the text objects are combined into one word. Only applies if the CombineTextObjects option is used (equal to 0.6 by default).
SpaceFactor Factor of the Width for Space Between Words Defines the factor for the width of the space between words on a line. If the distance between the text objects in the string is greater than the width of the space between characters in the word (specified by the CharSpaceFactor parameter), but less than the width of the space taken from the font metrics multiplied by this factor, the text objects are combined into one word. Only applies if CombineTextObjects is used. Equal to 1.5 by default.
UsePdfTransparency PDF Transparency A flag that determines whether transparency for geometric objects is used from a PDF stream (if true) or set to 50% for objects that are imported as solid-filled areas (if false). By default, the property is equal to false.
ImportHyperlinkMethod Hyperlink Import Method Defines how hyperlinks are imported. Accepts one of the following values:
  • 0 — Import as a hyperlink (OdDbHyperlink) belonging to an entity. Hyperlinks are assigned to entities if the hyperlink's bounding box contains an entity bounding box and the hyperlink with the smallest bounding box is selected. Other hyperlinks are ignored.
  • 1 — Hyperlinks are imported as transparent OdDbHatch objects with assigned OdDbHyperlink objects. In this case, all hyperlinks are imported over other objects and according to the draw order.
  • 2 — Mixed method. Hyperlinks are imported as in mode "0". If the hyperlink does not match the conditions of this mode, it is imported as a transparent hatch object with OdDbHyperlink objects assigned to it.
The default value is 0.
ConsiderINSUNITS INSUNITS Value Usage Flag A flag that determines whether the INSUNITS value is used during import. If the flag is equal to true, all imported object dimensions are scaled according to the INSUNITS value. By default the property is equal to false.
Type3TextDefaultFont Default Type3 Font for Text Objects Name of the default font used for importing text objects that use a Type3 font. The value can be a TrueType typeface name or a Unifont filename. By default, this property equals an empty value.
ImagePath Path for Saving Images A string parameter that contains the path to the directory where images are saved. If the property is not specified, the value of the PDFIMPORTIMAGEPATH system variable is used; if the PDFIMPORTIMAGEPATH system variable is also not specified, images are saved in the application's temporary directory. By default, the property is an empty value.
ExtractEmbeddedFonts Extract Embedded Fonts Flag A flag that determines whether embedded fonts are extracted, if possible, during the import process. By default, the flag is equal to false.
EmbeddedFontsPath Path for Embedded Font Data A string parameter that determines the path to the directory where embedded font data is extracted. If not specified, font data is saved in the application's temporary directory. By default, the property has an empty value.
TryFixUnicodeTable Fix Unicode Table Flag A flag that determines whether to fix the Unicode table for CID and Type3 fonts, if possible. By default, the flag is equal to false.

See Also

Font Handling for PDF Import
PDF Import Usage Examples
PDF Import Process
Importing PDF Files
OdPdfImport Classes
Copyright © 2002 – 2021. Open Design Alliance. All rights reserved.