PDFFlatten 0.2.0
See the version list below for details.
dotnet add package PDFFlatten --version 0.2.0
NuGet\Install-Package PDFFlatten -Version 0.2.0
<PackageReference Include="PDFFlatten" Version="0.2.0" />
<PackageVersion Include="PDFFlatten" Version="0.2.0" />
<PackageReference Include="PDFFlatten" />
paket add PDFFlatten --version 0.2.0
#r "nuget: PDFFlatten, 0.2.0"
#:package PDFFlatten@0.2.0
#addin nuget:?package=PDFFlatten&version=0.2.0
#tool nuget:?package=PDFFlatten&version=0.2.0
PDFFlatten
PDFFlatten is a small C# / .NET Standard 2.0 utility library for turning interactive AcroForm PDFs into plain, printable page content.
The library target stays at netstandard2.0 so the same package can be consumed from .NET Framework 4.6.1+ (including 4.6.2) and current .NET releases.
Why this package exists
Some PDFs print badly from mobile devices or lightweight viewers because the form fields remain interactive. PDFFlatten converts those widget appearances into ordinary page content so the rendered values travel with the page.
Features
netstandard2.0package for broad reuse- simple
PdfFlattener.Flatten(Stream)API - overload for caller-owned output streams
- in-house flattening implementation with no restrictive third-party PDF dependency
- C# library source with one class per file and XML docs on the public surface
- generic-fixture and synthetic regression tests targeting
net10.0 - NuGet package metadata, XML docs, symbols, SourceLink, and MIT licence
- GitHub Actions for CI, packaging, and tagged releases
Install
dotnet add package PDFFlatten
Compatibility posture
- Library target:
netstandard2.0 - Consumer reach: designed for .NET Framework 4.6.2+ and current .NET runtimes through the .NET Standard 2.0 surface area
- Repo validation target: the sample app, tests, and CI currently run on
net10.0as the repo's latest-SDK smoke-test lane; that does not change the package target or consumer matrix - Source layout: C# implementation with one class per file, with public API kept intentionally small
Quick start — modern .NET / C#
using PDFFlatten;
using System.IO;
using Stream input = File.OpenRead("input.pdf");
using Stream flattened = PdfFlattener.Flatten(input);
using Stream output = File.Create("flattened.pdf");
flattened.CopyTo(output);
If you already manage the destination stream:
using PDFFlatten;
using System.IO;
using Stream input = File.OpenRead("input.pdf");
using Stream output = File.Create("flattened.pdf");
PdfFlattener.Flatten(input, output);
Quick start — VB.NET on .NET Framework 4.6.2
Imports PDFFlatten
Imports System.IO
Using input As Stream = File.OpenRead("input.pdf")
Using flattened As Stream = PdfFlattener.Flatten(input)
Using output As Stream = File.Create("flattened.pdf")
flattened.CopyTo(output)
End Using
End Using
End Using
Caller-owned output stream example:
Imports PDFFlatten
Imports System.IO
Using input As Stream = File.OpenRead("input.pdf")
Using output As Stream = File.Create("flattened.pdf")
PdfFlattener.Flatten(input, output)
End Using
End Using
Console sample
A minimal C# console app lives in samples/PDFFlatten.Sample for local CLI testing on macOS, Linux, or Windows.
dotnet run --project samples/PDFFlatten.Sample -- GenericAcroFormFixture.pdf GenericAcroFormFixture.flattened.pdf
The sample targets net10.0 so local smoke tests run on the current SDK, while the reusable package remains netstandard2.0 for consumer reach.
Supported scope in v0.1
PDFFlatten currently targets a practical first slice:
- classic cross-reference-table PDFs
- AcroForm widget annotations with normal appearance streams (
/AP /N) - flattening by replaying those appearance streams onto the page content
That covers the included synthetic AcroForm fixture and keeps the public API stable while the engine grows.
Project layout
PDFFlatten.sln
src/
PDFFlatten/
PDFFlatten.csproj
PdfFlattener.cs
Internals/ # one class per file for internal model/parser/serializer types
samples/
PDFFlatten.Sample/
Program.cs
tests/
PDFFlatten.Tests/
docs/
github-setup.md
CHANGELOG.md
CONTRIBUTING.md
Build, test, and pack locally
dotnet restore
dotnet build PDFFlatten.sln --configuration Release
dotnet test PDFFlatten.sln --configuration Release
dotnet pack src/PDFFlatten/PDFFlatten.csproj --configuration Release --output artifacts
Release flow
- Update
CHANGELOG.md. - Commit and push to GitHub.
- Create a version tag like
v0.2.0. - Push the tag.
- GitHub Actions builds, tests, packs, creates a GitHub release, and publishes to NuGet.
git tag v0.2.0
git push origin v0.2.0
GitHub setup
Use the full walkthrough in docs/github-setup.md.
In short, you need to:
- create the GitHub repo
- push
main - add the
NUGET_API_KEYrepository secret - enable Actions
- tag releases with
v*
CI/CD included
- CI: restore, build, test, pack validation
- Release: build, test, pack, GitHub release, NuGet publish
Contributing and maintenance
- contribution guide:
CONTRIBUTING.md - release notes scaffold:
CHANGELOG.md - GitHub bootstrap guide:
docs/github-setup.md
Notes
- Caller-owned streams are left open.
- The synthetic PDF fixture is covered by automated tests.
- If you publish under a different GitHub owner/repo, update the package metadata URLs in
src/PDFFlatten/PDFFlatten.csproj.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
C# source migration with the netstandard2.0 package target and public PdfFlattener API preserved; repo validation now runs on a net10.0 sample/test/CI lane.