Developer's Guide

Introduction

Welcome to scConverter
scConverter is a powerful component for converting plot files (PLT, HPGL, HPGL/2 and Calcomp), PDF, CGM, DWF, TIFF, PNG, JPEG, CALS and BMP files to PDF, DXF, DWF, TIF and many other formats.

You may use scConverter in any development environment that can use COM components, e.g.: Visual Basic, Visual C++, C#, ASP, ASPX, NET, Delphi and more.
The component can be used in environments not supporting COM as the DLL does export functions that can be called directly. This makes it easy to use the DLL even in a Java application. If you choose to use the exported functions directly you do not have to register the DLL.
This document describes each method, property and event available in this component.

Other topics:

Methods

AddGerberLayer

Add a Gerber layer to the control for conversion. Use this method to convert multiple layers to a single image file. When all layers are added you may use either ConvertGerberLayersToImage or ConvertGerberLayersToImageEx methods to create an image based on all layers.

SyntaxHRESULT AddGerberLayer( BSTR InputFile, OLE_COLOR Color, LONG Flags);
Parameters InputFile Name of Gerber file to add as layer.
Color Color to use for this Gerber layer during conversion.
  Flags Reserved for future use(set to 0).
Returns HRESULT Returns S_OK if file is added successfully. Any other value indicates an error, see GetLastError for more information.

CheckFile

Check if the given file can be opened by the converter.

SyntaxHRESULT CheckFile(BSTR InputFile, long *Format);
Parameters InputFile Name of the file to check.
Format Returned file format identifier if file can be opened by this converter.
One of the following values is returned:
  1. Unknown file format
  2. HPGL/2
  3. TIFF
  4. CALS
  5. PNG
  6. JPEG
  7. Windows BMP
  8. CGM (Computer Graphics Metafile)
  9. Calcomp Plot Format
  10. Autodesk DWF
  11. Gerber Plot Format
  12. Adobe PDF
  13. WebP Image Format
  14. GIF Image Format
Returns HRESULT Returns S_OK if this file can be opened by the converter.

ClearGerberLayers

Unload all added Gerber layers from the memory.

SyntaxHRESULT ClearGerberLayers();
Parameters None
Returns HRESULT Returns S_OK if successful. Any other value indicates an error, see GetLastError for more information.

CloseFileEx

Close a file previously opened by OpenFileEx.

SyntaxHRESULT CloseFileEx(LONG Handle);
Parameters Handle Handle for the file to close.
Returns HRESULT This function returns S_OK if successful.

Convert

Convert the input file to a new file using the given format.

SyntaxHRESULT Convert(BSTR inputFileName, BSTR outputFileName, BSTR Format, double Scale, long BitsPixel, long DPI);
Parameters inputFileName Name of file to convert.
outputFileName Name of destination file.
  Format Select output format to use.
The following formats are supported:
  • BMP (Windows Bitmap)
  • CALS (CALS Type 1 CCITT-G4 Raster Format)
  • CGM (Computer Graphics Metafile)
  • DWF (Drawing Web Format)
  • DXF (AutoDesk Drawing Exchange Format)
  • EMF (Windows Enhanced Metafile)
  • GBR (Gerber RS274X)
  • HPRTL(HP-RTL)
  • JPEG (JFIF Compliant)
  • PCX (Paintbrush Format)
  • PDF (Acrobat PDF)
  • PDFRASTER (Acrobat PDF raster).
  • PNG (Portable Network Graphics)
  • PS (Adobe Postscript)
  • SVG (Scalable Vector Format)
  • TIFF (Tagged Image File Format)
  • WEBP (Google Image Format)
  • WMF (Windows Metafile)
  Scale Scale factor.
  BitsPixel Bits Per Pixel (Used for raster only).
  DPI Pixels per Inch (Used for raster only).
Returns HRESULT Returns S_OK if file is created successfully. Any other value indicates an error, see GetLastError for more information.

ConvertFileEx

Convert a single page, or all pages, from the input file into a new file using the given format.

SyntaxHRESULT ConvertFileEx( LONG Handle, BSTR outputFileName, BSTR Format, long Page, double Scale, long BitsPixel, long DPI);
Parameters inputFileName Name of file to convert.
Handle Handle returned by OpenFileEx.
  Format Select output format to use.
