Automate Scan2CAD

Scan2CAD’s Automation feature (available on the Scan2CAD Business package) allows users to control almost any feature of the software using a simple API.

Scan2CAD Automation gives users the ability to run processes on thousands of files in a few clicks (batch conversion) or integrate Scan2CAD’s technology with their solution. The possibilities are endless.

How to run Automation

Automating Scan2CAD couldn’t be easier. Follow these three steps:

  1. Create a script file. This file must have the extension .s2c 
  2. Add the required processes to the script. See below for a full list of commands.
  3. Execute the Scan2CAD application and the script. This can be done using a single-line command.

Example execution command:

Windows (via Command Prompt)

  C:\Program Files\Scan2CAD.exe C:\Users\user\Desktop\script.s2c

MacOS (via Terminal)

/Applications/ /Users/username/Desktop/script.s2c

Example scripts

Scan2CAD Python API


Extract raster images from PDF files:

in_dir = "path/to/input_directory"
pdfs = s2c.list(in_dir, "pdf")
for p in pdfs:
    pp =, s2c.join(in_dir, p.get_name()))

Vectorize images in a directory:

in_dir = "path/to/input_directory"
preset = s2c.Preset()
imgs = s2c.list(in_dir, "png")
for i in imgs:     
    r =
    v = r.vectorize(preset)

List of classes

Classes used for accessing files

class s2c.FilePath(path)

Holds file’s path. Use this to load files with open() method.

Currently, we support three types of files: Raster(), Vector(), PDF().

open() → s2c.File Returns File object that opens the file at the path provided during initialization
get_path() Returns path provided during initialization (can be relative or absolute)
get_absolute_path() Returns absolute path
get_full_name() Returns name with extension
get_name() Returns name without extension
get_type() Returns file extension

class s2c.File(path)

Base class for all file types that are supported

class s2c.Raster(path: s2c.FilePath)

Class representing raster files

threshold(value=127) Applies threshold raster effect on this image
rotate90(clockwise=True) Rotates raster image by 90 degrees in the requested direction
remove_speckles_and_holes(speckle_size, hole_size) Applies raster effect: remove speckles and holes
smooth() Applies raster effect: smooth
save(path=None) Saves this raster image under the given path
vectorize(preset) → s2c.Vector Vectorizes this image and returns Vector() object

class s2c.Vector(path)

Class representing vector files

scale(length_in_pixels, length_in_unit, unit: s2c.Unit) Sets vector scale in the requested unit
save(path=None) Saves this vector image under the given path

class s2c.PDF(path)

Class representing PDF files

Loads PDF file using provided FilePath instance

save(type, path) Saves PDF file in one of the supported formats, see FileType() class


class s2c.list(path, extension=”)

Lists files in the directory.


  • extension – can be a string or a list of strings.

class s2c.join(path, *paths)

Joins paths together using platform-specific path separators

class s2c.PDFsInDirToDxfs(in_dir, out_dir)

Extracts vector data in DXF format from all PDF files in the directory

class s2c.FileType

Enumeration with all types supported by FilePath and File (Raster, Vector, PDF)

  • RASTER = 0
  • VECTOR = 1
  • PDF = 2

class s2c.Preset

The structure used to define settings used in vectorization

In order to change advanced settings, modify these members:

  • self.technical,
  • self.ocr,
  • self.outline,
  • self.solid.
class Method Technical = 1
Outline = 2
Solid = 3
class Option Vectorize = 1
OCR = 2
VectorizeOCR = 3
class Predefined Architectural = 1
Electrical = 2
Mechanical = 3
CNCProfile = 4
SitePlan = 5
ContourMap = 6
Sketch = 7
Outline = 8
class Languages English = 1
German = 2
French = 3
Italian = 4
Japanese = 5
JapaneseEnglish = 6
Polish = 7
Spanish = 8
class Technical The structure holding additional settings for Technical vectorization
polyline_identification = False
line_width = 14
line_deviation_factor = 2.2
arc_identification = True
arc_min_radius = 6
bezier_identification = False
circle_identification = True
circle_radius = 6
arrow_identification = True
arrow_max_head_length = 64
dash_line_identification = True
dash_line_max_length = 45
dash_line_max_gap = 45
hatch_identification = True
hatch_angle = 45
hatch_angle_tolerance = 12
orthogonal_snap = True
orthogonal_snap_tolerance = 8
snap_to_30 = False
snap_to_45 = False
snap_to_60 = False
snap_to_120 = False
snap_to_135 = False
snap_to_150 = False
snap_tolerance = 8
corner_snap = 8
corner_snap_tolerance = 6
pass_thro_snap = 3
gap_jump_distance = 4
loose_ends_length = 7
connect_thro_vectors = True
class OCR Structure holding additional settings for OCR
char_size_max = 75
char_size_min = 9
recognition = 60
exclude_intersecting = True
vertical = False
angular = False
document_is_only_text = False
class Outline Structure holding additional settings for Outline vectorization
class Types Bezier = 1
PolyBezier = 2
Polyline = 3
LinesArcs = 4
class Bias Angular = 1
Curves = 2
definition = 20
bias_orthogonal = False
bias = 2
type = 4
class Solid Structure holding additional settings for Solid vectorization
class Types Polygon = 1
PolyBezier = 2
class Bias Angular = 1
Curves = 2
definition = 5
identify_circles = True
bias_orthogonal = False
bias = 2
type = 2

method = 1
Determines vectorization mode.

option = 1
Determines option type (relevant only for Technical vectorization).

language = 1
Determines OCR language (relevant only when OCR is enabled).

color = False
If enabled output vector will contain color. Ignored for Method.Solid().

load(pre: s2c.Preset.Predefined)
Preloads chosen preset


If your scripts are not executing as expected, here are some tips for troubleshooting:

  • Python is case sensitive therefore, please ensure you are using the appropriate case when defining a command. For example, if you are converting a file named example.png you should ensure that you define the input as png and not PNG.