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

Free Support Forum - aspose.com

Issues with performance when converting PDF to Word

Hello, we are evaluating Aspose.PDF for Java (18.12) for pdf conversion to .doc. We plan on using this library inside web application, but there are some performance concerns. Save operation depending on input document takes several seconds (5-7 s) first time, but every other time it takes only second or two when this is done in single thread. Is there a way to optimize multithreaded code so that subsequent operations in different threads don’t take more than few seconds per operation? Is there a way to reuse some aspose objects to speed up save method? Please find attached sample class and tested pdf test.zip (37.0 KB)


Thank you for contacting support.

Please note that Document Object Model (DOM) of Aspose.PDF for Java API is loaded into memory and necessary resource allocation takes place during first iteration. It causes little delay as compared to subsequent conversions for being default behavior of Java.

We hope this will be helpful. Please feel free to contact us if you need any further assistance.


I think we did not understand each other very well. Let’s say we have a servlet in web application deployed to application server.
When called servlet converts local pdf to doc and in HTTP response returns time spent in com.aspose.pdf.Document.save(String outputFileName, SaveOptions options) method.
So every time I call this servlet it takes several seconds(5-7s for small plain pdf) to complete com.aspose.pdf.Document.save() method.

You are saying that Aspose.PDF DOM model is loaded in memory each time when servlet is called?
If this is true, is there a way to “keep” Aspose.PDF DOM model in memory for subsequent servlet requests?
Can we use some objects as static instances and reuse them in thread-safe manner?
Or nothing can be done, and you consider this to be default/normal/good Aspose.PDF for java behavior?

Please find servlet code below.

package test;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.aspose.pdf.DocSaveOptions;
import com.aspose.pdf.Document;


  • Servlet implementation class AsposeConvertServlet
    public class AsposeConvertServlet extends HttpServlet {
    private static final long serialVersionUID = 1L;


    • @see HttpServlet#HttpServlet()
      public AsposeConvertServlet() {

           * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
           protected void doGet(HttpServletRequest request, HttpServletResponse response) 
                                          throws ServletException, IOException {
                          DocSaveOptions saveOptions = new DocSaveOptions();
                          Document doc = new Document("c:\\tmp\\input.pdf");
                          long t1 = System.currentTimeMillis();
                          doc.save("c:\\tmp\\test.doc", saveOptions);
                          long t2 = System.currentTimeMillis();
                          response.getWriter().append("Conversion took ").append(t2-t1+" ms");
           * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
           protected void doPost(HttpServletRequest request, HttpServletResponse response) 
                                          throws ServletException, IOException {
                          doGet(request, response);



Thank you for elaborating it further.

We have logged a ticket with ID PDFJAVA-38326 in our issue management system for detailed investigations if some improvements can be suggested for your scenario. We will let you know once some significant updates will be available.