ImageEn, unit imageenview




function LayersImport(const FileName: String; Stream: TStream = nil; FileFormat: TIOFileType = ioUnknown; Append: Boolean = False; PdfPage: Integer = 0): Integer;


Imports layers from a file or stream in PDF, IEV, ALL or DXF format.

Parameter Description
FileName The full path to a file to import (or '' if importing from a stream)
Stream A stream to import from (or nil if importing from file)
FileFormat The type of file, if known. It should be one ioIEV, ioALL or ioDXF. You can also specify ioUnknown, whereby ImageEn will infer the format from the content (with DXF only the file extension is considered)
Append When false the existing content is cleared before importing
PdfPage If importing from a multiple page PDF file, specify which page to import from

Result is -1 in the case of an error, otherwise returns the number of layers added.

Note: For more control over PDF importing, use AssignAsLayers

Importing from PDF
ImageEn will import the following PDF Object types:
 Images: Imported as a TIEImageLayer. Transparency may be lost for some PDF image types
 Text: Imported as a TIETextLayer. Fonts that are unavailable on the system will be substituted. Font sizes may not be correct
 Paths: Imported as a TIEPolylineLayer, or TIELineLayer if only two points. Bezier curves will be treated as lines, Alternate and Winding fills are treated as explicitly closed fills

Shading and Form objects are ignored.

Importing from IEV/ALL
IEV and ALL are object formats of TImageEnVect.
Conversion is as follows:
Object Kind Converted To Notes
iekLINE TIELineLayer -
iekBOX TIEShapeLayer -
iekELLIPSE TIEShapeLayer -
iekARC TIEPolylineLayer -
iekBITMAP TIEImageLayer -
iekTEXT TIETextLayer -
iekRULER Skipped -
iekPOLYLINE TIEPolylineLayer -
iekANGLE TIEAngleLayer -
iekMEMO TIETextLayer Text formatting is lost
iekLINELABEL TIELineLayer Inward arrows are converted to outward arrows

Importing from DXF
DXF is an Autocad vector format. DXF file can only be imported from file and only lines and ellipses objects are supported.


// Import from an PDF file (replacing the existing layers)
ImageEnView1.LayersImport( 'C:\Document.pdf' );

// Import from an PDF stream (adding to the existing layers)
ImageEnView1.LayersImport( '', myStream, ioPDF, True );

// Import from an IEV file (adding to the existing layers)
ImageEnView1.LayersImport( 'C:\Vect.iev', nil, ioIEV, True );

// Import from an IEV stream (replacing the existing layers)
ImageEnView1.LayersImport( '', myStream );

// Import from an Autocad file
ImageEnView1.LayersImport( 'C:\cad.dxf', nil, ioDXF );

See Also