Is it possible to use the .NET DeflateStream for pdf creation?

前端 未结 1 1333
Happy的楠姐
Happy的楠姐 2021-01-13 09:33

I\'m playing around with the ability to create pdf files through C# code. I have been looking at the PDF specifications and have been able to create a working PDF file, done

相关标签:
1条回答
  • 2021-01-13 10:21

    Is there any reason why Microsoft's implementation of the DeflateStream class isn't working? Am I using it incorrectly or is it implemented incorrectly or what?

    DeflateStream is actually implementing RFC 1951 (DEFLATE), where PDF is compressed using a compression method compatible with RFC 1950. This is detailed, with a workaround, in this related Microsoft Connect bug report.

    A simple workaround would be to use a third party compression library, such as DotNetZip, which will support the proper format. That being said, the Connect report suggests that skipping the first two bytes may cause this to work in most cases.

    0 讨论(0)
提交回复
热议问题