Project

PSWriteOffice

PowerShell document automation across Word, Excel, PowerPoint, PDF, Reader, Confluence, Visio, and open text formats.

Stars 159
Forks 14
PowerShell Gallery downloads 158,661
Release v3.0.5
Language: C# Updated: 2026-09-03

API Reference

Cmdlet

ConvertTo-OfficeVisioPng

Aliases: ConvertTo-VisioPng
Namespace PSWriteOffice
Aliases
ConvertTo-VisioPng
Inputs
OfficeIMO.Visio.VisioDocument System.String
Outputs
System.Byte[] System.IO.FileInfo

Exports a Visio document page to native dependency-free PNG.

Remarks

Exports a Visio document page to native dependency-free PNG.

Examples

Authored help example

Export a diagram preview to PNG.

PS>


OfficeVisio -Path .\ServiceMap.vsdx { VisioRectangle -Text 'API' -X 2 -Y 4 }
            ConvertTo-OfficeVisioPng -Path .\ServiceMap.vsdx -OutputPath .\ServiceMap.png -PixelsPerInch 144
        

Creates a diagram and exports the first page to a PNG preview.

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.

Syntax

ConvertTo-OfficeVisioPng [-BackgroundColor <String>] [-FontCollectionIndex <Int32>] [-FontFaceName <String>] [-FontFilePath <String>] [-NoConnectorLabelOverlapResolution] [-NoConnectorLabels] [-NoStencilArtwork] [-NoText] [-Open] [-OutputPath <String>] [-PageIndex <Int32>] -Path <String> [-PixelsPerInch <Double>] [-Supersampling <Int32>] [-Transparent] [<CommonParameters>]
#
Parameter set: Path

Parameters

BackgroundColor String optionalposition: namedpipeline: False
Background color name or hex value. Use -Transparent for transparent output.
FontCollectionIndex Int32 optionalposition: namedpipeline: False
Optional zero-based font collection index.
FontFaceName String optionalposition: namedpipeline: False
Optional font face name used when selecting from a font collection.
FontFilePath String optionalposition: namedpipeline: False
Optional TrueType/OpenType font file used for text outlines.
NoConnectorLabelOverlapResolution SwitchParameter optionalposition: namedpipeline: False
Do not resolve connector label overlaps at export time.
NoConnectorLabels SwitchParameter optionalposition: namedpipeline: False
Do not render connector labels.
NoStencilArtwork SwitchParameter optionalposition: namedpipeline: False
Do not render built-in stencil artwork.
NoText SwitchParameter optionalposition: namedpipeline: False
Do not render shape text.
Open SwitchParameter optionalposition: namedpipeline: Falsealiases: Show
Open the PNG after saving.
OutputPath String optionalposition: namedpipeline: Falsealiases: OutPath
Optional output PNG path.
PageIndex Int32 optionalposition: namedpipeline: False
Zero-based page index to export.
Path String requiredposition: 0pipeline: True (ByValue)aliases: FilePath
Visio .vsdx path.
PixelsPerInch Double optionalposition: namedpipeline: False
PNG pixels per Visio inch.
Supersampling Int32 optionalposition: namedpipeline: False
Supersampling factor for smoother raster output.
Transparent SwitchParameter optionalposition: namedpipeline: False
Use transparent PNG background.

Outputs

System.Byte[], System.IO.FileInfo

ConvertTo-OfficeVisioPng [-BackgroundColor <String>] -Document <VisioDocument> [-FontCollectionIndex <Int32>] [-FontFaceName <String>] [-FontFilePath <String>] [-NoConnectorLabelOverlapResolution] [-NoConnectorLabels] [-NoStencilArtwork] [-NoText] [-Open] [-OutputPath <String>] [-PageIndex <Int32>] [-PixelsPerInch <Double>] [-Supersampling <Int32>] [-Transparent] [<CommonParameters>]
#
Parameter set: Document

Parameters

BackgroundColor String optionalposition: namedpipeline: False
Background color name or hex value. Use -Transparent for transparent output.
Document VisioDocument requiredposition: namedpipeline: True (ByValue)
Visio document object.
FontCollectionIndex Int32 optionalposition: namedpipeline: False
Optional zero-based font collection index.
FontFaceName String optionalposition: namedpipeline: False
Optional font face name used when selecting from a font collection.
FontFilePath String optionalposition: namedpipeline: False
Optional TrueType/OpenType font file used for text outlines.
NoConnectorLabelOverlapResolution SwitchParameter optionalposition: namedpipeline: False
Do not resolve connector label overlaps at export time.
NoConnectorLabels SwitchParameter optionalposition: namedpipeline: False
Do not render connector labels.
NoStencilArtwork SwitchParameter optionalposition: namedpipeline: False
Do not render built-in stencil artwork.
NoText SwitchParameter optionalposition: namedpipeline: False
Do not render shape text.
Open SwitchParameter optionalposition: namedpipeline: Falsealiases: Show
Open the PNG after saving.
OutputPath String optionalposition: namedpipeline: Falsealiases: OutPath
Optional output PNG path.
PageIndex Int32 optionalposition: namedpipeline: False
Zero-based page index to export.
PixelsPerInch Double optionalposition: namedpipeline: False
PNG pixels per Visio inch.
Supersampling Int32 optionalposition: namedpipeline: False
Supersampling factor for smoother raster output.
Transparent SwitchParameter optionalposition: namedpipeline: False
Use transparent PNG background.

Outputs

System.Byte[], System.IO.FileInfo