Update resume trust and client experience
This commit is contained in:
@@ -6,6 +6,7 @@ $chrome = "C:\Program Files\Google\Chrome\Application\chrome.exe"
|
||||
$port = 8793
|
||||
$pdfPath = Join-Path $siteRoot "Resume_Jason_Eugene_Garrison.pdf"
|
||||
$docxPath = Join-Path $siteRoot "Resume_Jason_Eugene_Garrison.docx"
|
||||
$chromeProfile = Join-Path $env:TEMP ("resume-pdf-" + [Guid]::NewGuid().ToString("N"))
|
||||
|
||||
if (-not (Test-Path $python)) {
|
||||
throw "Bundled Python was not found at $python"
|
||||
@@ -22,6 +23,10 @@ if ($LASTEXITCODE -ne 0) {
|
||||
|
||||
$server = $null
|
||||
try {
|
||||
if (Test-Path -LiteralPath $pdfPath) {
|
||||
Remove-Item -LiteralPath $pdfPath -Force
|
||||
}
|
||||
|
||||
$server = Start-Process -FilePath $python `
|
||||
-ArgumentList @("-m", "http.server", "$port", "--bind", "127.0.0.1", "--directory", $siteRoot) `
|
||||
-WorkingDirectory $env:TEMP `
|
||||
@@ -47,24 +52,39 @@ try {
|
||||
throw "Local resume preview server was not reachable at $url"
|
||||
}
|
||||
|
||||
& $chrome `
|
||||
--headless=new `
|
||||
--disable-gpu `
|
||||
--disable-background-networking `
|
||||
--disable-sync `
|
||||
--metrics-recording-only `
|
||||
--no-pdf-header-footer `
|
||||
--print-to-pdf="$pdfPath" `
|
||||
$url | Out-Null
|
||||
$chromeProcess = Start-Process -FilePath $chrome `
|
||||
-ArgumentList @(
|
||||
"--headless=new",
|
||||
"--disable-gpu",
|
||||
"--disable-background-networking",
|
||||
"--disable-sync",
|
||||
"--metrics-recording-only",
|
||||
"--no-first-run",
|
||||
"--no-default-browser-check",
|
||||
"--no-pdf-header-footer",
|
||||
"--user-data-dir=$chromeProfile",
|
||||
"--print-to-pdf=$pdfPath",
|
||||
$url
|
||||
) `
|
||||
-Wait `
|
||||
-PassThru `
|
||||
-NoNewWindow
|
||||
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "PDF generation failed with exit code $LASTEXITCODE"
|
||||
if ($chromeProcess.ExitCode -ne 0) {
|
||||
throw "PDF generation failed with exit code $($chromeProcess.ExitCode)"
|
||||
}
|
||||
|
||||
if (-not (Test-Path -LiteralPath $pdfPath) -or (Get-Item -LiteralPath $pdfPath).Length -lt 1024) {
|
||||
throw "PDF generation did not produce a valid output file."
|
||||
}
|
||||
}
|
||||
finally {
|
||||
if ($server -and -not $server.HasExited) {
|
||||
Stop-Process -Id $server.Id -Force
|
||||
}
|
||||
if (Test-Path -LiteralPath $chromeProfile) {
|
||||
Remove-Item -LiteralPath $chromeProfile -Recurse -Force
|
||||
}
|
||||
}
|
||||
|
||||
& (Join-Path $PSScriptRoot "publish-permissions.ps1")
|
||||
|
||||
Reference in New Issue
Block a user