We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to Add PMingLiu Font / MingLiU Font on a particular PDF Field?

Hi

I am using ASPOSE PDF plugin to generate a PDF from a template and i need to insert HKSCS Text in a field

May i know how to set the font for a particular field while inserting data .
I was looking into form.FillField method but i don’t see any suitable overloads for it.

Please find the sample screenshot where i am trying to insert the text.
Here chin_name is a pdf form field name

image.png (2.3 KB)

Also i am not able to find the font styles “PMingLiu” and “MingLiU” in the plugin.
These font styles support HKSCS text.

How do i get these available in my project ?

IDE Used : Visual Studio 2017
Language : C#
Framework : MVC
Aspose PDF Version : 18.11.0.0

Thanks
Nishchay

@nishchay89

Thank you for contacting support.

You may use below code snippet to specify particular font for a form field as explained in Set Form Field Font Other Than the 14 Core PDF Fonts.

// Open document
Document pdfDocument = new Document(dataDir + "FormFieldFont14.pdf");

// Get particular form field from document
Aspose.Pdf.Forms.Field field = pdfDocument.Form["textbox1"] as Aspose.Pdf.Forms.Field;

// Create font object
Aspose.Pdf.Text.Font font = FontRepository.FindFont("ComicSansMS");

// Set the font information for form field
field.DefaultAppearance = new DefaultAppearance(font, 10, System.Drawing.Color.Black);

dataDir = dataDir + "FormFieldFont14_out.pdf";
// Save updated document
pdfDocument.Save(dataDir);

We hope this will be helpful. Please feel free to contact us if you need any further assistance.