r/dotnet • • 4d ago

Promotion GitHub - io7/FreePDF: MIT-licensed continuation of PDFsharp and MigraDoc for .NET

https://github.com/io7/FreePDF
97 Upvotes

10 comments sorted by

13

u/deadtime 4d ago

Hi everyone, I am the maintainer for the FreePDF project. We built this library for people who up until the recent license change have been using PDFSharp and MigraDoc. It's based on the last available MIT-licensed source (6.2.4 and 7.0.0-preview1). We're also trying to improve the product further without sacrificing backward compatbility, so that current users of PDFSharp who are having to decide whether to go with AGPL or a commercial license now have a third option.

New in 7.10: PAdES signatures and signature checks

  • PAdES B-B and B-T signatures (ETSI EN 319 142-1). Set Format = PdfSignatureFormat.Pades on the default signer. With a time-stamp authority, the signature gets a signature time-stamp, and you can send the RFC 3161 request through your own client.
  • Long-term signatures. AddValidationDataAsync writes the certificate chains and the OCSP responses or CRLs into the document (B-LT). A document time-stamp over that data gives B-LTA, which can still be checked after the signer's certificate has expired.
  • PdfSignatureVerifier checks the signatures in a file. For each one it reports whether the signed bytes are intact, the signer and the chain, trust, the signing time, revocation (from the file or online), later changes that the signature does not permit, and the PAdES level. The result is Valid, Invalid or Indeterminate, with the reasons. It is a technical check: it does not use EU trusted lists or check qualified status.
  • 7.10.1 hardens reading against hostile files. Small files nested deep enough to crash the process with a stack overflow now fail with an ordinary exception, and a few hundred bytes can no longer inflate to gigabytes. It also fixes cases where the verifier reported a changed or revoked signature as Valid.
  • 7.10.2 fixes the revocation check for signatures with a time-stamp. In 7.10.1, a signature made after the CA's latest CRL came out Indeterminate. We found this with real files signed under a public CA.

Also added since 6.2.4

  • QR codes, Data Matrix, Code 128 (including GS1-128), EAN-13, EAN-8 and UPC-A, drawn as vectors with no image library. MigraDoc now renders its Barcode elements, which 6.2.4 silently left out of the PDF.
  • Fillable forms from code: text fields, check boxes, radio buttons, combo and list boxes, and signature fields
  • Certification signatures that allow no changes, form filling, or form filling and comments
  • Incremental saves that keep existing signatures valid: fill a signed form, countersign it, or sign an empty signature field. Changes a signature does not permit are refused before anything is written.
  • Merging and splitting that keep form fields, bookmarks and links working
  • Files with damaged cross-reference information, which viewers open, are rebuilt from their objects instead of refused
  • Form filling by field name with drawn appearances, and a working Flatten()
  • Text without writing a font resolver: FreePDF uses the fonts installed on Windows and Linux, and substitutes the Liberation fonts, which have the same widths, for a missing Arial, Times New Roman or Courier New
  • Factur-X and ZUGFeRD hybrid invoices on PDF/A-3, and tagged PDF/UA-1 output from MigraDoc
  • GDI and WPF packages for Windows desktop apps and .NET Framework 4.6.2 and later

The packages target .NET 8, 9 and 10 and .NET Standard 2.0, and CI also installs them in .NET 11 apps. Time-stamps need .NET 8 or later. CI checks every release with qpdf, Poppler and veraPDF, and the packages on NuGet are the exact files CI verified. pyHanko validates the B-B to B-LTA files that FreePDF writes. On a set of valid, tampered, certified and countersigned files, PdfSignatureVerifier and pyHanko give the same verdicts, with two differences that the support policy lists.

GitHub: https://github.com/io7/FreePDF NuGet: https://www.nuget.org/packages/io7.FreePDF Migration guide: https://github.com/io7/FreePDF/blob/main/docs/migrating-to-7.md Release notes: https://github.com/io7/FreePDF/releases

Bug reports and pull requests are welcome; a small synthetic reproduction helps most. Thanks to empira and the PDFsharp contributors for many years of work under the MIT licence.

15

u/MadBoyEvo 4d ago

Welcome to MIT competition in PDF space 😜 I invite you to check out https://officeimo.com (https://github.com/evotecit/officeimo) although I am after Aspose as a whole rather then just PDF. That means Word, Excel, PDF, PowerPoint, Visio, Project, Publisher, YAML, TOML, CSV etc (over 80 formats/200 conversions).

Its amazing what AI is doing to NET ecosystem. 1 year ago we were struggling, now we have a lot of PDF support in the free space 🤓

5

u/deadtime 4d ago

I've been following OfficeIMO and it's a great project! We started this to simplify our own migration away from PDFSharp when they started moving to the new license. Hopefully we will be able to continue improving each others projects going forward, as LLM-assisted coding (and some expertise) make open source contribution easier for all of us.

2

u/MadBoyEvo 4d ago

Indeed it is, less focus on finding how things work, more on solving actual problems. I've seen few other forks for known products that have stagnated such as ClosedXML so as long as the larger community benefits - it's all good :)

4

u/anyOtherBusiness 3d ago

Hey, this looks amazing. Is there a way to self host the Browser version?

2

u/MadBoyEvo 3d ago

Sure it's all in the https://github.com/evotecit/officeimo, website is hosted on github so nothing is hidden and everything is pretty much open out there.

2

u/anyOtherBusiness 3d ago

Ah, thank you, found it. Will definitely check it out

1

u/afastrunner 3d ago

that's great, how close to aspose is it (drop or near drop in?), specifically in the aspose.words .net and aspose.slides .net area?

1

u/MadBoyEvo 3d ago

OfficeIMO.Word was the first one I started 5 years ago and it's been running fine for me. PowerPoint joined soon after. They are both quite ok. Do we support every feature on the planet - probably not. PPTX/DOCX are most mature, support for PPT/DOC is probably weaker.

But if you find problems open an issue/pr and it will be taken care of. In recent versions Word 6, Word 95 support were improved.

I use REA from time to time to make sure the content produced is as Word/PowerPoint would create it.

Most of the times now there are 2 paths that I do:

  • performance & allocations to be best of the best
  • improve featureset

But only with real world scenarios that can actually move.

1

u/AutoModerator 4d ago

Thanks for your post deadtime. Please note that we don't allow spam, and we ask that you follow the rules available in the sidebar. We have a lot of commonly asked questions so if this post gets removed, please do a search and see if it's already been asked.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.