Aspose PDF Replace multiple occurrences of text in different fonts from installed fonts not embedded fonts

Replace text in PDF without embedded full fonts.
Problem: PDF contains subsetted fonts and cannot embed entire font in the PDF. Font is unknown when replacing text and existing font must be used. Replacement text is not contained in the subsetted font and the replaced text uses a default font.
With Aspose PDF .Net and fonts installed on the server replacing multiple occurrences of the same text in different fonts works well.
Can this be done with Aspose PDF Cloud?
I tried uploading to my application default storage Fonts/SomeFontA.ttf, Fonts/SomeFontB.ttf but this does not work.

1 Like

@davegenthe

Thanks for your inquiry. We will appreciate it if you could please share your input document along with the current output and expected output. It will help us address your issue exactly.

Attached is a file where text surrounded with {} will be replaced. My expected output is that the text is replaced with the same font, size, style, etc. For instance {PFNm} is replaced with Dave.Doc Talk Series.pdf (1.0 MB)

@davegenthe

You can use a specific font from cloud storage for the replacement as follows. Please check that it serves your purpose or not; otherwise, we will log a ticket for further investigation and resolution.

{
  "TextReplaces": [
    {
      "OldValue": "{PFNm}",
      "NewValue": "Dave",
      "Regex": true,
      "TextState": {
        "FontFile": "Fonts/archivo.bold.ttf",
      }
    }
  ]
}

I do not know the font for every text replacement and I want the font information to be retained.
Does the FontFile parameter accept a list of possible fonts or just a directory where all possible fonts exist?
The Aspose PDF .Net library automatically finds the font installed on the server and I do not have to specify the font. I need the same capability for the Cloud product.

@davegenthe

We have logged an enhancement ticket(PDFCLOUD-3672) for your requirement. We will update you as soon as it is resolved.

Secondly, please note that, in the case of the on-premise API(Aspose.PDF for .NET) it uses fonts from your server. However, in the case of the Aspose.PDF Cloud API, we cannot provide all the fonts on our server due copyright issue.