I am trying to change font type in pdf. I am getting an error
|Severity|Code|Description|Project|File|Line|Suppression State|
|---|---|---|---|---|---|---|
|Error|CS0030|Cannot convert type 'Aspose.Pdf.XImage' to 'Aspose.Pdf.Text.TextFragment'|CreateDocument.Core|C:\Cloud\AddoCreateDocument....
// Specify the desired font name
string desiredFontName = "Arial";
// Loop through all pages and set the font name
foreach (Aspose.Pdf.Page page in pdfDocument.Pages)
{
// Loop through all the text fragments on the page
foreach (TextFragment textFragment in page.Resources.Images)
{
// Set the desired font name
textFragment.TextState.Font = FontRepository.FindFont(desiredFontName);
}
}
// Save the modified PDF document
pdfDocument.Save("output.pdf");