The following formats are supported:
  • BMP (Windows Bitmap)
  • CALS (CALS Type 1 CCITT-G4 Raster Format)
  • CGM (Computer Graphics Metafile)
  • DWF (Drawing Web Format)
  • DXF (AutoDesk Drawing Exchange Format)
  • EMF (Windows Enhanced Metafile)
  • GBR (Gerber RS274X)
  • HPRTL(HP-RTL)
  • JPEG (JFIF Compliant)
  • PCX (Paintbrush Format)
  • PDF (Acrobat PDF)
  • PDFRASTER (Acrobat PDF raster).
  • PNG (Portable Network Graphics)
  • PS (Adobe Postscript)
  • SVG (Scalable Vector Format)
  • TIFF (Tagged Image File Format)
  • WEBP (Google Image Format)
  • WMF (Windows Metafile)
  Page Index of the page to extract from the input file, and convert to a new output file. First page number is 0 (zero indexed).
Set to -1 to convert all pages in the document.
  Scale Scale factor.
  BitsPixel Bits Per Pixel (Used for raster only).
  DPI Pixels per Inch (Used for raster only).
Returns HRESULT Returns S_OK if file is created successfully. Any other value indicates an error, see GetLastError for more information.

ConvertGerberLayersToImage

Convert all loaded Gerber layers to a new image file of the given file format.
To be able to use this method one or more Gerber files must have previously been added as layers using the AddGerberLayer method.
Use the BackgroundColor property to change the image background color.
The image width and height will automatically be calculated based on the input file and given scale factor.

SyntaxHRESULT ConvertGerberLayersToImage( BSTR OutputFile, BSTR Format, DOUBLE ScaleFactor, LONG BitsPerPixel, LONG DPI, LONG Flags, double *ImageW, double *ImageH );
OutputFile Name of destination file.
  Format Select output format to use.
The following formats are supported by this method:
  • BMP (Windows Bitmap)
  • CALS (CALS Type 1 CCITT-G4 Raster Format)
  • JPEG (JFIF Compliant)
  • PCX (Paintbrush Format)
  • PDF (Acrobat PDF)
  • PDFRASTER (Acrobat PDF raster).
  • PNG (Portable Network Graphics)
  • TIFF (Tagged Image File Format)
  ScaleFactor Scalefactor to use for conversion, 1.0 is original size.
  lBitsPixel Bits Per Pixel.
  DPI Pixels per Inch.
  Flags Reserved (set to 0).
  ImageW Returns the width of the created image in millimeters.
  ImageH Returns the height of the created image in millimeters.
Returns HRESULT Returns S_OK if file is created successfully. Any other value indicates an error, see GetLastError for more information.

ConvertGerberLayersToImageEx

Convert all loaded Gerber layers to a new image. To be able to use this method you will need to add one or more Gerber layers using the AddGerberLayer method.
Use the BackgroundColor property to change the image background color.
The image width and height will automatically be calculated based on the input files and given scale factor.

SyntaxHRESULT ConvertGerberLayersToImageEx( DOUBLE ScaleFactor, LONG BitsPerPixel, LONG DPI, LONG Flags, IPictureDisp** Picture);
  ScaleFactor Scalefactor to use for conversion, 1.0 is original size.
  lBitsPixel Bits per pixel. Supported values include 1, 4, 8 and 24.
  DPI Pixels per Inch. This will controls the resolution of the image, a high value gives better quality but consumes more memory.
  Flags Reserved (set to 0).
  Picture The returned image (IDispatch)
Returns HRESULT Returns S_OK if file is created successfully. Any other value indicates an error, see GetLastError for more information.

ConvertPage

Convert a single page from the input file into a new file using the given format.

SyntaxHRESULT ConvertPage(BSTR inputFileName, BSTR outputFileName, BSTR Format, long Page, double Scale, long BitsPixel, long DPI);
Parameters inputFileName Name of file to convert.
outputFileName Name of destination file.
  Format Select output format to use.
