Chang the font name for entire PDF file using Aspose.PDF for .NET (vb.net)

Do anyone know how to change the font name to "Arial" for entire pdf file ?

Thanks!!!

You can just select the TextInfo.FontName object of your pdf instance and set it to "Arial"


Pdf testPdf = new Pdf()

testPdf.TextInfo.FontName = “Arial”

Hello wei,

Thanks for considering Aspose.

For further information, please visit Font Handling

In case of any further query, please feel free to contact.

I am using Pdf Winform Demo and insert 2 lines of codes, but nothing changed:

Case "Alphabetical List of Products"

Dim demo As AlphabeticalList = New AlphabeticalList(ResPath)

pdf1 = demo.GetAlphabeticalList()

'''

pdf1.TextInfo.FontName = "Times-Roman"

pdf1.TextInfo.FontSize = 100

'''

pdf1.Save(afileName)

Return pdf1

Hello wei,

Thanks for considering Aspose.

If you need to embed the font information in resultant PDF document, please visit the following link for required information Fonts embedding while creating PDF

In case still it does not satisfy your requirement, please feel free to contact.

What I really want is simple!

I have a pdf file (c:\ABC.pdf). I want to change the contents of this pdf file to "Arial" font via vb.net

Hello wei,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Please take a look over the following simple code snippet in which I've generated a PDF document which contains a simple text string in ARIAL font and the font information is embedded in the resultant PDF.

[C#]

//Instantiate Pdf instance by calling it empty constructor
Pdf pdf1 = new Pdf();
//Create a section in the Pdf object
Aspose.Pdf.Section sec1 = pdf1.Sections.Add();
//Create a text paragraph inheriting text format settings from the section
Text text1 = new Text(sec1);
//Add the text paragraph to the section
sec1.Paragraphs.Add(text1);

//Create text segment
Segment s2 = new Segment(" Sample Text in Arial Font");
//Set the font name to the TextInfo.FontName property of segment
s2.TextInfo.FontName = "Arial";
//Add text segment to the text paragraph
text1.Segments.Add(s2);
// embed the font information into the PDF document.
text1.TextInfo.IsFontEmbedded = true;

//Save the Pdf
pdf1.Save(@"d:/pdftest/Font_Issue.pdf");

The resultant PDF is in attachment, please take a look.

Beside this, if you need to change the font information for any existing PDF file, I am afraid this feature is not supported.

FYI. Aspose.Pdf is a component which is used to generate PDF documents from scratch, whereas we have another component named Aspose.Pdf.Kit which is used to manipulate/edit existing PDF documents. But I am afraid Aspose.Pdf.Kit lacks the capability to change the font information for an existing PDF file.

In case it does not resolve your problem, or you've any further query, please feel free to contact.

I actually need to change the font information for an existing PDF file which is generated by Xerox machine. The file is not using Windows system font, so we cannot not edit the PDF manually. Is there any way to make it editable?

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Hello wei,

Sorry for replying you late.

As I’ve already mentioned Aspose.Pdf.Kit is used to manipulate/edit existing PDF documents, but I am afraid changing the font information for existing PDF is not yet supported.

Meanwhile for the sake of confirmation, I’ll also contact with the Aspose.Pdf.Kit team and they will update you with the status of correction.

PS, For your convenience, I am also moving this thread to Aspose.Pdf.Kit forum.

@allenph2005

We would like to share with you that you can now Set Default Font Name while Saving a PDF document using Aspose.PDF for .NET.