Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Sun Mar 17, 2024 10:33 pm

The Arabic texts do not appear correctly when signing on the document.

Johnmc13
 
Posts: 8
Joined: Fri Sep 24, 2021 8:11 am

Mon Mar 18, 2024 8:20 am

Hello,

Thanks for your inquiry.
To help us further investigate your issue, please provide us with your word file, signature certificate, and password.You can upload it here as an attachment or send it to this email: support@e-iceblue.com. Thanks in advace.

Sincerely,
William
E-iceblue support team
User avatar

William.Zhang
 
Posts: 203
Joined: Mon Dec 27, 2021 2:23 am

Mon Mar 18, 2024 11:13 am

Im using PDF file, with your example for digital signature. Arabic fonts not shown correctly

Johnmc13
 
Posts: 8
Joined: Fri Sep 24, 2021 8:11 am

Tue Mar 19, 2024 8:50 am

Hello,

Thanks for your reply.
Please refer to the following method to add a digital signature.
Code: Select all
String inputFile = @"test.pdf";
String outputFile = @"res.pdf";
String inputFile_Pfx = @"gary.pfx";

PdfDocument doc = new PdfDocument();
doc.LoadFromFile(inputFile);
X509Certificate2 x509 = new X509Certificate2(inputFile_Pfx, "e-iceblue");
PdfOrdinarySignatureMaker signatureMaker = new PdfOrdinarySignatureMaker(doc, x509);
PdfCustomSignatureAppearance pdfCustomSignatureAppearance = new PdfCustomSignatureAppearance();

for (int i = 0; i < doc.Pages.Count; i++)
{
    signatureMaker.MakeSignature("signName_" + (i + 1), doc.Pages[i], 100, 100, 250, 200, pdfCustomSignatureAppearance);
}

doc.SaveToFile(outputFile, FileFormat.PDF);
doc.Close();
public class PdfCustomSignatureAppearance : IPdfSignatureAppearance
{
    public void Generate(PdfCanvas g)
    {
        float x = 2;
        float y = 2;
        float fontSize = 10;
        PdfTrueTypeFont font = new PdfTrueTypeFont(new Font("Arabic", fontSize), true);
        float lineHeight = fontSize;
        g.DrawString("التوقيع الرقمي: مرحبا ", font, PdfBrushes.Red, new PointF(x, y));
        y += lineHeight;
        g.DrawString("التوقيع الرقمي: مرحبا", font, PdfBrushes.Red, new PointF(x, y));

    }
}


If your issue still exists, please provide us with the following information for further investigation.
1) Your input file and data (if any)
2) The code and the verion of Spire.Pdf that you are using
3) Your environment, such as OS information (E.g. Windows 10, 64 bit) and region settings (E.g. China, Chinese)
4) Your application type, such as Console app (. Net Framework 4.5) or springboot (JDK8)

Sincerely,
William
E-iceblue support team
User avatar

William.Zhang
 
Posts: 203
Joined: Mon Dec 27, 2021 2:23 am

Return to Spire.Doc