Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 5 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ dotnet_style_namespace_match_folder = true:suggestion
dotnet_style_prefer_collection_expression = when_types_loosely_match:suggestion
dotnet_style_readonly_field = true:suggestion
dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
dotnet_style_allow_multiple_blank_lines_experimental = true:silent

[*.cs]
csharp_indent_labels = one_less_than_current
Expand Down Expand Up @@ -111,4 +112,7 @@ csharp_style_deconstructed_variable_declaration = true:suggestion
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
csharp_style_unused_value_expression_statement_preference = discard_variable:silent
csharp_prefer_static_local_function = true:suggestion
csharp_style_prefer_readonly_struct = true:suggestion
csharp_style_prefer_readonly_struct = true:suggestion
csharp_prefer_system_threading_lock = true:suggestion
csharp_prefer_static_anonymous_function = true:suggestion
csharp_style_prefer_readonly_struct_member = true:suggestion
38 changes: 19 additions & 19 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
assets/
TestResults/
localtests/
.nuget/
.build/
.testPublish/
*.sln.ide/
_ReSharper.*/
.idea/
Expand All @@ -15,41 +13,43 @@ PublishProfiles/
.vs/
.vscode/
.idea/
bower_components/
node_modules/
# bower_components/
# node_modules/
zip/
debugSettings.json
project.lock.json
*.log
*.user
*.suo
#*.suo
*.cache
*.docstates
#*.docstates
*.zip
_ReSharper.*
nuget.exe
*net45.csproj
*net451.csproj
*k10.csproj
*.psess
#*net45.csproj
#*net451.csproj
#*k10.csproj
#*.psess
*.vsp
*.pidb
*.userprefs
*DS_Store
*.ncrunchsolution
nCrunchTemp*.*
*.*sdf
*.ipch
.settings
#*.ncrunchsolution
#nCrunchTemp*.*
#*.*sdf
#*.ipch
#.settings
*.sln.ide
node_modules
# *launchSettings.json
*.orig
*.nuget.props
*.nuget.targets
/localfeed
oldstate.json
InternalAgentState.json
#/localfeed
#oldstate.json
#InternalAgentState.json
/nuget.config
*.log
*tempfile.*
#*tempfile.*
launchsettings.json
testEnvironments.json
3 changes: 3 additions & 0 deletions .globalconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
is_global = true

dotnet_diagnostic.IDE0290.severity = suggestion
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2001-2025 empira Software GmbH, Troisdorf (Cologne Area), Germany
Copyright (c) 2001-2026 empira Software GmbH, Troisdorf (Cologne Area), Germany

http://docs.pdfsharp.net

Expand Down
116 changes: 96 additions & 20 deletions PdfSharp.sln

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions PdfSharp.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=BSD/@EntryIndexedValue">BSD</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=CF/@EntryIndexedValue">CF</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=CR/@EntryIndexedValue">CR</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=DA/@EntryIndexedValue">DA</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=IO/@EntryIndexedValue">IO</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=IV/@EntryIndexedValue">IV</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=MD/@EntryIndexedValue">MD</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=OSX/@EntryIndexedValue">OSX</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=OT/@EntryIndexedValue">OT</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=SASL/@EntryIndexedValue">SASL</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=TSA/@EntryIndexedValue">TSA</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=URI/@EntryIndexedValue">URI</s:String>
Expand All @@ -23,6 +25,7 @@
<s:String x:Key="/Default/PatternsAndTemplates/Todo/TodoPatterns/=961894CCC510410ABE2B99132B253C80/TodoIconStyle/@EntryValue">Edit</s:String>
<s:Boolean x:Key="/Default/UserDictionary/Words/=AESV/@EntryIndexedValue">True</s:Boolean>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=ID/@EntryIndexedValue">ID</s:String>
<s:Boolean x:Key="/Default/UserDictionary/Words/=annots/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=ARGB/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=ascender/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=bijective/@EntryIndexedValue">True</s:Boolean>
Expand All @@ -32,6 +35,7 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=cmap/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Cmyk/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Codepoints/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=decendants/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=decryptor/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=didn/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Doesn/@EntryIndexedValue">True</s:Boolean>
Expand All @@ -40,6 +44,7 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=Endian/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=endianness/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=endstream/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Factur/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Failsafe/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=flate/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=flavlor/@EntryIndexedValue">True</s:Boolean>
Expand Down Expand Up @@ -67,6 +72,7 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=Semilight/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=shouldn/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=stringprep/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=subdictionary/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=subpath/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=tabstop/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=tabstops/@EntryIndexedValue">True</s:Boolean>
Expand Down
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# PDFsharp & MigraDoc 6
# PDFsharp & MigraDoc 7

Version **6.2.0**
Published **2025-05-19**
Version **7.0.0 Preview 1**
Published **2026-03-24**

This is a final version of the **PDFsharp** project, the main project of PDFsharp & MigraDoc 6 with updates for C# 12 and .NET 6.
This is a preview version of the **PDFsharp** project, the main project of PDFsharp & MigraDoc 7 with updates for C# 12 and .NET 8, .NET 9, and .NET 10.

