Encoding Considerations
DynamicPDF Core Suite supports several encodings. However, in some cases you might receive a "Required CodePage Missing" error.
Supported Code Pages
Below is a list of code pages implemented in by DynamicPDF Core Suite for .NET.
- IBM437
- Windows-874
- Windows-1250
- Windows-1251
- Windows-1252
- Windows-1256
- ISO-8859-2
- ISO-8859-3
- ISO-8859-4
- ISO-8859-5
- ISO-8859-6
- ISO-8859-7
- ISO-8859-8
- ISO-8859-9
- ISO-8859-13
- ISO-8859-15
Required Codepage Missing
DynamicPDF Core Suite sometimes raises an exception of type GeneratorException containing the message when using features that requires text encoding/decoding other than the encodings implemented by the DynamicPDF library or the .NET Framework SDK.
No data is available for encoding [code page number]. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method
This error is because some of the .NET SDKs (Ex. .NET Core 2.0) do not have all the different encodings supported by a full .NET Framework SDK. Take the following steps to add custom encoding support when running an application that causes this exception.
- Refer to the project's NuGet package
System.Text.Encoding.CodePages
. - Call Encoding.RegisterProvider (CodePagesEncodingProvider.Instance) in the program before using the functionality that requires the custom encoding.
For more information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
Document document = new Document();
// Create a Page and add it to the document
Page page = new Page();
document.Pages.Add(page);
// Create a barcode
Aztec barCode = new Aztec("Hello ~2000020 World", 50, 50, AztecSymbolSize.Full, 5);
barCode.ProcessTilde = true;
// Add the barcode to the page
page.Elements.Add(barCode);
document.Draw(@"output.pdf");
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance)
Dim MyDocument As Document = New Document()
' Create a Page And add it to the document
Dim MyPage As Page = New Page()
MyDocument.Pages.Add(Page)
' Create a barcode
Dim MyBarCode As Aztec = New Aztec("Hello ~2000020 World", 50, 50, AztecSymbolSize.Full, 5)
MyBarCode.ProcessTilde = True
' Add the barcode to the page
Page.Elements.Add(barCode)
MyDocument.Draw("output.pdf")
Applies To
- DataMatrix and Aztec barcodes when using ECI values 20, 28, 29 and 30.
- QR barcode when using with Kanji encoding.
- HtmlArea when the HTML metatag required unsupported charset values.
- Text extraction from the PDF.