We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Replace Text in existing PDF Files

Hi!
I'm considering to use aspose to develop our company's online pdf translation service.
So we need to code as follows:
1. extract text from a existing pdf file
2. translate text
3. use the translation text to replace the original text

which class should I use?
- com.aspose.pdf.kit.PdfContentEditor
- com.aspose.pdf.kit.PdfExtractor
or other low-level api?

can someone give me some sample code?

Thank you in advance.
Ryouma.

Hi Ryouma,

I would like to inform you that Aspose.Pdf.Kit for Java allows you to extract text from a PDF file. This extracted text is in raw format. That is, you can get the text without any formatting information. This component also allows you to add text in an existing PDF file, if you already have the text formatting information like font name, font size etc.

However, as you want to extract text and then replace it with a translated version, I’m afraid, it is currently not feasible. However, if you could share some more details along with sample input and output templates etc., our team might be able to investigate such new requirement and try to support in future. Nevertheless, as you can understand, such kind of requirement is not simple, so we can’t promise this to be supported in short time.

We’re sorry for the inconvenience.
Regards,


Hi Shahzad Latif,

Thanks for your reply.

I notice that com.aspose.pdf.kit.PdfContentEditor.replaceText method can do text replace function. I think that PdfContentEditor use some low-level api to do that work. Is it impossible to provide the document of low-level api or the source code of PdfContentEditor.replaceText ?

Thank you in advance.

Ryouma.

Hi Ryouma,

I’m sorry to inform you that we do not provide the documentation of the internal implementation or the source code.

We’re sorry for the inconvenience.
Regards,