Synercoding.FileFormats.Pdf
1.0.0-alpha001
See the version list below for details.
dotnet add package Synercoding.FileFormats.Pdf --version 1.0.0-alpha001
NuGet\Install-Package Synercoding.FileFormats.Pdf -Version 1.0.0-alpha001
<PackageReference Include="Synercoding.FileFormats.Pdf" Version="1.0.0-alpha001" />
paket add Synercoding.FileFormats.Pdf --version 1.0.0-alpha001
#r "nuget: Synercoding.FileFormats.Pdf, 1.0.0-alpha001"
// Install Synercoding.FileFormats.Pdf as a Cake Addin #addin nuget:?package=Synercoding.FileFormats.Pdf&version=1.0.0-alpha001&prerelease // Install Synercoding.FileFormats.Pdf as a Cake Tool #tool nuget:?package=Synercoding.FileFormats.Pdf&version=1.0.0-alpha001&prerelease
FileFormats.Pdf
This project was created to enable PDF creation on .NETStandard. This because multiple libraries did not suit my purpose of working on .NET Core & .NET Framework the same way. Some alternatives supported settings the different boxes (Media, Crop, Bleed & Trim) but did not fully supported images on all platforms. Others supported images but not the different boxes, and again others did not work at all on .NET Core.
Because of those reasons this libary was created.
License
This project is licensed under MIT license.
Specifications used
This library was created using the specifications lay out in "PDF 32000-1:2008, Document management – Portable document format – Part 1: PDF 1.7".
The full specifications are not implemented. This library currently only supports placements of images and setting the different boxes.
Remarks
Unlike most PDF libraries this library does not create the entire PDF model in memory before writing the PDF to a (file)stream. Most libaries support editing capabilities, because this libary only supports creating files, it was not necessary to keep the PDF model in memory. This results in less memory usage.
To place the images this library makes use of SixLabors/ImageSharp. All images that are placed in the PDF will be saved internally as a JPG file. This means that this library currently does NOT support transparency.
Output pdfs
The PDF files created in this library are PDF 1.7 compliant.
Sample program images
The sample project called Synercoding.FileFormats.Pdf.ConsoleTester uses multiple images. Those images were taken from Pexels.com and are licensed under the Pexels License.
Sample usage
using (var fs = File.OpenWrite(fileName))
using (var writer = new PdfWriter(fs))
{
double _mmToPts(double mm) => mm / 25.4d * 72;
writer
.AddPage(page =>
{
var bleed = _mmToPts(3);
// Mediabox = A4 Portrait with 3mm bleed all around
page.MediaBox = new Primitives.Rectangle(0, 0, _mmToPts(216), _mmToPts(303));
page.TrimBox = new Primitives.Rectangle(
page.MediaBox.LLX + bleed,
page.MediaBox.LLY + bleed,
page.MediaBox.URX - bleed,
page.MediaBox.URY - bleed
);
using (var eyeStream = File.OpenRead("Pexels_com/adult-blue-blue-eyes-865711.jpg"))
{
var scale = 3456d / 5184;
var width = _mmToPts(100);
var height = _mmToPts(100 * scale);
var offSet = _mmToPts(6);
page.AddImage(eyeStream, new Primitives.Rectangle(offSet, offSet, width + offSet, height + offSet));
}
});
}
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. |
.NET Core | netcoreapp1.0 was computed. netcoreapp1.1 was computed. netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard1.6 is compatible. netstandard2.0 was computed. 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 | tizen30 was computed. 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 1.6
- NETStandard.Library (>= 1.6.1)
- SixLabors.ImageSharp (>= 1.0.0-beta0006)
- System.Memory (>= 4.5.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0-alpha015 | 109 | 9/19/2023 |
1.0.0-alpha014 | 139 | 1/26/2023 |
1.0.0-alpha013 | 138 | 1/19/2023 |
1.0.0-alpha012 | 105 | 1/18/2023 |
1.0.0-alpha011 | 2,408 | 8/24/2022 |
1.0.0-alpha010 | 796 | 2/25/2022 |
1.0.0-alpha009 | 734 | 3/6/2021 |
1.0.0-alpha008 | 296 | 12/5/2020 |
1.0.0-alpha007 | 425 | 7/10/2020 |
1.0.0-alpha006 | 287 | 7/8/2020 |
1.0.0-alpha005 | 445 | 4/22/2020 |
1.0.0-alpha004 | 395 | 3/17/2020 |
1.0.0-alpha003 | 390 | 3/11/2019 |
1.0.0-alpha002 | 907 | 3/6/2019 |
1.0.0-alpha001 | 385 | 3/6/2019 |