PDFsharp: Copyright (c) 2005-2025 empira Software GmbH, Troisdorf (Cologne Area), Germany
MigraDoc: Copyright (c) 2001-2025 empira Software GmbH, Troisdorf (Cologne Area), Germany
PDFsharp: Copyright (c) 2005-2026 empira Software GmbH, Troisdorf (Cologne Area), Germany
MigraDoc: Copyright (c) 2001-2026 empira Software GmbH, Troisdorf (Cologne Area), Germany
Published Open Source under the [MIT License](https://docs.pdfsharp.net/LICENSE.html)

For more information see [docs.pdfsharp.net](https://docs.pdfsharp.net/)
Expand All @@ -15,7 +15,7 @@ For more information see [docs.pdfsharp.net](https://docs.pdfsharp.net/)

Project documentation can be found on our DOCS site: <https://docs.pdfsharp.net>.

Note: PowerShell 7 is required to execute the PowerShell scripts that come with PDFsharp.
Note that PowerShell 7 is required to execute the PowerShell scripts that come with PDFsharp.

### Download assets first

Expand All @@ -34,9 +34,10 @@ Execute
`dotnet build` should build the solution without any warnings or errors.

* You need the latest .NET SDK version installed
* Please note that you need a git repository with at least one commit in order to build the PDFsharp solution.
* ~~Please note that you need a git repository with at least one commit in order to build the PDFsharp solution.
Without a git repository with at least one commit, you will get an error message from `GitVersion.MsBuild` while building the solution.
You can set a tag to define a valid version, e.g.: `git tag v6.2.0` to make it build with a specific version number. Without tag, version 0.1.0 will be used.
You can set a tag to define a valid version, e.g.: `git tag v6.2.0` to make it build with a specific version number. Without tag, version 0.1.0 will be used.~~
(Is now done automatically by BuildConfig)

### Central package management

Expand Down
41 changes: 41 additions & 0 deletions dev/GetAllPDFs.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Chat/GPT creates this script for me. That is why comments are German.
# param(
# [Parameter(Mandatory = $true)]
# [string]$SourcePath,

# [Parameter(Mandatory = $true)]
# [string]$DestinationPath
# )

TODO verschieben

$SourcePath = "D:\repos\emp\PDFsharp.iText\itext.tests"
$DestinationPath = "D:\repos\emp\PDFsharp\assets\private\test-files"

# Zielverzeichnis erstellen, falls es nicht existiert
if (-not (Test-Path -Path $DestinationPath)) {
New-Item -ItemType Directory -Path $DestinationPath | Out-Null
}

# Alle PDF-Dateien rekursiv suchen
$files = Get-ChildItem -Path $SourcePath -Recurse -Filter *.pdf

foreach ($file in $files) {
# Dateiname ermitteln
$destFile = Join-Path $DestinationPath $file.Name

# Falls Datei schon existiert → eindeutigen Namen erzeugen
if (Test-Path $destFile) {
$baseName = [System.IO.Path]::GetFileNameWithoutExtension($file.Name)
$extension = $file.Extension
$counter = 1
do {
$newName = "$baseName`_$counter$extension"
$destFile = Join-Path $DestinationPath $newName
$counter++
} while (Test-Path $destFile)
}

# Datei kopieren
Copy-Item -Path $file.FullName -Destination $destFile
}
6 changes: 6 additions & 0 deletions dev/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,9 @@ Builds NuGet packages for release on NuGet.org.

## run-tests
Run unit tests on Windows and WSL2.

## set-en.ps1
Sets UI language for dotnet build etc. to en-US.

## zip-PDFsharp.ps1
Creates a PDFsharp.zip file.
78 changes: 64 additions & 14 deletions dev/_update-local-nuget-packages.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,70 @@ $b = "`e[94m"
$r = "`e[0m"

# Set working directory to solution root.
Push-Location $PSScriptRoot
Push-Location .\..
Push-Location $PSScriptRoot\..

Write-Host "Copy all `e[93m$($config.ToUpperInvariant())$r NuGet packages to $b$nugetLocal$r."
New-Item -Path $nugetLocal -ItemType directory -Force | Out-Null
$packages = @()
Get-ChildItem -Path . -Filter *.nupkg -Recurse -ErrorAction SilentlyContinue -Force | ForEach-Object {
if ($_.FullName -match "bin\\$config|bin\/$config") {
Copy-Item $_.FullName -Destination ("$nugetLocal\" + $_.Name)
$packages += $_.Name
# Machine local NuGet packages
# Do not copy packages into user profile folder NugetFolder
# if .nuget-local does not exist.
if (Test-Path -Path $nugetLocal) {
# User has a local NuGet directory.
} else {
$nugetLocal = ""
}

# Project local NuGet packages (if PDFsharp is used as submodule)
# Do not copy packages into .nuget directory if PDFsharp is not used
# as a submodule and therefore .nuget does not exist in project directory.
$nugetProject = "..\..\.nuget" # because of this: YOUR-PROJECT/modules/PDFsharp
if (Test-Path -Path $nugetProject) {
# PDFsharp is a submodule and the outer project has a .nuget directory.
$nugetProject = $nugetProject
} else {
$nugetProject = ""
}

$hasNugetLocal = $nugetLocal.Length -gt 0
$hasNugetProject = $nugetProject.Length -gt 0

if ($hasNugetLocal -or $hasNugetProject)
{
if ($hasNugetLocal -and $hasNugetProject)
{
$targetFolders = "$b$nugetLocal$r and $b$nugetProject$r"
}
elseif ($hasNugetLocal)
{
$targetFolders = "$b$nugetLocal$r"
}
elseif ($hasNugetProject)
{
$targetFolders = "$b$nugetProject$r"
}

Write-Output "Copy all `e[93m$($config.ToUpperInvariant())$r NuGet packages to $targetFolders."
# Do not force creation of directory anymore.
# New-Item -Path $nugetLocal -ItemType directory -Force | Out-Null
$packages = @()
Get-ChildItem -Path . -Filter *.nupkg -Recurse -ErrorAction SilentlyContinue -Force | ForEach-Object {
if ($_.FullName -match "bin\\$config|bin\/$config") {
if ($nugetLocal.Length -gt 0) {
Copy-Item $_.FullName -Destination ("$nugetLocal\" + $_.Name)
}
if ($nugetProject.Length -gt 0) {
Copy-Item $_.FullName -Destination ("$nugetProject\" + $_.Name)
}
$packages += $_.Name
}
}
Write-Output " $b$($packages.Count)$r packages copied."
}
Write-Host " $b$($packages.Count)$r packages copied."
else
{
Write-Output "No `e[93m$($config.ToUpperInvariant())$r NuGet packages are copied as there is no .nuget-local and no main module .nuget folder."
}


Write-Host "Delete all existing old package folders in $b$nuget$r folder."
Write-Output "Delete all existing old package folders in $b$nuget$r folder."
$count = 0
$versions = @()
$packages | ForEach-Object {
Expand All @@ -63,10 +112,11 @@ $packages | ForEach-Object {
}
}
}
Write-Host " $b$count$r package $($deleteAllPackageVersions ? '' : 'version ')folders deleted in $b$nuget$r."
Write-Output " $b$count$r package $($deleteAllPackageVersions ? '' : 'version ')folders deleted in $b$nuget$r."
if ($packages.Count -gt 0) {
Write-Host " New version number(s) : $b$Versions$r"
# In case you build several times and do not delete the artifacts
# you can have more than one set of NuGet packages
Write-Output " The new version number(s) are: $b$Versions$r"
}

Pop-Location
Pop-Location
38 changes: 27 additions & 11 deletions dev/build-local-nuget-packages-release.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
# Updates local nuget packages.
<#
.SYNOPSIS
Build PDFsharp with config release and updates the local nuget packages.

.DESCRIPTION
The script deletes all artifacts and builds a PDFsharp release version.
It first builds the PdfSharp.BuildConfig.csproj to ensure that SemVersion.props and
PDFsharpBuildConfig.props are up-to-date before the build process starts.
The created packages are copied to two locations.
The first is the .nuget-local directory in your user profile directory.
The second is the .nuget directory in the root folder of your project in case
you used PDFsharp as a submodule.
#>

#Requires -Version 7
#Requires -PSEdition Core
Expand All @@ -9,31 +21,35 @@ param (

Push-Location $PSScriptRoot

try {
Write-Host "Delete bin and obj " $deleteBinAndObj
try {
# Write-Output "Delete bin and obj " $deleteBinAndObj
if ($deleteBinAndObj) {
Write-Host "Deleting BIN and OBJ"
.\del-bin-and-obj.ps1
Write-Host "Done deleting bin and obj"
Write-Output "Deleting ‘/bin’ and ‘/obj’..."
.\del-bin-and-obj.ps1 | Out-Null
Write-Output "Done."
}

Push-Location ..
try {
Write-Host "Invoking ‘dotnet build’"
dotnet build -c release
Write-Output "Invoking ‘dotnet build’ for ‘PdfSharp.BuildConfig.csproj’"
# Generate semver infos and PDFsharp build configuration first.
dotnet build .\src\foundation\src\shared\src\PdfSharp.BuildConfig\PdfSharp.BuildConfig.csproj
Write-Output "Invoking ‘dotnet build’ for PDFsharp solution"
dotnet build --configuration release
$build = $LASTEXITCODE
Write-Host "‘dotnet build’ has finished"
Write-Output "‘dotnet build’ has finished"
}
finally {
Pop-Location
}

if ($build -gt 0) {
Write-Host "‘dotnet build’ failed with code " $build
Write-Error "‘dotnet build’ failed with code " $build
throw "‘dotnet build’ failed with code " + $build
}

.\update-local-nuget-packages-release.ps1
Write-Output "Invoking ‘update-local-nuget-packages-release.ps1’"
.\update-local-nuget-packages-release.ps1
}
finally {
Pop-Location
Expand Down
Loading