Declaration
function LayersImport(const FileName: String; Append: Boolean = False; PdfPage: Integer = 0): Integer; overload;
function LayersImport(const FileName: String; Stream: TStream; FileFormat: TIOFileType = ioUnknown; Append: Boolean = False; PdfPage: Integer = 0): Integer; overload;
Description
Imports layers from a file or stream in SVG, PDF, PSD, 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:
◼Formats that are not specifically supported, such as JPEG or GIF, will be loaded/appended normally
◼For more control over PDF importing, use
AssignAsLayers
Importing from SVG
ImageEn will import the following SVG tag types:
◼Images: Imported as a
TIEImageLayer
◼Text: Imported as a
TIETextLayer. TSpans are not supported
◼Lines: Imported as a
TIELineLayer
◼Paths, Polygons and Polylines: Imported as a
TIEPolylineLayer
◼Circles, Ellipses and Rects: Imported as a
TIEShapeLayer
Other tag types, and some properties are not supported. Configuration options are specified by
SVGParams. Also see:
SVG Implementation Status
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 PhotoShop (PSD)
ImageEn will import all layers from a PSD file as
image layers. Using
LayersImport with PSD files is the same as calling
LoadFromFilePSD with
PSD_LoadLayers enabled (and optionally
PSD_ReplaceLayers if Append is true).
Importing from IEV/ALL
IEV and ALL are object formats of
TImageEnVect.
Conversion is as follows:
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
◼CopyAllObjectsTo
◼LoadFromFileIEN
◼LoadFromStreamIEN
◼AsSVG
◼SVG Implementation Status