Loading pdf-export/style.css +4 −0 Original line number Diff line number Diff line Loading @@ -122,6 +122,10 @@ aside>.graphic { position: relative; } aside>.qrcode { text-align: center; } aside>.graphic>img { width: 100%; /* weasyprint */ } Loading pdf-export/template.html +3 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,9 @@ <p>{{ focus }}</p> <ul><li>{{ areas }}</li></ul> </div> <div class="qrcode"> <img src="{{ qrcode }}"/> </div> </aside> </div> <section id="contact"> Loading scripts/Invoke-Export.ps1 +26 −4 Original line number Diff line number Diff line Loading @@ -14,9 +14,24 @@ function Export-QrCode { Param( [Parameter(Mandatory = $True, Position = 0)] [ValidateNotNullOrEmpty()] [String] $Data [String] $Data, [Parameter(Mandatory = $False, Position = 1)] [String] $Root = $PSScriptRoot, [String] $Name = 'qrcode', [int] $Scale = 2, [String] $Color = '96,27,100,15' ) if (Test-Command zint) { $Output = Join-Path $Root "${Name}.png" & zint --data $Data --barcode QRCODE --output $Output --scale $Scale --fg $Color if (!(Test-Path $Output)) { " ❌ {{#red ${Output}}} not found" | Write-Color exit 1 } } else { " ❌ {{#red zint}} command not found" | Write-Color exit 1 } } function Export-Pdf { Loading Loading @@ -52,6 +67,7 @@ function Export-Pdf { 'email' = $Json.contact.email 'phone' = $Json.contact.phone 'src' = "../src/assets/${Id}.${Extension}" 'qrcode' = "_qr_${Id}.png" } $Data | ConvertTo-Json | Write-Verbose New-Template -File $Template -Data $Data | Out-File -FilePath $Html -Encoding utf8 Loading @@ -65,14 +81,20 @@ function Export-Pdf { } } $Url = 'https://fact-sheets.ornl.gov' $Root = "${PSScriptRoot}/../pdf-export" if ($Id) { "{{#gray Generating QR for}} {{#green ${Id}}}..." | Write-Color Export-QrCode -Data "${Url}/${Id}" -Root $Root -Name "_qr_${Id}" "{{#gray Generating PDF for}} {{#green ${Id}}}..." | Write-Color Export-Pdf -Id $Id -Root $Root } else { $ProjectsFolder = Join-Path $Root '../src/content/projects' Get-ChildItem -Path $ProjectsFolder | Select-Object -ExpandProperty BaseName | ForEach-Object { "{{#gray Generating PDF for}} {{#green ${_}}}..." | Write-Color Export-Pdf -Id $_ -Root $Root $Id = $_ "{{#gray Generating QR for}} {{#green ${Id}}}..." | Write-Color Export-QrCode -Data "${Url}/${Id}" -Root $Root -Name "_qr_${Id}" "{{#gray Generating PDF for}} {{#green ${Id}}}..." | Write-Color Export-Pdf -Id $Id -Root $Root } } No newline at end of file Loading
pdf-export/style.css +4 −0 Original line number Diff line number Diff line Loading @@ -122,6 +122,10 @@ aside>.graphic { position: relative; } aside>.qrcode { text-align: center; } aside>.graphic>img { width: 100%; /* weasyprint */ } Loading
pdf-export/template.html +3 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,9 @@ <p>{{ focus }}</p> <ul><li>{{ areas }}</li></ul> </div> <div class="qrcode"> <img src="{{ qrcode }}"/> </div> </aside> </div> <section id="contact"> Loading
scripts/Invoke-Export.ps1 +26 −4 Original line number Diff line number Diff line Loading @@ -14,9 +14,24 @@ function Export-QrCode { Param( [Parameter(Mandatory = $True, Position = 0)] [ValidateNotNullOrEmpty()] [String] $Data [String] $Data, [Parameter(Mandatory = $False, Position = 1)] [String] $Root = $PSScriptRoot, [String] $Name = 'qrcode', [int] $Scale = 2, [String] $Color = '96,27,100,15' ) if (Test-Command zint) { $Output = Join-Path $Root "${Name}.png" & zint --data $Data --barcode QRCODE --output $Output --scale $Scale --fg $Color if (!(Test-Path $Output)) { " ❌ {{#red ${Output}}} not found" | Write-Color exit 1 } } else { " ❌ {{#red zint}} command not found" | Write-Color exit 1 } } function Export-Pdf { Loading Loading @@ -52,6 +67,7 @@ function Export-Pdf { 'email' = $Json.contact.email 'phone' = $Json.contact.phone 'src' = "../src/assets/${Id}.${Extension}" 'qrcode' = "_qr_${Id}.png" } $Data | ConvertTo-Json | Write-Verbose New-Template -File $Template -Data $Data | Out-File -FilePath $Html -Encoding utf8 Loading @@ -65,14 +81,20 @@ function Export-Pdf { } } $Url = 'https://fact-sheets.ornl.gov' $Root = "${PSScriptRoot}/../pdf-export" if ($Id) { "{{#gray Generating QR for}} {{#green ${Id}}}..." | Write-Color Export-QrCode -Data "${Url}/${Id}" -Root $Root -Name "_qr_${Id}" "{{#gray Generating PDF for}} {{#green ${Id}}}..." | Write-Color Export-Pdf -Id $Id -Root $Root } else { $ProjectsFolder = Join-Path $Root '../src/content/projects' Get-ChildItem -Path $ProjectsFolder | Select-Object -ExpandProperty BaseName | ForEach-Object { "{{#gray Generating PDF for}} {{#green ${_}}}..." | Write-Color Export-Pdf -Id $_ -Root $Root $Id = $_ "{{#gray Generating QR for}} {{#green ${Id}}}..." | Write-Color Export-QrCode -Data "${Url}/${Id}" -Root $Root -Name "_qr_${Id}" "{{#gray Generating PDF for}} {{#green ${Id}}}..." | Write-Color Export-Pdf -Id $Id -Root $Root } } No newline at end of file