empira / PDFsharp-1.5

A .NET library for processing PDF
MIT License
1.28k stars 589 forks source link

Inconsistent Encoding #156

Open bagsergen opened 2 years ago

bagsergen commented 2 years ago

Reporting an Issue Here

Hi, I am trying to add custom property with special characters. (like that: "ÖÇŞİĞÜüğişçö", "فثسف", "飽€¨´" )

Thanks.

Expected Behavior

The name and the value should be same.

Actual Behavior

customprops

Steps to Reproduce the Behavior

    PdfDocument document;
    key=value;
    try
    {
        document = PdfReader.Open(filePath);
        var properties = document.Info.Elements;                
        properties.SetString("/" + key, value);
        document.Save(filePath);
        document = null;                
        return true;
    }
    catch (Exception e)
    {
        if (document != null)
            document = null;
        throw;
    }