27 lines
1022 B
PowerShell
27 lines
1022 B
PowerShell
# Erzeugt das EPK-PDF aus epk.html (Chrome oder Edge headless).
|
|
#
|
|
# .\epk\build.ps1
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
Set-Location $PSScriptRoot
|
|
|
|
$browser = @(
|
|
"C:\Program Files\Google\Chrome\Application\chrome.exe",
|
|
"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe"
|
|
) | Where-Object { Test-Path $_ } | Select-Object -First 1
|
|
if (-not $browser) { throw "Weder Chrome noch Edge gefunden." }
|
|
|
|
$html = (Resolve-Path "epk.html").Path
|
|
$pdf = Join-Path $PSScriptRoot "Deepwater_Survival_EPK.pdf"
|
|
if (Test-Path $pdf) { Remove-Item $pdf }
|
|
|
|
# Start-Process -Wait, weil chrome.exe sonst zurückkehrt, bevor das PDF geschrieben ist
|
|
Start-Process -FilePath $browser -Wait -WindowStyle Hidden -ArgumentList @(
|
|
"--headless=new", "--disable-gpu", "--no-pdf-header-footer",
|
|
"--allow-file-access-from-files", "--virtual-time-budget=5000",
|
|
"--print-to-pdf=`"$pdf`"", "`"file:///$($html -replace '\\','/')`""
|
|
)
|
|
if (-not (Test-Path $pdf)) { throw "PDF wurde nicht erzeugt." }
|
|
|
|
Write-Host "EPK erzeugt: $pdf"
|