Skip to content
PowerShell Module for the PDF Generator API
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.vscode
build
docs
src
.gitattributes
LICENSE
Module.PSDeploy.ps1
PSPDFGen.build.ps1
README.md
ScriptAnalyzerSettings.psd1
build.ps1
build.psake.ps1
build.settings.ps1
psake.ps1

README.md

Build Status

PSPDFGen

This is a PowerShell module to work with PDF Generator API: https://pdfgeneratorapi.com/

To be able to use this module, you must already have a PDF Generator API account.

How to set up

Install the module from the PowerShell Gallery:

Install-Module PSPDFGen

How to configure authentication

Create the module's auth:

New-PDFGenAuthConfig -key <key> -secret <secret> -workspace <workspace>

After this is run, the cmdlets no longer require explicit authentication.

Now you can also save the auth data:

Save-PDFGenAuthConfig

And load it from local storage:

Get-PDFGenAuthConfig

This stores the info encrypted in your home directory.pspdfgen\credentials.json (works on PS Core!)

How to use

To retrieve available templates:

Get-PDFGenTemplates

To generate a document based on their invoice template using partial example data:

$ht = @{
    TxnDate = (Get-Date).ToShortDateString()
    DueDate = (Get-Date).AddDays(30).ToShortDateString()
    CustomerInfo = @{
        CompanyName = 'Contoso'
    }
    Line = @(
        @{
            Name = 'Line 1'
            Description = 'Data on line 1'
        },
        @{
            Name = 'Line 2'
            Description = 'Data on line 2'
        }
    )
    TotalAmt = '$1000'
}
Get-PDFGenDocument -TemplateId 21648 -Data $ht -Format pdf -Output base64 -FilePath C:\Path\to\doc.pdf -PassThru

This will output a .pdf to the filepath specified.

You can’t perform that action at this time.