PdfSharpCore icon indicating copy to clipboard operation
PdfSharpCore copied to clipboard

Unicode problem when filling forms

Open hheexx opened this issue 2 years ago • 1 comments

Hi, I am trying to use PdfSharpCore for very basic task of filling forms. Unfortunately I have Unicode problem.

using PdfDocument document = PdfReader.Open(@"C:\Users\user\Downloads\cxPdfTest.pdf");
PdfTextField f = (PdfTextField)document.AcroForm.Fields["txtName"];
f.Text = "Lorem Ipsumović";
document.Save(@"C:\Users\user\Downloads\cxPdfOut.pdf");

image

Any hints?

hheexx avatar Jan 31 '23 14:01 hheexx

Ok, I fixed it like this.

f.Value = new PdfString("Lorem Ipsumović", PdfStringEncoding.Unicode);

Text property should probably be changed to Unicode, it's 2023.

hheexx avatar Jan 31 '23 15:01 hheexx