Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
470c720
feat: PDFium engine behind IPdfEngine
glenntosco Nov 20, 2026
767b498
feat: public types, messages, page ranges
glenntosco Nov 20, 2026
b5b8e8f
feat: load PDFs from path, stream or bytes
glenntosco Nov 20, 2026
3a1f4d4
test: pin PDF loading with leading junk bytes
glenntosco Nov 20, 2026
67af7e2
feat: printer lookup and settings
glenntosco Nov 20, 2026
d7facd0
feat: page layout and print job
glenntosco Nov 20, 2026
9c6a95e
fix: count no pages on aborted jobs and refuse paused or offline prin…
glenntosco Nov 21, 2026
5ff05cc
fix: let offline-reported printers print and refuse queues that canno…
glenntosco Nov 21, 2026
457b8e7
feat: PdfPrinter facade
glenntosco Nov 21, 2026
78f7329
test: real-print acceptance tests and release checklist
glenntosco Nov 21, 2026
e87046d
feat: double-click test-print sample
glenntosco Nov 21, 2026
7bc2246
fix: accept paths pasted with quote marks in the sample settings
glenntosco Nov 21, 2026
666a7b8
build: complete the NuGet package and pin C# 12
glenntosco Nov 21, 2026
4db8499
ci: build, test, pack and publish the sample on windows-latest
glenntosco Nov 21, 2026
153effd
docs: usage guides, troubleshooting and contributing
glenntosco Nov 21, 2026
cfabf8d
docs: add the IIS check to the release checklist
glenntosco Nov 21, 2026
7d167de
fix: print filled-in form fields
glenntosco Nov 21, 2026
155ad18
fix: keep the printer's own colour setting unless Color is set
glenntosco Nov 21, 2026
6b35904
fix: name a stopped Print Spooler instead of a missing printer
glenntosco Nov 21, 2026
d4fa0b2
docs: security and limits, and how to report a vulnerability
glenntosco Nov 21, 2026
b023649
build: ship the licence notices with the test-print sample
glenntosco Nov 21, 2026
285b3e6
ci: time out after 30 minutes and cancel superseded runs
glenntosco Nov 21, 2026
caa6289
docs: say an aborted job may have been withdrawn and where to show me…
glenntosco Nov 21, 2026
e1d0123
docs: correct the runtime licence comparison and drop an unchecked claim
glenntosco Nov 21, 2026
8f712de
test: a field with a value but no stored appearance prints its value
glenntosco Nov 21, 2026
ae9dd45
fix: keep inherited page resources when printing form fields
glenntosco Nov 21, 2026
cb92f34
docs: describe how form pages are printed now
glenntosco Nov 21, 2026
a4ee8b9
docs: count eight real-print tests and record the latest test runs
glenntosco Nov 21, 2026
3f28a3c
fix: keep switched-off layers off when a form page is copied
glenntosco Nov 21, 2026
fcfdd16
docs: explain the copy check and the one remaining form limitation
glenntosco Nov 21, 2026
52d04d5
docs: record the test counts after the layer check
glenntosco Nov 21, 2026
bb17f76
fix: bound the size of the page comparison render
glenntosco Nov 21, 2026
5312e7f
build: name the NuGet package PDFStream.net
glenntosco Nov 21, 2026
cdbb040
docs: record the test counts after the comparison bound and the rename
glenntosco Nov 21, 2026
6884ce8
refactor: rename the namespaces, assembly, projects and solution to P…
glenntosco Nov 21, 2026
20ab5d2
build: use the PDFStream.net project paths and file names in CI
glenntosco Nov 21, 2026
89dfe7e
docs: use the PDFStream.net name everywhere
glenntosco Nov 21, 2026
3a7a6fb
docs: point the links and package metadata at the renamed GitHub repo…
glenntosco Nov 21, 2026
b076a36
fix: never leave form fields blank when a page copy cannot be used
glenntosco Nov 21, 2026
68dd25b
fix: copy all form pages in one go so shared resources are copied once
glenntosco Nov 21, 2026
c66d047
test: report which branch each form page took and assert it
glenntosco Nov 21, 2026
01669aa
test: wait up to 120 s for Print to PDF and report the queue state
glenntosco Nov 21, 2026
b3440d3
docs: describe form printing as it now works and its limits
glenntosco Nov 21, 2026
62ea8fa
docs: keep the form-printing costs and the latest checks exact
glenntosco Nov 21, 2026
acc3222
docs: state the shared-content-array form limitation and the other kn…
glenntosco Nov 21, 2026
add0bee
test: pin the shared-content-array form limitation as known behaviour
glenntosco Nov 21, 2026
4e375bd
docs: describe the shared content array limit without a security claim
glenntosco Nov 21, 2026
1a3e1b4
docs: add the design document
glenntosco Nov 21, 2026
fde887c
build: set the first release version to 1.0.0-rc.1 and pin it in the …
glenntosco Nov 21, 2026
c93e498
docs: describe 1.0.0-rc.1 as the first release and how to install a p…
glenntosco Nov 21, 2026
45f1908
Rename the product to PDFStream.NET (capital NET) in code, projects a…
glenntosco Nov 21, 2026
74833bd
docs: write the product name as PDFStream.NET and record the rename
glenntosco Nov 21, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
213 changes: 213 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,213 @@
# Continuous integration for PDFStream.NET.
#
# On every push and pull request this workflow builds the solution, runs the tests for both target
# frameworks (net8.0-windows and net10.0-windows), packs the NuGet package and publishes the test-print
# sample as one self-contained exe. The package and the sample are only kept as artifacts of the run:
# nothing is published to NuGet or anywhere else, and the workflow uses no secrets.
#
# Every command runs from the repository root, because global.json there switches "dotnet test" to
# Microsoft Testing Platform. That is why the test steps use --project and --framework (and never the
# old VSTest --filter option).
name: CI