The following formats are supported:
  • BMP (Windows Bitmap)
  • CALS (CALS Type 1 CCITT-G4 Raster Format)
  • CGM (Computer Graphics Metafile)
  • DWF (Drawing Web Format)
  • DXF (AutoDesk Drawing Exchange Format)
  • EMF (Windows Enhanced Metafile)
  • GBR (Gerber RS274X)
  • HPRTL(HP-RTL)
  • JPEG (JFIF Compliant)
  • PCX (Paintbrush Format)
  • PDF (Acrobat PDF)
  • PDFRASTER (Acrobat PDF raster).
  • PNG (Portable Network Graphics)
  • PS (Adobe Postscript)
  • SVG (Scalable Vector Format)
  • TIFF (Tagged Image File Format)
  • WEBP (Google Image Format)
  • WMF (Windows Metafile)
  Page Index of the page to extract from the input file, and convert to a new output file. First page number is 0 (zero indexed).
  Scale Scalefactor.
  BitsPixel Bits Per Pixel (Used for raster only).
  DPI Pixels per Inch (Used for raster only).
Returns HRESULT Returns S_OK if file is created successfully. Any other value indicates an error, see GetLastError for more information.

ConvertPageToImage

Convert a single page from the input file into a memory image.

SyntaxHRESULT ConvertPageToImage(BSTR inputFileName, long Page, double Scale, long BitsPixel, long DPI, IPictureDisp** Picture);
Parameters inputFileName Name of file to convert.
  Page Index of the page to convert into an image. First page number is 0 (zero indexed).
  Scale Scalefactor.
  BitsPixel Bits Per Pixel (Used for raster only).
  DPI Pixels per Inch (Used for raster only).
  Picture The returned image (IDispatch)
Returns HRESULT Returns S_OK if the image was created successfully. Any other value indicates an error, see GetLastError for more information.

ConvertPageToImageEx

Convert a single page from an already loaded file into a memory image.

SyntaxHRESULT ConvertPageToImage(LONG Handle, long Page, double Scale, long BitsPixel, long DPI, IPictureDisp** Picture);
Parameters Handle File handle returned by OpenFileEx.
  Page Index of the page to convert into an image. First page number is 0 (zero indexed).
  Scale Scalefactor.
  BitsPixel Bits Per Pixel (Used for raster only).
  DPI Pixels per Inch (Used for raster only).
  Picture The returned image (IDispatch)
Returns HRESULT Returns S_OK if the image was created successfully. Any other value indicates an error, see GetLastError for more information.

ConvertToImageFile

Convert the input file to a new image file of the given file format.
This method gives better control of the created image that can be very useful for Gerber to image conversion.

SyntaxHRESULT ConvertToImageFile( BSTR InputFile, BSTR OutputFile, BSTR Format, LONG Page, DOUBLE ScaleFactor, LONG ImageWidth, LONG ImageHeight, LONG BitsPerPixel, LONG DPI, LONG Flags, DOUBLE OffsetX, DOUBLE OffsetY );
Parameters InputFile Name of file to convert.
OutputFile Name of destination file.
  Format Select output format to use.
The following formats are supported by this method:
  • BMP (Windows Bitmap)
  • CALS (CALS Type 1 CCITT-G4 Raster Format)
  • JPEG (JFIF Compliant)
  • PCX (Paintbrush Format)
  • PDF (Acrobat PDF)
  • PDFRASTER (Acrobat PDF raster).
  • PNG (Portable Network Graphics)
  • TIFF (Tagged Image File Format)
  Page Page number to convert to image.
  ScaleFactor Scalefactor to use for conversion, 1.0 is original size.
  ImageWidth Width of the destination image file in pixels.
  ImageHeight Height of the destination image file in pixels.
  lBitsPixel Bits Per Pixel.
  DPI Pixels per Inch.
  Flags Reserved (set to 0).
  OffsetX Left offset in pixels.
  OffsetY Top offset in pixels.
Returns HRESULT Returns S_OK if file is created successfully. Any other value indicates an error, see GetLastError for more information.

ConvertToPaperSize

Convert the input file to a new file using the given format and selected paper size.

SyntaxConvertToPaperSize(BSTR InputFile, BSTR OutputFile, BSTR Format, LONG PaperSizeIndex, BOOL KeepPaper, LONG Page, LONG BitsPerPixel, LONG DPI);
Parameters inputFileName Name of file to convert.
outputFileName Name of destination file.
  Format Select output format to use.
