Skip to content

Commit

Permalink
The generated diagram is exceeding the parameters of the report margin.
Browse files Browse the repository at this point in the history
  • Loading branch information
rebelinux committed Jan 15, 2024
1 parent 54e8059 commit 25811eb
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 5 deletions.
32 changes: 31 additions & 1 deletion Src/Private/SharedUtilsFunctions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -231,4 +231,34 @@ function Convert-Size {
}

return [Math]::Round($value,$Precision,[MidPointRounding]::AwayFromZero)
}
}

function Get-ImagePercent {
<#
.SYNOPSIS
Used by As Built Report to get base64 image percentage calculated from image width.
This low the diagram image to fit the report page margins
.DESCRIPTION
.NOTES
Version: 0.1.0
Author: Jonathan Colon
.EXAMPLE
.LINK
#>
[CmdletBinding()]
[OutputType([System.Int32])]
Param
(
[Parameter (
Position = 0,
Mandatory)]
[string]
$Graph
)
$Image_FromStream = [System.Drawing.Image]::FromStream((new-object System.IO.MemoryStream(,[convert]::FromBase64String($Graph))))
If ($Image_FromStream.Width -gt 1500) {
return 10
} else {
return 20
}
} # end
12 changes: 8 additions & 4 deletions Src/Public/Invoke-AsBuiltReport.Veeam.VBR.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,10 @@ function Invoke-AsBuiltReport.Veeam.VBR {
if ($Graph) {
PageBreak
Section -Style Heading3 "Wan Accelerator Diagram." {
Image -Base64 $Graph -Text "Wan Accelerator Diagram" -Percent 20 -Align Center
Image -Base64 $Graph -Text "Wan Accelerator Diagram" (Get-ImagePercent -Graph $Graph) -Align Center
Paragraph "Image preview: Opens the image in a new tab to view it at full resolution." -Tabs 2
}
BlankLine
}
}
}
Expand All @@ -144,9 +145,10 @@ function Invoke-AsBuiltReport.Veeam.VBR {
if ($Graph) {
PageBreak
Section -Style Heading3 "Backup Repository Diagram." {
Image -Base64 $Graph -Text "Backup Repository Diagram" -Percent 20 -Align Center
Image -Base64 $Graph -Text "Backup Repository Diagram" -Percent (Get-ImagePercent -Graph $Graph) -Align Center
Paragraph "Image preview: Opens the image in a new tab to view it at full resolution." -Tabs 2
}
BlankLine
}
}
}
Expand All @@ -162,9 +164,10 @@ function Invoke-AsBuiltReport.Veeam.VBR {
if ($Graph) {
PageBreak
Section -Style Heading3 "ScaleOut Backup Repository Diagram." {
Image -Base64 $Graph -Text "ScaleOut Backup Repository Diagram" -Percent 20 -Align Center
Image -Base64 $Graph -Text "ScaleOut Backup Repository Diagram" (Get-ImagePercent -Graph $Graph) -Align Center
Paragraph "Image preview: Opens the image in a new tab to view it at full resolution." -Tabs 2
}
BlankLine
}
}
}
Expand Down Expand Up @@ -213,9 +216,10 @@ function Invoke-AsBuiltReport.Veeam.VBR {
if ($Graph) {
PageBreak
Section -Style Heading3 "Tape Infrastructure Diagram." {
Image -Base64 $Graph -Text "Tape Infrastructure Diagram" -Percent 20 -Align Center
Image -Base64 $Graph -Text "Tape Infrastructure Diagram" -Percent (Get-ImagePercent -Graph $Graph) -Align Center
Paragraph "Image preview: Opens the image in a new tab to view it at full resolution." -Tabs 2
}
BlankLine
}
}
}
Expand Down

0 comments on commit 25811eb

Please sign in to comment.