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

Free Support Forum - aspose.com

PDF Compression Performence issue in v 17.6

Hi Asad Ali,

I have created new Post using this Free support Forums.

As per your suggestion I have downloaded the v 17.6 DLL and I complied with debug Mode and it is not giving Out of memory issue. But still when I enable the compress PDF Mode. It is taking lot of time to process one item. for 50Pages of Images it is taking more than 10min. Please can you ask your development team to fix this performance issue as soon. Our customer is asking the ETA for this. And we are getting very much bad impression on us with Customer. Please I request you to ask the development to make the necessary changes and fix this performance issue as soon.

You have replied this

I have tested the scenario with latest version of the API and was able to notice that API was taking long time to process the PDF document(s). As this performance issue has already been logged in our issue tracking system as PDFNET-42755, so I have updated the the issue details with our latest findings.

Please fix and reply as soon.

Since it is customer facing issue. Also this is high priority production issue on my side. Please provide a solution as soon.

Thanks & Regards,
P. Saravanan.

Hi Saravanan,

Thanks for writing back.

As shared earlier that we have requested development team to investigate the issue and share an ETA, so as soon as we have some feedback from their side, we will definitely let you know. I am also associating the issue ID with this forum thread as well, so that you will be notified once the issue is resolved.

Please be patient and spare us little time. We are sorry for the inconvenience.


Best Regards,
Asad Ali

Hi Asad Ali,

Do we have any update for this issue. PDFNET-42755 Ticket issue is fixed? Please provide a fix as soon and let us know the status. Our Customer is asking daily about the status. They are very much upset on this.
Please provide a fix as soon.

Sorry to you bugging this.

Thanks & Regards,
P. Saravanan.

@Saravanan_Palanisamy

Thanks for posting your inquiry.

I am afraid that earlier logged issue is not resolved yet. Please note that we do realize the severity of the issue but there are other high priority issues in the queue which are meant to be resolved first as they were logged prior to yours. Although we have recorded your concerns and intimated product team about them. We are sure that a fix against your issue will be provided soon.

We greatly appreciate your patience and cooperation in this regard. Please spare us little time. We are sorry for the inconvenience.


Best Regards,
Asad Ali

Thank you! Please provide ETA for this so that we will provide this to our Customer.

Regards,
P. Saravanan.

@Saravanan_Palanisamy

Thanks for writing back.

We have requested relevant team to share an ETA (if possible) and as soon as we have some feedback from their side, we will surely inform you. Please spare us little time.

We are sorry for the inconvenience.


Best Regards,
Asad Ali

Hi Asad ali,

Now are facing the performance issue in With out Compression also. we process the 1200 Pages of images and creates the PDF File size with 32MB Max and it we creates the PDFs. This is having performance issue. It takes 15-20 minutes in our application. We used Latest version of Aspose.PDF.Dll v 17.6

Performance issue without Compression - 15-20Min to process Single item with 1200 Pages.

Performance issue with Compression - More than 30min to process Single item with 1200 Pages.

Please provide both fixes as soon.

Please find below my code snippet.

    private void CreatePDF(ref R2Item r2Item)
    {
        this.ClientStatusMessage = string.Format("Retrieving Images ...", r2Item.ItemName);
        Document doc = new Document();
        int pdfCount = 1;
        int nPageCount = 0;
        int nOptimizePageCount = 0;
        ListPageCount = new Dictionary<string, Int32>();
        tempLocalPDFPath = Path.GetTempPath() + r2Item.ItemName;            
        if (Directory.Exists(tempLocalPDFPath))
            Directory.Delete(tempLocalPDFPath, true);
        Directory.CreateDirectory(tempLocalPDFPath);
        nOptimizePageCount = Convert.ToInt32(ConfigurationManager.AppSettings["OptimizePageCount"].ToString());            
        for (int i = 0; i < r2Item.FileList.Count; i++)
        {
            if (r2Item.FileList[i].AttachmentType.ToUpper().Trim() == "IMAGE")
            {
                try
                {
                    nPageCount++;                                                
                    MemoryStream ms = new MemoryStream();
                    AddPDFPage(doc, r2Item.FileList[i].FileBytes);
                    doc.Save(ms);
                    if (ConfigurationManager.AppSettings["RequiredOptimize"].ToString() == "true")
                    {
                        ms.Seek(0, SeekOrigin.Begin);
                        doc = new Document(ms);
                        OptimizePDFDocument(ref doc);
                        ms.Flush();
                        doc.Save(ms);
                    }
                    long filesize = ms.Length;
                    if (i == r2Item.FileList.Count-1)
                    {
                        this.ClientStatusMessage = string.Format("Saving... {0} ", r2Item.ItemName + "_" + pdfCount.ToString().PadLeft(3, '0') + ".pdf");
                        doc.Save(tempLocalPDFPath + "\\" + r2Item.ItemName + "_" + pdfCount.ToString().PadLeft(3, '0') + ".pdf");
                        ListPageCount.Add(r2Item.ItemName + "_" + pdfCount.ToString().PadLeft(3, '0') + ".pdf", nPageCount);
                    }
                        
                    else if ((filesize / (1024 * 1024)) <  Convert.ToInt32(ConfigurationManager.AppSettings["PDFFileThrusholdSize"].ToString()))
                        continue;
                    else
                    {
                        //Storing the PDF file in Item Temp path                  
                        this.ClientStatusMessage = string.Format("Saving... {0} ", r2Item.ItemName + "_" + pdfCount.ToString().PadLeft(3, '0') + ".pdf");
                        doc.Save(tempLocalPDFPath + "\\" + r2Item.ItemName + "_" + pdfCount.ToString().PadLeft(3, '0') + ".pdf");
                        ListPageCount.Add(r2Item.ItemName + "_" + pdfCount.ToString().PadLeft(3, '0') + ".pdf", nPageCount);
                        pdfCount++;                                
                        nPageCount = 0;
                        doc = new Document();
                        AddPDFPage(doc, r2Item.FileList[0].FileBytes);
                        nPageCount++;
                    }
                    
                }
                finally
                {

                }
            }
        }
    }
    private void AddPDFPage(Document doc, byte[] fileByte)
    {
        var currpage = doc.Pages.Add();
        MemoryStream imageStream = new MemoryStream(fileByte);
        currpage.Resources.Images.Add(imageStream);
        currpage.Contents.Add(new Operator.GSave());
        Aspose.Pdf.Rectangle rectangle = new Aspose.Pdf.Rectangle(lowerLeftX, lowerLeftY, upperRightX, upperRightY);
        Matrix matrix = new Matrix(new double[] { rectangle.URX - rectangle.LLX, 0, 0, rectangle.URY - rectangle.LLY, rectangle.LLX, rectangle.LLY });
        currpage.Contents.Add(new Operator.ConcatenateMatrix(matrix));
        XImage ximage = currpage.Resources.Images[currpage.Resources.Images.Count];
        currpage.Contents.Add(new Operator.Do(ximage.Name));
        currpage.Contents.Add(new Operator.GRestore());
    }

    private void OptimizePDFDocument(ref Document file)
    {
        Document pdfDocument = file;
        pdfDocument.OptimizeResources(new Document.OptimizationOptions()
        {
            LinkDuplcateStreams = true,
            RemoveUnusedObjects = true,
            RemoveUnusedStreams = true,
            CompressImages = true,
            ImageQuality = 70
        });
        file = pdfDocument;
    }