The following formats are supported:
  • BMP (Windows Bitmap)
  • CALS (CALS Type 1 CCITT-G4 Raster Format)
  • CGM (Computer Graphics Metafile)
  • DWF (Drawing Web Format)
  • DXF (AutoDesk Drawing Exchange Format)
  • EMF (Windows Enhanced Metafile)
  • GBR (Gerber RS274X)
  • HPRTL(HP-RTL)
  • JPEG (JFIF Compliant)
  • PCX (Paintbrush Format)
  • PDF (Acrobat PDF)
  • PDFRASTER (Acrobat PDF raster).
  • PNG (Portable Network Graphics)
  • PS (Adobe Postscript)
  • SVG (Scalable Vector Format)
  • TIFF (Tagged Image File Format)
  • WEBP (Google Image Format)
  • WMF (Windows Metafile)
  PaperSizeIndex The index of the predefined paper size to use for conversion.
The output file will be scaled to fit the selected paper size.
The following paper sizes are supported:

IndexPaper size
0ISO A0 (841 x 1189 mm)
1ISO A1 (594 x 841 mm)
2ISO A2 (420 x 594 mm)
3ISO A3 Extra (322 x 445 mm)
4ISO A3 (297 x 420 mm)
5ISO A4 Extra (236 x 322 mm)
6ISO A4 Plus (210 x 330 mm)
7ISO A4 (210 x 297 mm)
8ISO A5 Extra (174 x 235 mm)
9ISO A5 (148 x 210 mm)
10ISO A6 (105 x 148 mm)
11ISO B0 (1000 x 1414 mm)
12ISO B1 (707 x 1000 mm)
13ISO B2 (500 x 707 mm)
14ISO B3 (353 x 500 mm)
15ISO B4 (250 x 353 mm)
16ISO B5 Extra (201 x 276 mm)
17ISO B5 (176 x 250 mm)
18ISO B6 (125 x 176 mm)
19ISO C6 (162 x 229 mm)
20Engineering A (8.5 x 11 inch)
21Engineering B (11 x 17 inch)
22Engineering C (17 x 22 inch)
23Engineering D (22 x 34 inch)
24Engineering E (34 x 44 inch)
25Architectural A (9 x 12 inch)
26Architectural B (12 x 18 inch)
27Architectural C (18 x 24 inch)
28Architectural D (24 x 36 inch)
29Architectural E (36 x 48 inch)
30Architectural E2(30 x 42 inch)
31Letter (8.5 x 11 inch)
32Legal (8.5 x 14 inch)
33Tabloid (11 x 17 inch)
34Slide (11 x 7.33 inch)
35Ledger (17 x 11 inch)
36Executive (7.25 x 10.5 inch)
37Statement (5.5 x 8,5 inch)
38ISO A1F (594 x 1189 mm)
39ISO A3F (297 x 594 mm)
  KeepPaper If enabled margins will be added if necessary, to make sure the output uses the exact paper size.
  Page Page number to convert. Page numbering starts at 0. Set this parameter to -1 convert all pages in a multi-page document.
  BitsPixel Bits Per Pixel (Used for raster output only).
  DPI Pixels per Inch (Used for raster output only).
Returns HRESULT Returns S_OK if file is created successfully. Any other value indicates an error, see GetLastError for more information.

ConvertToPaperSizeEx

Convert the input file to a new file using the given format and selected paper size.

SyntaxHRESULT ConvertToPaperSizeEx(LONG Handle, BSTR OutputFile, BSTR Format, LONG PaperSizeIndex, VARIANT_BOOL KeepPaper, LONG Page, LONG BitsPerPixel, LONG DPI);
Parameters Handle Handle returned by OpenFileEx.
This function is equal to ConvertToPaperSize, except for the handle parameter.
Please see ConvertToPaperSize for a description of the other parameters.
Returns HRESULT Returns S_OK if file is created successfully. Any other value indicates an error, see GetLastError for more information.

GerberFormatSettings

Change settings that are needed to load RS-274D Gerber files correctly.

SyntaxHRESULT GerberFormatSettings(VARIANT_BOOL bIncremental, long lPreceding, long lSucceeding, long lUnits, VARIANT_BOOL bLeading, VARIANT_BOOL bTrailing);
Parameters bIncremental If true the Gerber files contains incremental coordinates. Set to false for absolute coordinates.
  lPreceding Number of digits before decimal point.
  lSucceeding Number of digits after decimal point.
  lUnits Units used in Gerber file. Set to 0 for Inch and 1 for Milimeters.
  bLeading Leading zeros suppressed if set to true.
  bTrailing Trailing zeros suppressed if set to true.
