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

Free Support Forum - aspose.com

Performance of the document.save method

Hi,


I am using Aspose 4.5 and com.aspose.pdf packages.

I generating around 250 pages which has basically same tabular data in each of the 250 pages . The Document.save() method which saves into a fileoutputstream takes 64 Seconds (Around 2MB of data in the filesystem). This seems slow for our requirements.

  1. Do you have performance benchmark data that you can share for save method . ?
  2. Is it linear to the number of pages or the size of the data that’s written. ?
  3. Do you performance figures for the Aspose 4.5 library for the major functionalities ?
  4. Can you suggest your recommendation to boost the performance when using Aspose 4.5 library specifically com.aspose.pdf classes. ?
  5. Please also share the process of escalation for customers of Aspose libraries because we have come upon many issues due to which feel the library is not production ready and we feel such issues needs to be urgently addressed.
Regards
Praveen







praveen.achuthan:
I generating around 250 pages which has basically same tabular data in each of the 250 pages . The Document.save() method which saves into a fileoutputstream takes 64 Seconds (Around 2MB of data in the filesystem). This seems slow for our requirements.
Hi Praveen,

Thanks for using our API’s.

Can you please share some code snippet so that we can test the scenario at our end.
praveen.achuthan:
  1. Do you have performance benchmark data that you can share for save method . ?
  2. Is it linear to the number of pages or the size of the data that’s written. ?
