Use custom fonts in search and replace text in PDF document with Aspose.PDF REST API

Hi

So I have a PDF with a text. I want to search and replace the text. I already found the example how to search and replace text in a PDF and I got the this example working with the Aspose Cloud.

But now I have the following issue. The text is in a custom font. I noticed that the output PDF was not using my font.

Is there a example how to insert the font?

Hi,


Thanks for contacting support.

I am afraid currently Aspose.Pdf for Cloud does not support the feature to specify font while replacing text inside PDF files. However for the sake of correction, I have logged this requirement as SAASPDF-118 in our issue tracking system. We will further
look into the details of this requirement and will keep you updated on the status
of correction. Please be patient and spare us little time. We are sorry for
this inconvenience.

Thank you for the quick reaction.

Another question … is there any other way to use custom fonts with the pdf cloud service?

Hi,


I am afraid currently Aspose.Pdf for Cloud does not support the feature to use Custom fonts while adding text to PDF files. For the sake of correction, I have logged this requirement as SAASPDF-119 in our issue tracking system. We will further
look into the details of this requirement and will keep you updated on the status
of correction. Please be patient and spare us little time. We are sorry for
this inconvenience.

I see …

So what about the Java version? Is it possible to do search&replace text in PDF with custom fonts?

Hi,


Aspose.Pdf for Java supports the feature to find and replace text and use custom fonts. For further information, please visit Replace Text in Pages of a PDF Document

@info99

The latest version of Aspose.PDF Cloud supports the use of custom fonts for search and replace text in PDF documents. Please check PostDocumentTextReplace API method for the purpose. You can upload your custom font file to cloud storage and specify its path in the FontFile parameter.

curl -X POST "https://api.aspose.cloud/v3.0/pdf/Test.pdf/text/replace" 
-H "accept: application/json" 
-H "authorization: Bearer [Access_Token]" 
-H "Content-Type: application/json" 
-H "x-aspose-client: Containerize.Swagger" 
-d "{ \"TextReplaces\": [ { \"OldValue\": \"Thin\", \"NewValue\": \"Bold\", \"Regex\": true, \"TextState\": { \"FontFile\": \"Fonts/NotoSans-SemiCondensedThin.ttf\" } } ]}""