on:
push:
pull_request:

permissions:
contents: read

# A newer push to the same branch, or a new commit on the same pull request, makes a run that is still going
# pointless, so it is cancelled. Runs for different refs never cancel each other.
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
# No usage data leaves the build: the .NET CLI and Microsoft Testing Platform both honour these.
DOTNET_CLI_TELEMETRY_OPTOUT: '1'
TESTINGPLATFORM_TELEMETRY_OPTOUT: '1'
DOTNET_NOLOGO: '1'

jobs:
build-test-pack:
name: Build, test and pack (windows-latest)
runs-on: windows-latest
# A stuck print or test run (for example a printer dialog nobody can close) fails after 30 minutes instead of
# holding a runner for GitHub's default of six hours.
timeout-minutes: 30
defaults:
run:
shell: pwsh

steps:
- name: Check out the repository
uses: actions/checkout@v7
with:
persist-credentials: false

- name: Install the .NET SDKs
uses: actions/setup-dotnet@v6
with:
# The .NET 10 SDK builds both targets and runs the tests through Microsoft Testing Platform;
# the .NET 8 install brings the runtime the net8.0-windows tests run on.
dotnet-version: |
8.0.x
10.0.x

- name: Show the .NET SDK in use
run: dotnet --version

# Reports, never fails. Eight facade tests and the eight real-print tests need the
# "Microsoft Print to PDF" printer and skip themselves (with a reason) when it is missing, so this
# step and the skipped-test report below make a silent skip visible.
- name: Report the printer the real-print tests need
continue-on-error: true
run: |
try {
$printer = Get-Printer -Name 'Microsoft Print to PDF' -ErrorAction SilentlyContinue
if ($printer) {
"Microsoft Print to PDF is installed on this runner (driver: $($printer.DriverName)). The tests that print to it will run."
} else {
"::warning title=Printer missing::Microsoft Print to PDF is not installed on this runner. The facade and real-print tests that need it will be skipped; see the skipped-test report."
}
$spooler = Get-Service -Name Spooler -ErrorAction SilentlyContinue
"Print Spooler service: $(if ($spooler) { $spooler.Status } else { 'not found' })"
} catch {
"::warning title=Printer check failed::Could not check the printers: $($_.Exception.Message)"
}
exit 0

