Hi there
We’re encountering an issue with font substitution when editing a PDF created by Aspose in Acrobat Pro. Please see attached PDF sample (concat-font-issue.pdf). When attempting to edit the text (“As of 12/30/2016…”, the text is garbled due to what I assume is font substitution. I’ve included the source documents that were used by Aspose to concat into one single document. And also the code to locate the font and embed it.
Here is the code used to concatenate.
var docStream = new FileStream(@“C:\temp\font issue.pdf”, FileMode.Open);
var docStream2 = new FileStream(@“C:\temp\newpage.pdf”, FileMode.Open);
var outputStream = new MemoryStream();
var pdfEditor = new PdfFileEditor();
pdfEditor.Concatenate(docStream, docStream2, outputStream);
var doc = new Aspose.Pdf.Document(outputStream);
doc.Save(@“C:\Temp\concat-font-issue.pdf”);
Code to loop through pages, and embed each font fully
foreach (Aspose.Pdf.Page page in doc.Pages)
{
if (page.Resources.Fonts != null)
{
foreach (Aspose.Pdf.Text.Font pageFont in page.Resources.Fonts)
{
// Check if the font is embedded
if (!pageFont .IsEmbedded)
pageFont .IsEmbedded = true;
}
Thanks in advanced for your help.