using PdfSharp;
using PdfSharp.Drawing;
using PdfSharp.Pdf;
using PdfSharp.Pdf.IO;
...
PdfDocument document = PdfReader.Open(selectedFullPathFile);
document.Info.Author = "Суслик";
document.Save(selectedFullPathFile);
class Program
{
static string unicodePrefix = new string(new char[] { '\xFE', '\xFF' });
static string EncodePdfInfoString(string s)
{
byte[] originalByteString = Encoding.Unicode.GetBytes(s);
byte b; //swap pairs
for (var i = 0; i < originalByteString.Length; i += 2)
{
b = originalByteString[i];
originalByteString[i] = originalByteString[i + 1];
originalByteString[i + 1] = b;
}
return unicodePrefix + Encoding.ASCII.GetString(originalByteString);
}
void SomeWork()
{
...
document.Info.Author = EncodePdfInfoString("Суслик");
document.Save(selectedFullPathFile);
}
}