Currently we do not have any benchmark data/sheet which can give the information regarding time taken by the application to generate PDF files with certain number of pages. However the time taken by the application depends upon the contents and nature of contents being placed inside the document.
praveen.achuthan:
  • Do you performance figures for the Aspose 4.5 library for the major functionalities ?
  • Can you suggest your recommendation to boost the performance when using Aspose 4.5 library specifically com.aspose.pdf classes. ?
  • Before we recommend any solution for performance improvement, we first need to test and replicate this problem in our environment.
    praveen.achuthan:
  • Please also share the process of escalation for customers of Aspose libraries because we have come upon many issues due to which feel the library is not production ready and we feel such issues needs to be urgently addressed.
  • The current Aspose.Pdf for Java is an autoported version from its sibling Aspose.Pdf for .NET so there are some issues and areas where this API is lacking. However with every new release, we are working on fixing the earlier reported issues and trying to make this API robust enough so that it can meet customer’s expectations. Furthermore, as a normal rule of practice, issues are resolved in first come
    and first serve basis; but the problems logged/reported under Enterprise or
    Priority support model, have high precedence in terms of resolution, as compare
    to issues under normal/free support model.

    In case you need to have your issue prioritized, you may consider opting for Enterprise or Priority support options. Nonetheless, note that ES/PS support does not guarantee any immediate resolution of issues (because it might be dependent on other issues or feature which needs to be implemented) but under this model, the development team starts investigating the problem on high priority. For further details, please visit Support Options.

    Please find the source code below. It generates just a single page taking 40 seconds for the save method to execute. The culprit seems to be TextState API implementation . And this is the reason why I think the Aspose 4.5 API for java is not production ready (This version and com.aspose.pdf package was specifically recommended to be used by you in another forum thread ). We cannot have API’s like that which is open to use without specific documentation . If each row we need to set a different cell text state ,this is going take forever if the pages that is going to be generated is more than 50.


    package com.arbitron.pdflibrary;

    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.util.Locale;

    import com.aspose.pdf.BorderInfo;
    import com.aspose.pdf.BorderSide;
    import com.aspose.pdf.Cell;
    import com.aspose.pdf.CellBorderStyle;
    import com.aspose.pdf.Color;
    import com.aspose.pdf.Document;
    import com.aspose.pdf.DocumentInfo;
    import com.aspose.pdf.FontStyles;
    import com.aspose.pdf.HorizontalAlignment;
    import com.aspose.pdf.License;
    import com.aspose.pdf.MarginInfo;
    import com.aspose.pdf.Page;
    import com.aspose.pdf.PageInfo;
    import com.aspose.pdf.PageSize;
    import com.aspose.pdf.Row;
    import com.aspose.pdf.Table;
    import com.aspose.pdf.TextFragment;
    import com.aspose.pdf.TextState;
    import com.aspose.pdf.VerticalAlignment;

    public class TestAsposePerfIssue {
    public static void main(String[] args){
    Locale.setDefault(Locale.ENGLISH);
    License lic = new License();
    try {
    lic.setLicense(new FileInputStream(“d:\work\Aspose.Total.Java.lic”));
    } catch (FileNotFoundException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }
    Document doc = getPdf();
    Page page = doc.getPages().add();
    Table table = new Table();
    table.setRepeatingRowsCount(1);
    table.setColumnWidths(“50 50 50 50 50 50 50 50 50 50”);
    Color color = Color.getWhite();
    table.setBackgroundColor(color);
    MarginInfo marginInfo = new MarginInfo();
    float marginLeft = 2;
    float marginRight = 2;
    float marginTop = 2;
    float marginBottom = 2;
    marginInfo.setLeft(marginLeft);
    marginInfo.setRight(marginRight);
    marginInfo.setTop(marginTop);
    marginInfo.setBottom(marginBottom);
    table.setDefaultCellPadding(marginInfo);
    int numRows = 10;
    int numCols = 10;
    for (float i=1;i <= numRows;i++){
    Row row = table.getRows().add();
    BorderInfo borderInfo = new BorderInfo(BorderSide.None);
    row.setDefaultCellBorder(borderInfo);
    java.awt.Color awtdefaultbgcolor = null;
    if(i % 2 == 0){
    awtdefaultbgcolor = java.awt.Color.GRAY;
    }else if(i % 3 == 0){
    awtdefaultbgcolor = java.awt.Color.YELLOW;
    }else{
    awtdefaultbgcolor = java.awt.Color.BLUE;
    }
    color = Color.fromArgb((short)awtdefaultbgcolor.getRed(), (short)awtdefaultbgcolor.getGreen(), (short)awtdefaultbgcolor.getBlue());
    row.setBackgroundColor(color);
    TextState textState = new TextState();;
    textState.setFontStyle(FontStyles.Bold);
    textState.setFontSize(12);
    textState.setForegroundColor(java.awt.Color.BLACK);
    row.setDefaultCellTextState(textState);
    for(int j=0;j < numCols;j++ ){
    Cell cell = row.getCells().add();
    CellBorderStyle cellBorderStyle = new CellBorderStyle(color, true);
    cellBorderStyle.setLineWidth(0.1f);
    borderInfo = new BorderInfo(BorderSide.All, cellBorderStyle);
    cell.setBorder(borderInfo);
    cell.setVerticalAlignment(VerticalAlignment.Center);
    cell.setAlignment(HorizontalAlignment.Center);
    if(i == 1){
    TextFragment text = new TextFragment("Header "+ j);
    cell.getParagraphs().add(text);
    }else{
    TextFragment text = new TextFragment("Value “+ i + “:” + j);
    cell.getParagraphs().add(text);
    }
    }
    }
    page.getParagraphs().add(table);
    long before = System.currentTimeMillis();
    doc.save(“TestAsposePerf.pdf”);
    long after = System.currentTimeMillis();
    System.out.println(“Time taken for save :” + ((after - before) / 1000) + " Seconds”);
    }
    public static Document getPdf(){
    Document pdf = new com.aspose.pdf.Document();
    DocumentInfo docInfo = pdf.getInfo();
    docInfo.setAuthor(“Perf”);
    PageInfo pageInfo = pdf.getPageInfo();
    MarginInfo marginInfo = pageInfo.getMargin();
    float marginLeft = 10;
    float marginRight = 10;
    float marginTop = 10;
    float marginBottom = 10;
    marginInfo.setLeft(marginLeft);
    marginInfo.setRight(marginRight);
    marginInfo.setTop(marginTop);
    marginInfo.setBottom(marginBottom);
    pageInfo.setHeight(PageSize.getPageLetter().getHeight());
    pageInfo.setWidth(PageSize.getPageLetter().getWidth());
    pageInfo.isLandscape(true);
    return pdf;
    }

    }

    Hi Praveen,


    Thanks for sharing the code snippet.

    I have tested the scenario and I am able to
    notice the same problem. For the sake of correction, I have logged this problem
    as PDFNEWJAVA-34059 in our issue tracking system. We will further
    look into the details of this problem and will keep you updated on the status
    of correction. Please be patient and spare us little time. We are sorry for
    this inconvenience.
    Hi

    I think/hope this problem is of high priority for me as well the Aspose team . If not let me know the reasons.

    Please update and give a fix for this as soon as possible.

    Please let me know.

    Regards
    Praveen

    Hi Praveen,


    Thanks for your patience.

    As we
    recently have been able to notice this issue, so development team requires
    little time to investigate and figure out the reasons of this problem. As soon as we have made some definite progress towards
    its resolution, we would be more than happy to update you with the status of
    correction.
    <o:p></o:p>

    Hi Praveen,


    Thanks for your patience.

    I am pleased to share that the issue (PDFNEWJAVA-34059) reported earlier is resolved in latest release of Aspose.Pdf for Java 9.0.0. Please note that in this release, we have made some changes in API.

    Instead of using

    com.aspose.pdf.CellBorderStyle cellBorderStyle = new CellBorderStyle(color, true);

    please try using

    com.aspose.pdf.GraphInfo cellBorderStyle = new com.aspose.pdf.GraphInfo();
    cellBorderStyle.setColor(color);

    Hi Praveen,


    Adding more to my previous comments, instead of using

    textState.setForegroundColor(java.awt.Color.BLACK)

    please try using 

    textState.setForegroundColor(com.aspose.pdf.Color.getBlack())

    The issues you have found earlier (filed as PDFNEWJAVA-34059) have been fixed in Aspose.Pdf for Java 9.1.0.


    This message was posted using Notification2Forum from Downloads module by Aspose Notifier.