Skip to main content

Class: Automizer

Defined in: src/automizer.ts:84

Automizer

The basic class for pptx-automizer package. This class will be exported as Automizer by index.ts.

Implements

  • IPresentationProps

Constructors

Constructor

new Automizer(params?): Automizer

Defined in: src/automizer.ts:115

Creates an instance of pptx-automizer.

Parameters

params?

AutomizerParams

Returns

Automizer

Properties

archiveParams

archiveParams: ArchiveParams

Defined in: src/automizer.ts:94


content

content: ContentTracker

Defined in: src/automizer.ts:108

Implementation of

IPresentationProps.content


logger

logger: ILogger

Defined in: src/automizer.ts:106

Logger used for all library output. Defaults to a ConsoleLogger filtered by params.verbosity; inject your own via params.logger.


modifyPresentation

modifyPresentation: ModifyXmlCallback[] = []

Defined in: src/automizer.ts:109


outputDir

outputDir: string

Defined in: src/automizer.ts:93


params

params: AutomizerParams

Defined in: src/automizer.ts:100

Implementation of

IPresentationProps.params


rootTemplate

rootTemplate: RootPresTemplate

Defined in: src/automizer.ts:85

Implementation of

IPresentationProps.rootTemplate


status

status: StatusTracker

Defined in: src/automizer.ts:101

Implementation of

IPresentationProps.status


templateDir

templateDir: string

Defined in: src/automizer.ts:91


templateFallbackDir

templateFallbackDir: string

Defined in: src/automizer.ts:92

Methods

addMaster()

addMaster(name, sourceIdentifier, callback?): this

Defined in: src/automizer.ts:449

Copy and modify a master and the associated layouts from template to output.

Parameters

name

string

sourceIdentifier

number

callback?

(slideMaster) => void

Returns

this


addSlide()

addSlide(name, slideIdentifier, callback?): this

Defined in: src/automizer.ts:411

Add a slide from one of the imported templates by slide number or creationId.

Parameters

name

string

Name or alias of the template; must have been loaded with Automizer.load()

slideIdentifier

SourceIdentifier

Number or creationId of slide in template presentation

callback?

(slide) => void

Executed after slide was added. The newly created slide will be passed to the callback as first argument.

Returns

this

Instance of Automizer


applyModifyPresentationCallbacks()

applyModifyPresentationCallbacks(): Promise<void>

Defined in: src/automizer.ts:627

Applies all callbacks in this.modifyPresentation-array. The callback array can be pushed by this.modify()

Returns

Promise<void>


finalizePresentation()

finalizePresentation(): Promise<void>

Defined in: src/automizer.ts:562

Returns

Promise<void>


getInfo()

getInfo(): Promise<PresentationInfo>

Defined in: src/automizer.ts:377

Get some info about the imported templates

Returns

Promise<PresentationInfo>

Promise


getJSZip()

getJSZip(): Promise<JSZip>

Defined in: src/automizer.ts:548

Pass final JSZip instance.

Returns

Promise<JSZip>

Promise<NodeJS.ReadableStream>


load()

load(file, name?): this

Defined in: src/automizer.ts:219

Load a template pptx file.

Parameters

file

AutomizerFile

Filename, path to the template or Buffer containing the file. Filenames and paths will be prefixed with 'templateDir'

name?

string

Optional short name for a template loaded from a file. If skipped, the template will be named by its location. if the file is a Buffer the name is required.

Returns

this

Instance of Automizer


loadMedia()

loadMedia(filename, dir?, prefix?): this

Defined in: src/automizer.ts:268

Load media files to output presentation.

Parameters

filename

string | string[]

Filename or path to the media file.

dir?

string

Specify custom path for media instead of mediaDir from AutomizerParams.

prefix?

string

Returns

this

Instance of Automizer


loadMediaBuffer()

loadMediaBuffer(filename, buffer, prefix?): this

Defined in: src/automizer.ts:308

Load media files from buffers to output presentation.

Parameters

filename

string | string[]

Filename(s) to use (must include extension).

buffer

Buffer<ArrayBufferLike> | Buffer<ArrayBufferLike>[]

Buffer(s) containing the media data.

prefix?

string

Optional prefix to prepend to filename in archive.

Returns

this

Instance of Automizer


loadRoot()

loadRoot(file): this

Defined in: src/automizer.ts:207

Load a pptx file and set it as root template.

Parameters

file

AutomizerFile

Filename, path to the template or Buffer containing the file. Filenames and paths will be prefixed with 'templateDir'

Returns

this

Instance of Automizer


modify()

modify(cb): this

Defined in: src/automizer.ts:655

Parameters

cb

ModifyXmlCallback

Returns

this

Implementation of

IPresentationProps.modify


normalizePresentation()

normalizePresentation(): Promise<void>

Defined in: src/automizer.ts:642

Apply some callbacks to restore archive/xml structure and prevent corrupted pptx files.

TODO: Use every imported image only once TODO: Check for lost relations

Returns

Promise<void>


presentation()

presentation(): Promise<Automizer>

Defined in: src/automizer.ts:194

Returns

Promise<Automizer>


setCreationIds()

setCreationIds(): Promise<TemplateInfo[]>

Defined in: src/automizer.ts:357

Parses all loaded templates and collects creationIds for slides and elements. This will make finding templates and elements independent of slide number and element name.

Returns

Promise<TemplateInfo[]>

Promise<TemplateInfo[]>


setStatusTracker()

setStatusTracker(statusTracker): void

Defined in: src/automizer.ts:165

Parameters

statusTracker

(tracker) => void

Returns

void


stream()

stream(generatorOptions?): Promise<ReadableStream>

Defined in: src/automizer.ts:528

Create a ReadableStream from output pptx file.

Parameters

generatorOptions?

JSZipGeneratorOptions<"nodebuffer">

JSZipGeneratorOptions for nodebuffer Output type

Returns

Promise<ReadableStream>

Promise<NodeJS.ReadableStream>


write()

write(location): Promise<AutomizerSummary>

Defined in: src/automizer.ts:498

Write all imports and modifications to a file.

Parameters

location

string

Filename or path for the file. Will be prefixed with 'outputDir'

Returns

Promise<AutomizerSummary>

summary object.


writeMasterSlides()

writeMasterSlides(): Promise<void>

Defined in: src/automizer.ts:577

Write all masterSlides to archive.

Returns

Promise<void>


writeMediaFiles()

writeMediaFiles(): Promise<void>

Defined in: src/automizer.ts:604

Write all media files to archive.

Returns

Promise<void>


writeSlides()

writeSlides(): Promise<void>

Defined in: src/automizer.ts:586

Write all slides to archive.

Returns

Promise<void>