I am working on a program that copies certain contents of a PDF document to another document, and I can’t seem to get the font embedded in the document to copy over. I am using Aspose.PDF 22.214.171.124 in a C# application. My current attempt at copying over the font information is something like this:
using (Document document1 = new Document(filename1))
using (Document document2 = new Document(filename2))
var res = document2.Pages.ElementAt(0).Resources.GetFonts(true); //CreateIfAbsent is set to true just in case the document is missing fonts/text
origDoc.Pages.ElementAt(0).Resources.GetFonts(true); //this document has no font information to begin with, so I use this call simply for the CreateIfAbsent flag
foreach (var addFont in res)
document1.Pages.ElementAt(0).Resources.Fonts.Add(addFont, out resName);
Both of my PDF documents are single-page (hence why I use ElementAt(0)). When looking at both documents in Adobe Acrobat, document2 (where the font should be coming from) says that it contains the font Helvetica,
document2.PNG (6.1 KB)
while document1 (where font should be copied to) says that it contains the font Arial.
document1.PNG (4.7 KB)
Is there something obvious I am doing wrong, or is there a field in one of my objects I need to change for the font to copy over correctly?