Returns long This function returns S_OK if successful.

GetFileDimensions

Return dimensions of the given page in the given file.
All returned values are in millimeters.

SyntaxHRESULT GetFileDimensions( BSTR InputFile, long Page, double *OffsetX, double *OffsetY, double *Width, double *Height );
Parameters InputFile Full path to the file to inspect.
Page Selected page number.
OffsetX Original file x offset of the selected page.
OffsetY Original file y offset of the selected page.
Width Width of the selected page.
Height Height of the selected page.
Returns HRESULT This function returns S_OK if successful.

GetFileDimensionsEx

Return dimensions of the given page in the given file.
All returned values are in millimeters.

SyntaxHRESULT GetFileDimensionsEx( LONG Handle, LONG Page, double *OffsetX, double *OffsetY, double *Width, double *Height );
Parameters Handle Handle returned by OpenFileEx.
Page Selected page number.
OffsetX Original file x offset of the selected page.
OffsetY Original file y offset of the selected page.
Width Width of the selected page.
Height Height of the selected page.
Returns HRESULT This function returns S_OK if successful.

GetFileRasterInfoEx

Return dimensions, bits per pixel and resolution of selected page in an already opened file.

SyntaxHRESULT GetFileRasterInfoEx(LONG Handle, LONG Page, LONG *Width, LONG *Height, LONG *BitsPerPixel, LONG *DPI );
Parameters Handle Handle returned by OpenFileEx.
Page Selected page number.
Width Width of raster page in pixels.
Height Height of raster page in pixels.
BitsPerPixel Returned bits per pixel used for selected page.
DPI Returned resolution for selected page.
Returns HRESULT This function returns S_OK if successful.

GetFormatEx

Return format identifier for given file handle.

SyntaxHRESULT GetFormatEx( LONG Handle, LONG *Format);
Parameters Handle Handle for which format identifier should be returned. The handle must be previously returned by OpenFileEx
Format Returned file format identifier.
One of the following values is returned:
  1. HPGL/2
  2. TIFF
  3. CALS
  4. PNG
  5. JPEG
  6. Windows BMP
  7. CGM (Computer Graphics Metafile)
  8. Calcomp Plot Format
  9. Autodesk DWF
  10. Gerber Plot Format
  11. Adobe PDF
  12. WebP Image Format
  13. GIF Image Format
Returns HRESULT Returns S_OK if no error occured.

GetNumFilePages

Returns the number of pages in the given file.

SyntaxHRESULT GetFileDimensions( BSTR InputFile, long *Pages);
Parameters InputFile Full path to the file to inspect.
Pages Returns number of pages in the given file.
Returns HRESULT This function returns S_OK if successful.

GetNumFilePagesEx

Returns the number of pages in the given file.

SyntaxHRESULT GetFileDimensionsEx( LONG Handle, long *Pages);
Parameters Handle Handle returned by OpenFileEx.
Pages Returns number of pages in the given file.
Returns HRESULT This function returns S_OK if successful.

GetPageThumbnailEx

Returns a thumbnail image for the given page and file handle.
You may alos take a look at the C# scPDFMerge sample too see how this method is used.

SyntaxLONG GetPageThumbnailEx(LONG Handle, LONG Page, LONG Width, LONG Height, LONG BitsPerPixel, IPictureDisp** Thumbnail);
Parameters Handle Handle to file returned by OpenFileEx
  Page Page number to create a thumbnail of (first page is index 0)
  Width Width of thumbnail image in pixels
  Height Height of thumbnail image in pixels
  BitsPerPixel The bits per pixel controls number of colors to use in the thumbnail image. Set this value to 1 for a monochrome (black & white) image, or 24 for a true color image.
  Thumbnail The returned image (IDispatch)
Returns long TRUE if success.

GetPenTableEntry

Return width, color and style for the given pen table entry.
Please see the SetPenTableEntry method for descritpion of the returned values.

SyntaxHRESULT GetPenTableEntry(long Pen, double Width, long Color, long LineStyle, long EndStyle);
Parameters Pen Pen number.
  Width Returned pen width.
  Color Returned pen color.
  LineStyle Returned pen linestyle.
  EndStyle Returned pen endstyle.
Returns HRESULT This function returns S_OK if successful.

LoadPenTable

