Encoding Considerations

Supported Code Pages

Below is a list of Code pages implemented in our DynamicPDF Core Suite for .NET product.

Required Codepage Missing

The program may raise an exception of type GeneratorException with the message “No data is available for encoding [code page number]. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method” when using features that requires text encoding/decoding other than the encodings implemented by the DynamicPDF library or the .NET Framework SDK.

Some of the .NET SDKs (Ex. .NET Core 2.0) does not have all the different encodings supported by full .NET Framework SDK. The following steps can be used to add custom encoding support when running an application on those environments.

1. Refer to the NuGet package "System.Text.Encoding.CodePages" in the project.

2. 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

In this topic