- name: Restore
run: dotnet restore

- name: Build
run: dotnet build --configuration Release --no-restore

- name: Test (net8.0-windows)
run: >-
dotnet test --project tests/PDFStream.NET.Tests/PDFStream.NET.Tests.csproj
--framework net8.0-windows --configuration Release --no-build
--results-directory artifacts/test-results
--report-xunit-trx --report-xunit-trx-filename net8.0-windows.trx

- name: Test (net10.0-windows)
run: >-
dotnet test --project tests/PDFStream.NET.Tests/PDFStream.NET.Tests.csproj
--framework net10.0-windows --configuration Release --no-build
--results-directory artifacts/test-results
--report-xunit-trx --report-xunit-trx-filename net10.0-windows.trx

# Reports, never fails: counts the skipped tests in each framework's results and lists them with
# the reason each test gave, in the log and on the run's summary page.
- name: Report skipped tests
if: always()
continue-on-error: true
run: |
try {
$lines = @('### Test results', '')
$files = @(Get-ChildItem artifacts/test-results -Filter *.trx -ErrorAction SilentlyContinue)
if ($files.Count -eq 0) { $lines += 'No test result files were found.' }
foreach ($file in $files) {
[xml]$trx = Get-Content $file.FullName -Raw
$results = @($trx.TestRun.Results.UnitTestResult)
$passed = @($results | Where-Object { $_.outcome -eq 'Passed' }).Count
$failed = @($results | Where-Object { $_.outcome -eq 'Failed' }).Count
$skipped = @($results | Where-Object { $_.outcome -eq 'NotExecuted' })
$lines += "**$($file.BaseName)**: $($results.Count) tests, $passed passed, $failed failed, $($skipped.Count) skipped"
foreach ($test in $skipped) {
$reason = "$($test.Output.StdOut)".Trim()
$lines += "- skipped: $($test.testName)$(if ($reason) { " ($reason)" })"
}
if ($skipped.Count -gt 0) { "::warning title=Skipped tests::$($skipped.Count) tests were skipped on $($file.BaseName)." }
$lines += ''
}
$lines | ForEach-Object { $_ }
if ($env:GITHUB_STEP_SUMMARY) { $lines | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Append -Encoding utf8 }
} catch {
"::warning title=Skipped-test report failed::$($_.Exception.Message)"
}
exit 0

- name: Upload the test results
if: always()
uses: actions/upload-artifact@v7
with:
name: test-results
path: artifacts/test-results
if-no-files-found: warn

- name: Pack the NuGet package
run: dotnet pack src/PDFStream.NET/PDFStream.NET.csproj --configuration Release --no-build --output artifacts/package