Load a ViewCompanion compatible pen table file.

SyntaxHRESULT LoadPenTable(BSTR pFileName);
Parameters FileName Name of pentable file to load.
Returns HRESULT This function returns S_OK if successful.

OpenFileEx

Open a file and keep it open for as long as needed.
This method will return a handle that may be uses by other methods to perform different tasks.
When you've done with the file it should be closed by using the CloseFileEx method.

SyntaxHRESULT OpenFileEx(BSTR FileName, LONG* Handle);
Parameters FileName Full name of file to open.
  Handle Returned file handle.
Returns HRESULT This function returns S_OK if successful.

PDFEncrypt

Encrypt a PDF file using password(s) and restriction settings.

SyntaxHRESULT PDFEncrypt(BSTR OriginalFile, BSTR EncryptedFile, BSTR OpenPassword, BSTR OwnerPassword, LONG Restrictions);
Parameters OriginalFile The original PDF file you want to create an encrypted copy of.
  EncryptedFile The encrypted PDF file. This will be an exact copy of the orignal file but encrypted.
  OpenPassword Optional password required to open the file.
  OwnerPassword Optional owner password.
  Restrictions Set optional user restrictions for the encrypted PDF file.
The following values are available:
  1. No restrictions.
  2. Deny printing.
  3. Deny modification of contents.
  4. Deny copying of contents.
  5. Deny commenting.
  6. Deny all.
The settings may be combined, e.g. set it to 20 (4+16) to deny printing and copying.
Returns HRESULT This function returns S_OK on success.

PDFMergeAddFile

Add a PDF file to the currently merged PDF file.
All pages from the given PDF file will be added to the merged output file.
PDFMergeInit must be called before any PDF file is added.

SyntaxHRESULT PDFMergeAddFile(BSTR PDFFileName);
Parameters PDFFileNameFull path name to the PDF file to add to the currently merged PDF.
Returns HRESULT Returns S_OK if successful. Any other value indicates an error, see GetLastError for more information.

PDFMergeAddFileEx

Add a PDF file to the currently merged PDF file.
The PageInformation parameter controls which pages from the given PDF file that will be added to the merged output file. PDFMergeInit must be called before any PDF file is added.

SyntaxHRESULT PDFMergeAddFile(BSTR PDFFileName, BSTR PageInformation);
Parameters PDFFileNameFull path name to the PDF file to add to the currently merged PDF.
  PageInformationControl which pages that should be imported from the given PDF file. Use ";" to separate pages, e.g.: setting PageInformation to "1,2,10,11" will import pages 1,2,10 and 11 and add to the merged PDF file.
Returns HRESULT Returns S_OK if successful. Any other value indicates an error, see GetLastError for more information.

PDFMergeClose

Close the currently merged PDF file and output to given file name.

SyntaxHRESULT PDFMergeClose(BSTR PDFOutputName);
Parameters PDFOutputNameFull path name of the new PDF file to create.
Returns HRESULT Returns S_OK if successful. Any other value indicates an error, see GetLastError for more information.

PDFMergeInit

Start a new empty PDF file prepared for merging.
Use PDFMergeAddFile to add files, and finally call PDFMergeClose to complete the merge.

SyntaxHRESULT PDFMergeInit();
Parameters None
Returns HRESULT Returns S_OK if successful. Any other value indicates an error, see GetLastError for more information.

PDFSplit

Split a multi-page PDF file into smaller files based on user settings.

SyntaxHRESULT PDFSplit(BSTR InputFile, BSTR OutputFolder, BSTR FileLabel, LONG PagesPerFile);
Parameters InputFile The multi-page PDF file that will be split into smaller files.
  OutputFolder A valid folder name for the output files.
  FileLabel Optional label to add to output filenames. By default the output files will be named "inputfilename_1.pdf", "inputfilename_2.pdf" and so on. By adding "part" as label, the output files will be named "inputfilename__part_1.pdf", "inputfilename__part_2.pdf" and so on.
  PagesPerFile Number of pages per output file. If the input document contains 20 pages and you set page per file to 1, the control will create 20 files. If you set pages per file to e.g. 2, the control will output 10 files with 2 pages each.
Returns HRESULT This function returns S_OK on success.

PDFToCAD

Convert a PDF file to an editable vector format file, for example Autodesk DXF.

