Font Replace Error

Technical support for Spire.PDF

Moderator: iceblue support

Font Replace Error

Postby ck@mp2.at » Tue Jul 11, 2017 12:57 pm

Hi,

i have an exisitng PDF File created from an PDF Printer. If i want to replace all Used Fonts with Arial i get the following error message:

can not replace font, the font is already embedded.

Here is my code:
Code: Select all
String fontFileName = @"c:\windows\fonts\Arial.ttf";
   Spire.Pdf.PdfDocument doc = new Spire.Pdf.PdfDocument();
   doc.LoadFromFile(file);
   PdfUsedFont[] fonts = doc.UsedFonts;
   foreach (PdfUsedFont font in fonts)
   {
      PdfTrueTypeFont trueTypeFont = new PdfTrueTypeFont(fontFileName, font.Size,font.Style);
      font.Replace(trueTypeFont);
   }
   doc.SaveToFile(@"c:\temp\output.pdf");
ck@mp2.at
 
Posts: 2
Joined: Tue Sep 09, 2014 6:14 am

Re: Font Replace Error

Postby Jane.Bai » Wed Jul 12, 2017 3:44 am

Hello,

Thanks for your inquiry.
To help us reproduce the issue, could you please share your sample pdf file and the related font file with us?

Many Thanks,
Jane
E-iceblue support team
User avatar
Jane.Bai
 
Posts: 344
Joined: Tue Nov 29, 2016 1:47 am

Re: Font Replace Error

Postby ck@mp2.at » Tue Jul 18, 2017 11:02 am

Hi,

here is the sample PDF. The font is the default Windows Arial.ttf.

Regards.
You do not have the required permissions to view the files attached to this post.
ck@mp2.at
 
Posts: 2
Joined: Tue Sep 09, 2014 6:14 am

Re: Font Replace Error

Postby Betsy.jiang » Wed Jul 19, 2017 2:34 am

Hello,

Thanks for sharing the file.
I have reproduced the issue and posted it to our Dev team. We will let you know as soon as there is any progress.
Sorry for inconvenience caused.

Sincerely,
Betsy
E-iceblue support team
User avatar
Betsy.jiang
 
Posts: 1421
Joined: Tue Sep 06, 2016 8:30 am

Re: Font Replace Error

Postby Jane.Bai » Thu Jul 20, 2017 2:44 am

Hello,

After an initial test, our dev team found that there was unicode encoding in your pdf document. Becasue of this, the raplace operation might corrupt the inner chracter mapping and cause garbled data. Therefore, there might be no solution to your issue in a short time.
Sorry for the inconvenience caused.

Sincerely,
Jane
E-iceblue support team
User avatar
Jane.Bai
 
Posts: 344
Joined: Tue Nov 29, 2016 1:47 am


Return to Spire.PDF

Who is online

Users browsing this forum: No registered users and 0 guests