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.

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.

  1. Refer to the project's NuGet package System.Text.Encoding.CodePages.
  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