使用 PDFRender4NET 插件读取 PDF 文件的时候提示错误 ❌:
| 1 | System.ArgumentException: ''windows-1252' is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method. (Parameter 'name')' | 
解决办法
- 安装 NuGet 包: - System.Text.Encoding.CodePages
- 在调用的库前先执行这一句: - 1 
 2
 3
 4
 5
 6
 7
 8
 9
 10- using System.Text; 
 public void Action()
 {
 
 Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
 using (PDFFile pdfFile = PDFFile.Open(pdfFullPath))
 {
 ...
 }
 }