SyntaxHRESULT PDFToCAD( BSTR InputFileName, BSTR OutputFileName, BSTR Format, long PageNo );
Parameters InputFileName Name of the PDF file to convert.
  OutputFileName Name of the exported vector file..
  Format Export format to use for conversion. Supported formats:
  • CGM (Computer Graphics Metafile)
  • DWF (Drawing Web Format)
  • DXF (Autodesk Drawing Exchange Format)
  • GBR (Gerber RS274X)
  • PLT (HPGL/2)
  • SVG (Scalable Vector Format)
  PageNo PDF page that will converted to vector format.
  OutputFileName Name of the exported vector file.
Returns HRESULT This function returns S_OK on successn.

SaveThumbnailEx

Saves the thumbnail for the given page and file handle to an image file.

SyntaxHRESULT SaveThumbnailEx(LONG Handle, LONG Page, LONG Width, LONG Height, LONG BitsPerPixel, BSTR Format, BSTR OutputFile);
Parameters Handle Handle to file returned by OpenFileEx
  Page Page number to create a thumbnail of (first page is index 0)
  Width Width of thumbnail image in pixels
  Height Height of thumbnail image in pixels
  BitsPerPixel The bits per pixel controls number of colors to use in the thumbnail image. Set this value to 1 for a monochrome (black & white) image, or 24 for a true color image.
  Format The file format to use for the thumbnail image file. The following format identifiers are accepted:
  • JPEG
  • PDF
  • PNG
  • TIFF
  OutputFile Name of the thumbnail image file
HRESULT long S_OK if success.

SetSerialNumber

Use this function to unlock the component to use all it's functionality.
You will get your own this serialnumber when You purchase a developer license.

SyntaxHRESULT SetSerialNumber( BSTR SerialNumber);
Parameters SerialNumber Serial number to unlock control.
Returns HRESULT This function returns S_OK if a correct serial number is given.

SetPenTableEntry

Set width, color, linestyle and line endstyle for the given pen table entry.

SyntaxHRESULT SetPenTableEntry(long Pen, double Width, long Color, long LineStyle, long EndStyle);
Parameters Pen Pen number.
  Width Pen Width in millimeters.
  crColor Pen Color (Windows COLORREF). The color value has the following hexadecimal form: 0x00bbggrr.
  LineStyle The following styles are supported:
#define PS_SOLID       0
#define PS_DASH        1   /* -------  */
#define PS_DOT         2   /* .......  */
#define PS_DASHDOT     3   /* _._._._  */
#define PS_DASHDOTDOT  4   /* _.._.._  */
  EndStyle The following line end styles are supported:
  1. Round style (same as GDI PS_ENDCAP_ROUND)
  2. Butt style (same as GDI PS_ENDCAP_FLAT)
  3. Square style (same as GDI PS_ENDCAP_SQUARE)
Returns HRESULT This function returns S_OK on success.

SetTIFFCompression

Set compression types to use for exported TIFF files.

SyntaxHRESULT SetTIFFCompression( LONG Monochrome, LONG Color, LONG TrueColor );
Parameters Monochrome Set compression type to use for monochrome, 1-bit, files. Supported values:
ValueCompression method
1No compression
4CCITT Group 4 Fax
5LZW
8Deflate Compression (ZIP)
32773Packbits
32946Deflate (same as 8)
  Color Set compression type to use for color, 4-bit and 8-bit, files. Supported values:
ValueCompression method
1No compression
5LZW
8Deflate Compression (ZIP)
32773Packbits
32946Deflate (same as 8)
  TrueColor Set compression type to use for true color, 24-bit, files. Supported values:
ValueCompression method
1No compression
5LZW
7JPEG
8Deflate Compression (ZIP)
32773Packbits
32946Deflate (same as 8)
Returns HRESULT This function returns S_OK if success.

TextExtractEx

Extract text from an already open document.

SyntaxHRESULT TextExtractEx(LONG Handle, LONG Page, BSTR *Text);
Parameters Handle Handle returned by OpenFileEx.
  Page Page number to extract text from. First page is 0 (zero index).
  Text Extracted text.
Returns HRESULT This function returns S_OK if text was extracted from the document.

TIFFSplit

Split a multi-page TIFF file into multiple single paged files (one per page).