Please review this code. Please let me know if there is any changes required. In the above code.

Please provide solution as soon. We are having issue with Production. Our Customer is not happy with this issue.

Thanks
P. Saravanan.

@Saravanan_Palanisamy

Thanks for posting your inquiry.

I have again tested the scenario while using Aspose.Pdf for .NET 17.7 and observed that API took 15-16 minutes for creating the PDFs with 2000+ image(s) of various qualities. However when I included the code of optimizing document in the program, the execution time got doubled.

However, I have logged these details with the earlier logged issue and intimated relevant team about this as well. As soon as we get some updates on the resolution progress, we will certainly share with you. We greatly appreciate your patience in this regard. Please spare us little time.

We are sorry for the inconvenience.


Best Regards,
Asad Ali

Hi Asad Ali,

Please can you Provide ETA for this. Since Our customer wants this issue fix as soon. Also our Customer is ready to Buy the new version of Aspose.pdf.dll License. After this issue is fixed. Hence kindly provide the fix as soon. Due to this issue we are getting very bad impression from customers. Also it may get a chance to tell to us to change for some other component by customer. So I don’t want to make that such situation. Please understand our concern and fix the issue as soon. Please take this as a high priority task and fix this issue.

Sorry for the inconvenience.

Thanks,
P. Saravanan.

@Saravanan_Palanisamy

Thanks for your inquiry.

I have requested the product team to share an update by intimating them about your concerns. As soon as they share some ETA or any update regarding investigation, we will certainly let you know. Your patience in this regard will be highly appreciated. Please give us little time.

We are sorry for the inconvenience.


Best Regards,
Asad Ali

Hi Asad Ali,

Our customer is Unhappy. Please provide the fix as soon.

Is there any other option do you have as per below.

  1. Do we have method to identify the PDF file size before saving it. We have restriction of 50MB per PDF. If we loop through each image then it is taking more time. So do you have any suggestions ?

  2. Is there any way to improve performance while generating PDF.

  3. If we don’t compress then a small image with 20KB will generate a PDF with 1MB. So it is like every image uses more than 1MB while generating PDF. If we use compression then it takes double the time for processing and quality is bad. Do you have any suggestions ?

  4. Our division is planning to buy new version Aspose license. If we buy priority support then can we expect fixes for these issues soon? Please provide more details.

Thanks,
P. Saravanan.

@Saravanan_Palanisamy

Thanks for contacting support.

Currently there is no such feature in the API to determine the size of document before saving it. However we have logged a feature request as PDFNET-43073 in our issue tracking system, for the requested feature. Our product team will investigate the feasibility of the feature and as soon as they share feedback in this regard, we will let you know.

Please note that performance of the API depends upon many factors to be noticed, i.e Complexity and Structure of the Files, API version, Environment in which API is being used, nature of the scenario, etc. Our product team has been already working in fixing reported issues as well as adding improvement/enhancements and new feature to the API.

As your issue has already been logged in our issue tracking system, so it will definitely be investigated accordingly as per the development schedule of the product team. Furthermore, we have logged all relevant information with the issue details as well as your concerns and as soon as we get some definite updates from relevant team, we will inform you.

Please note that Enterprise/Priority Support does not guarantee any immediate resolutions but it expedites/escalates the process of investigation. Furthermore, the issues logged under the Enterprise/Priority Support have priority over the issues, logged under Normal/Free support model. For more information, please visit “Support FAQs” page in our website.

We are sorry for the inconvenience.