# Fails the run if the package lost its licence, notices, readme, metadata or PDFium dependency, or
# picked up a file type that has no business in it (keys, certificates, settings, scripts).
- name: Check the package contents
run: |
Add-Type -AssemblyName System.IO.Compression.FileSystem
# The version being released: VersionPrefix plus VersionSuffix in Directory.Build.props. A version published
# on nuget.org is permanent, so the check pins it exactly. Change it together with that file when a new
# version is released.
$expectedVersion = '1.0.0-rc.1'
# The package id, the assembly and the namespace are all PDFStream.NET, so the file is
# PDFStream.NET.<version>.nupkg and its manifest PDFStream.NET.nuspec. Exactly one must exist.
$packages = @(Get-ChildItem artifacts/package -Filter 'PDFStream.NET.*.nupkg' | Where-Object { $_.Name -notlike '*.snupkg' })
if ($packages.Count -ne 1) { throw "Expected one PDFStream.NET.$expectedVersion.nupkg, found $($packages.Count): $($packages.Name -join ', ')" }
if ($packages[0].Name -cne "PDFStream.NET.$expectedVersion.nupkg") { throw "The package file is '$($packages[0].Name)', not PDFStream.NET.$expectedVersion.nupkg" }
$package = $packages[0]
$zip = [IO.Compression.ZipFile]::OpenRead($package.FullName)
try {
$entries = @($zip.Entries | ForEach-Object { $_.FullName })
$manifest = $zip.Entries | Where-Object { $_.FullName -ceq 'PDFStream.NET.nuspec' }
if (-not $manifest) { throw 'The package has no PDFStream.NET.nuspec.' }
$reader = [IO.StreamReader]::new($manifest.Open())
[xml]$nuspec = $reader.ReadToEnd()
$reader.Dispose()
} finally { $zip.Dispose() }
$problems = @()
foreach ($required in 'LICENSE', 'THIRD-PARTY-NOTICES.md', 'README.md', 'lib/net8.0-windows7.0/PDFStream.NET.dll', 'lib/net10.0-windows7.0/PDFStream.NET.dll') {
if ($entries -cnotcontains $required) { $problems += "missing file: $required" }
}
$metadata = $nuspec.package.metadata
if ($metadata.id -cne 'PDFStream.NET') { $problems += "the package id is '$($metadata.id)', not PDFStream.NET" }
if ($metadata.title -cne 'PDFStream.NET') { $problems += "the package title is '$($metadata.title)', not PDFStream.NET" }
if ($metadata.version -cne $expectedVersion) { $problems += "the package version is '$($metadata.version)', not $expectedVersion" }
if ($metadata.license.'#text' -ne 'MIT') { $problems += 'the licence expression is not MIT' }
if ($metadata.readme -ne 'README.md') { $problems += 'the package readme is not README.md' }
if ($metadata.authors -ne 'P4 Software') { $problems += 'the authors are not P4 Software' }
if ($metadata.repository.url -cne 'https://github.com/P4Software/PDFStream.NET') { $problems += 'the repository URL is missing or wrong' }
foreach ($group in @($metadata.dependencies.group)) {
$pdfium = @($group.dependency | Where-Object { $_.id -ceq 'bblanchon.PDFium.Win32' })
if ($pdfium.Count -ne 1) { $problems += "$($group.targetFramework) does not depend on bblanchon.PDFium.Win32 (pdfium.dll)" }
# The exact PDFium build that was tested (the nuspec writes it as "160.0.8165", which NuGet reads as "160.0.8165 or newer").
elseif ($pdfium[0].version -cne '160.0.8165') { $problems += "$($group.targetFramework) depends on bblanchon.PDFium.Win32 $($pdfium[0].version), not 160.0.8165" }
}
$unexpected = @($entries | Where-Object { $_ -match '\.(snk|pfx|p12|pem|key|cer|ps1|cmd|bat|json|config)$' })
if ($unexpected.Count -gt 0) { $problems += "unexpected files: $($unexpected -join ', ')" }
"Package: $($package.Name)"; $entries | Sort-Object | ForEach-Object { " $_" }
if ($problems.Count -gt 0) { $problems | ForEach-Object { "::error title=Package check::$_" }; exit 1 }
'The PDFStream.NET package has the licence, the third-party notices, the readme, the metadata and the PDFium dependency.'

- name: Upload the NuGet package
uses: actions/upload-artifact@v7
with:
name: PDFStream.NET-nuget-package
path: artifacts/package
if-no-files-found: error

# One exe that includes the .NET runtime and pdfium.dll, so a person can double-click it on a
# machine without .NET installed. Not trimmed: the settings reader relies on reflection.
- name: Publish the test-print sample (win-x64, self-contained, single file)
run: >-
dotnet publish samples/PDFStream.NET.TestPrint/PDFStream.NET.TestPrint.csproj
--framework net10.0-windows --configuration Release --runtime win-x64 --self-contained true
-p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -p:DebugType=embedded
-p:PublishDocumentationFiles=false
--output artifacts/testprint

- name: Upload the test-print sample
uses: actions/upload-artifact@v7
with:
name: PDFStream.NET.TestPrint-win-x64
path: artifacts/testprint
if-no-files-found: error
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Build output
bin/
obj/
artifacts/

# Test results
TestResults/

# Packages produced by dotnet pack
*.nupkg
*.snupkg

# IDE and user state
.vs/
.idea/
*.user
*.suo
Loading
Loading