Examples/Example31.ps1

[CmdletBinding()]
param (
    [System.String[]] $Format = 'Word',
    [System.String] $Path = '~\Desktop',
    [System.Management.Automation.SwitchParameter] $PassThru
)

Import-Module PScribo -Force -Verbose:$false

$example31 = Document -Name 'PScribo Example 31' {

    <#
        Images can be added from a local file, the web or included as a Base64 encoded string. Images are output in
        the Word, Html and XML formats. Text output includes the image's alternative text description but doesn't
        include the binary content. By default, when inserting an image the alternative text is set the image's Uri.

        When images are added to the PScribo document, the images' file contents are stored interanlly to the document.
        This means that external images (files or web content) are only required when generating the document. If you
        have a PScribo document object, access to the files/internet is not required.
    #>

    Section -Style 'Heading1' -Name 'Base64 encoded image at native size' {

        <#
            Embedding images as Base64 encoded strings within the document has one major advantage - there is no
            reliance on external image files or access to the internet.

            NOTE: When inserting Base64 encoded images you must include the alternative text.

            You can convert an existing image file to Base64 using the [System.Convert]::ToBase64() static method, i.e.
                [System.Convert]::ToBase64String((Get-Content -Path .\ExampleHtmlOutput.png -Encoding Byte))
        #>

        Image -Text 'Soccer man' -Base64 'iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAnOSURBVHhe7VppTBzJFXZuKUqkSFGUU1FOJVGUH1FW+yMbRVEUaZVEiVZK9l/yI1plk50TjMFH8IJtFgNzAzbHMN09DOdwm8NcXmxubMwZg20W7xpsvGE5Ft92DC/v1VTP9gwNnkXjzcyIT/o0M9XVVe97VfX6dU3t2cUunh1SUryftuhEg1krDFm0wl1GnThIZXSNV4tNWP4hfd2sFcdQLFgN4oaU5l0n0ncqM+uEUarDq8cWHHrHZ8w6cYKEtrlb4fbNK/B49Rrj2o0r0Cq1AnMCOojq8ttiBzTFSeBp8bRfeDBPC6dlJ+j5bbEDFDZIU1058sF8f/4KWPXiBsaHAX5b7ICCHa13NeFKUh2LVrzNb4sd7DqAlgBObwp4asKJviUgxeYSoMDGgiA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nxyXnXifdRiJQAPbyUj6S0tp/I1L/tGb4FXpLfJP+JttqQXTsc/zRDhet9EgtMNAUy9bLtJRr68NDIi8icgDPr7SyMi2ss4AB6zOX5aNX+RVGejfZqtOfAFnwyF0SJlFK4zQCMuOCKbVKC1lGoTv89ufLRRHYEI+DW7VC38gQ10Z9QEOeLg8y16WaNoHb6wGg5aS9TXXd0w68ffYViI6xoWfXvxM/cjyAuVpcIte3HAerV13Hqldp+9UhkJUT4M79K4v0XVrXPEGiVY6AVNdNooRf1RGeRq8RuiBmYUHMH8bGN9auA81rm4mhBykdhpcXte07pUOcKdV+aaxtug5XjUygUay0+A1Yq9feDAVTth0GpytZbzW39IX4IBqRwO7h6Y2rxqZQCMHaarTaKuJJ87cvM+WBsaHTUdhscxIQsvy2wMc0MIPUCIj+x8hCna05tWEK1lIMUHlMLRFJz1PQrOTqwIccK6ykzsgzIccwo3QHVCj6gD/VrlehNsLHyQ1dPCBOyCbV41MoJFPXQJX5++RmC1Pg1M5iZ0YGPU7YKp7iDkAnyDVvFpkggIbGUpPADXxxKrCc/Joqp4Gx2vs6E1NabffAZf7zvN7xEZeLTKhPA1O0Z4CniycRt7rPCuP5JanwXEGvEh1HPvLYWF6gmWCFeY6nwO04hu8WuRCeRqclgOtd7bmcdr7RGx/Gpy9GOmlLlZXQUx7l6Nml0eRCu/oNHhmYtHn8V4ztjHHU+m6LL30XX55F7vYxS6eMfbs+R+7MUruabqlqgAAAABJRU5ErkJggg=='
        Paragraph 'Image Attribution: https://icons8.com/icon/42919/soccer' -Size 8 -Italic
    }

    Section -Style 'Heading1' -Name 'Image from file with defined dimensions' {

        <#
            Images are displayed at their native resolution. If you want to resize an image, specify the required height
            and width parameters. Remember to make sure you maintain the image's aspect ratio!
        #>

        Image -Path "$PSScriptRoot\Example31.jpg" -Height 160 -Width 160
        Paragraph 'Image Attribution: https://cdn.pixabay.com/photo/2014/08/26/19/20/document-428334_640.jpg' -Size 8 -Italic
    }

    Section -Style 'Heading1' -Name 'Centered image from web scaled proportionally by 50%' {

        <#
            Images can also be resized by a percentage. Using '-Percent 100' will display the image at it's native
            resolution.

            For example, if you wanted to reduce the image's size to 75% of its original size (whilst maintaining the
            aspect ratio), you would specify '-Percent 75'. If you wanted to increase the image's size by 25% (whilst
            mainaining the aspect ration), you would specify '-Percent 125'.
        #>

        Image -Uri 'https://cdn.pixabay.com/photo/2014/08/26/19/20/document-428334_640.jpg' -Percent 50 -Align Center
        Paragraph 'Image Attribution: https://cdn.pixabay.com/photo/2014/08/26/19/20/document-428334_640.jpg' -Size 8 -Italic
    }

}
$example31 | Export-Document -Path $Path -Format $Format -PassThru:$PassThru