SyntaxHRESULT TIFFSplit(BSTR InputFile, BSTR OutputFolder, BSTR FileLabel );
Parameters InputFile The multi-page TIFF file that will be split into smaller files.
  OutputFolder A valid folder name for the output files.
  FileLabel Optional label to add to output filenames. By default the output files will be named "inputfilename_1.tif", "inputfilename_2.tif" and so on. By adding "part" as label, the output files will be named "inputfilename__part_1.tif", "inputfilename__part_2.tif" and so on.
Returns HRESULT This function returns S_OK if success.


Properties

BackgroundColor
Set the background color that will be used for the converted files. This property accepts a COLORREF (Windows RGB) value.
Default Value : 0x00FFFFFF (white)

DWFLoadMarkup
If set to 1 (true) markup created by Autodesk Design Review will be loaded and included in the conversion.
Set to 0 to ignore markup created by Design Review.
Default Value : 1

DWFUsePaperSize
If set to 1 (true) all DWF files will be loaded using paper size if this is available, else the file will be loaded with drawing extents.
Default Value : 1

DXFForceLineLW
If set to non-zero all line elements will be written as LWPolyline instead of Line. This will increase file size, but makes it possible to write lines with width..
Default Value : 1

DXFIgnoreWhiteAreas
If set to non-zero, all filled white areas will be ignored when the DXF files is written. This may be useful if you're converting PDF files to DXF because white areas may give problems in AutoCAD.
Default Value : 0

DXFWriteMM
If enabled all DXF files be written using coordinates in millimeter. If disabled DXF files will use Inch coordinates.
Default Value : Depends on system regional settings

GerberApertureFileName
Set filename for an Gerber aperture table to be used when loading RS274D Gerber data.
Default Value : none

GetLastError
Retrieves the component's last-error code value.
Possible error codes:

  1. No error.
  2. Unknown format.
  3. Can't create file. Possible reasons could be security settings or out of disk space.
  4. No license available. No serial number given and the evaluation time (30 days) have expired.
  5. Out of memory. Not enough memory available to complete the conversion.
  6. File read error. Could not load the file.

ImportersPath
Set path to where the additional file importers are located.

MonochromeMode
Enable or disable monochrome export. If set to non-zero the converted files will only contain black and white graphics.
Default Value : 0

PDFHighPrecision
Enable or disable creation of high resolution PDF files. If set to non-zero, all coordinates will be written using 4 decimals to give higher accuracy. If this option is disabled 2 decimals will be used for coordinates. High resolution will increase file size.
Default Value : TRUE

PDFLargeFormat
Enables or disables creation of large format PDF files (up to 60x60 meters).
Default Value : TRUE

PDFLayers
Enable or disable creation of layered PDF files. If set to non-zero, pens will be mapped to PDF layers.
Default Value : 1

PDFMonoRasterCompression
Select the compression method to use for monochrome (1-bit) raster images in exported PDF files.
Following compression methods are available:

  1. Deflate.
  2. CCITT Group 4.
  3. JBIG2.
Default Value : 0

PDFSearchable
Enable or disable creation of searchable PDF files. If this option is enabled and the original file contains text, the converted PDF file will be searchable.
Default Value : FALSE

PDFTransparency
Enable or disable use of transparency in exported PDF files.Some printer drivers doesn't support transparency, and turning off transparency for exported PDF files may make your files print faster.
Default Value : TRUE

PDFWriterFormat
Select PDF standard to use for converted files, following options is available:

  1. Create an editable PDF file (version 1.6).
  2. create a PDF/A file for archiving. PDF/A files are write-protected and cannot be edited.
Default Value : 1 (PDF/A)

PLTEncoded
Enable or disable encoded polylines (PE instruction) in exported PLT (HPGL/2) files. Files with encoded polyline are smaller (compressed).
Default Value : 1 (Use encoded polygons)

TIFFSingleStrip
Enable or disable creation of single-strip TIFF files. By default the component will create multi-strip files.
Single-strip files are usually smaller (in terms of file size) than multi-strip files. A multi-strip file may however have some advantages (depends on application):

Set to 1 (true) to create single-strip TIFF files.
Default Value : 0

UsePenTable
Enable or disable the pen table settings. If set to non-zero the converted files be converted using the current pen table settings.
Pen tables are supported for PLT (HPGL, HPGL/2 and Calcomp), CGM and DWF file formats.
Default Value : 0