Getting errors while processing PDF file



We are looking at purchasing Aspose.PDF.kit library for Java. I am playing with its demo version now. We are very pleased to see that provided classes and methods meet our needs. We are about to purchase development licence for it. But I have 3 questions which need to be answered before we make a final desision. All 3 questions are about the most important for us method ReplaceText of pdfContentEdtor class.

1. When I run a simlple test against our regular input PDF files and replace just one entity of text content there the file increses the size from 70k to more than 300k. Is it caused by applying a watermark and some other demo-version limitations or it is normal behavior?

3. When I run sample code for ReplaceText it comes up with bunch of screen output. Is there any way to make it silent? Or it is just a "feature" of a demo verson?

2. For some of our files (not for all of them) the following test code (mostly cut-and-paste of your sample code from the kit):

import com.aspose.pdf.kit.*;

public class ReplaceText {
public ReplaceText() {}

static String path = "./examples/resources/";

public static void main(String args[]) throws Exception {
try {
PdfContentEditor editor = new PdfContentEditor();
editor.bindPdf(path + "plaintest.pdf");
editor.replaceText("country", "motherland"); + "plaintest-repl.pdf");
catch ( ioe) {
System.out.println(ioe.getMessage() + ioe.getStackTrace());

throws the following exception:

Unexpected type[Ljava.lang.StackTraceElement;@1a758cb

What would be the root cause of that? I attached the test input file if needed. It happens for some of our PDF 1.4 files, all PDF 1.2 files run just fine. PDFs are valid files, which get open by Adobe and other PDF tools without any problem.

Please, respond a.s.a.p. so we could make appropriate purchase desision.


Sergey Gorelov, software engineer @ Audatex, a Solera company


Thanks for considering Aspose.

  1. Could u provide the pdf document whose size increase observably, we want to have a test to find out reasons.
  2. The bunch of screen output when running sample code for ReplaceText is technically designed to illuminate the replacing process, we will provide a way to make it silent soon.
  3. I 've tested your codes and met the same error. We will inform our developers to find out reasons ASAP.


Thanks for your quick response.

I am attaching the document which changes its size from 70k to 300k after doing a replacement using your sample code (try any replacement you want).

We need items 2 and 3 solved a.s.a.p. to make a purchase desision.

Thanks a lot.

Sergey Gorelov.


Dear usgor,

Thank you for considering Aspose.

We have test the files you attached.
1. 'The size changing problem after doing a replacement' because we have a particular way to rewrite the Pdf file and we could not fix this problem (reduce size) in a short time now.
2. We have fixed the screen output problem.
3. The error occured during ReplaceText because the Pdf file is NOT a normal document though it could be opened by Acrobat Reader and other pdf readers correcttly. We need 3~5 days to fixed this problem.

Thank you for your patience.


Thank you for your response.

We really appreciate your efforts to make this product meet our needs. Fixing items 2 and 3 makes it really useable for us. Although item 1 is still an issue. Our original files may get up to 100k and if after ReplaceText processing they become 0.5M, our customer may not like it. Can you recommend any PDF compression tools to bring the size back to some acceptable size? We can try developing a process which would run this compressor after ReplaceText is done.


Sergey Gorelov, Software Engineer @ Audatex, a Solera company


We can use search engine to find the product to reduce the pdf's size and we will release a version in 2 days which meet your needs(point 2 and 3). If you can wait, we are try our best to reduce the result pdf file's size, which may spend 2~3 weeks.


Thanks a lot for your quick responses. 2-3 weeks is perfectly fine for us since we are at the design stage now and real coding will start only after we purchase your product. Please, let me know when the file size problem gets fixed (together with items 2 and 3) and will present your product to the management to get purchase approval.

Thanks again and looking forward for future cooperation.

Sergey Gorelov, software engineer @ Audatex, a Solera company


We have released Aspose.Pdf.Kit for Java 1.6.0, which has the feature fulfil your requirement. You can download it here:


Thanks a lot! I will give it a try and let you know. Appreciate your efforts.

Sergey Gorelov, software engineer @ Audatex, a Solera company