I am using the Aspose.PDF dll version 23.10.0.0 (coding in CSharp)and I am having an issue with UTF letters.
I am signing a pdf file and I am specifying a reason.
The problem is that the letters are written in backwards.
But in the panel, the reason is written correctly.
In my csharp code, I tried to write UTF16 in the reason but it did not help.
N.B: I also tried with a newer version of the dll and got the same result.
Thanks for the help.
@ravendfj
Please attach the code and document you used so we can reproduce and investigate the issue.
Hi,
string inFile = System.IO.Path.Combine(@"\\temp\file-sample_150kB.pdf");
string outFile = System.IO.Path.Combine(@"\\temp\out2.pdf");
string thumbprint = "40bf60b56f8b9b84e5758b7ae0fcda509c2924be";
Document doc = new Document(inFile);
using (PdfFileSignature pdfSign = new PdfFileSignature())
{
pdfSign.BindPdf(doc);
//Sign with certificate selection in the windows certificate store
X509Store store = new X509Store(StoreLocation.CurrentUser);
store.Open(OpenFlags.ReadOnly);
X509Certificate2 certServer = GetCertificateKS(thumbprint);
Aspose.Pdf.Forms.ExternalSignature externalSignature = new Aspose.Pdf.Forms.ExternalSignature(certServer);
externalSignature.Reason = "שלום כולם";
//externalSignature.Reason = "\u05e9\u05dc\u05d5\u05dd\u0020\u05e2\u05d5\u05dc\u05dd";//utf16
externalSignature.ShowProperties = true;
pdfSign.Sign(1, true, new System.Drawing.Rectangle(10, 50, 350, 60), externalSignature);
pdfSign.Save(outFile);
}
Thank you.
Best Regards.
file-sample_150kB.pdf (139.4 KB)
out2.pdf (864.7 KB)
@ravendfj
Attach the code for the GetCertificateKS() method
1.png (37.4 KB)
Here is the code (but that is not the issue).
private static X509Certificate2 GetCertificateKS(string thumbprint)
{
X509Store st = new X509Store(StoreName.My, StoreLocation.LocalMachine);
st.Open(OpenFlags.ReadOnly);
X509Certificate2Collection col = st.Certificates;
X509Certificate2 SignerCert = null;
foreach (X509Certificate2 tmpCer in col)
{
try
{
if (tmpCer.Thumbprint == thumbprint.ToUpper())
{
SignerCert = tmpCer;
break;
}
}
catch (CryptographicException)
{
}
}
st.Close();
return SignerCert;
}
@ravendfj
I tried to reproduce the problem (with another certificate, with the attached GetCertificateKS code it didn’t work for me). The inscription is shown correctly.
Sign.png (104.9 KB)
The latest version of the library 24.11 was used during reproduce issue.
Hi,
As I wrote in the first message, the reason is correclty written in the panel but not on the page itself.
sig.png (177.9 KB)
@ravendfj
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): PDFNET-58728
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
Thank you and hope hearing from you soon.
Best Regards.
Hi,
Is there something new please?
Thank you.
@ravendfj
The ticket has recently been logged in our issue tracking system and will be prioritized on a first come first serve basis. As soon as we make some progress towards ticket resolution, we will inform you. Please be patient and spare us some time. We are sorry for the inconvenience.