Concatenate/Insert/Append workaround?

Last post 03-30-2010, 2:43 AM by aspose.notifier. 24 replies.
Page 2 of 2 (25 items)   < Previous 1 2
Sort Posts: Previous Next
  •  03-03-2010, 3:28 PM 225220 in reply to 216019

    Re: Concatenate/Insert/Append workaround?

    The issues you have found earlier (filed as 13208;13488) have been fixed in this update.


    This message was posted using Notification2Forum from Downloads module by aspose.notifier.
     
  •  03-03-2010, 4:01 PM 225263 in reply to 225220

    Re: Concatenate/Insert/Append workaround?

    I have downloaded the updated dll and unfortunately I am still having the same failure when trying to concatenate pdf files together.  The program I has takes a record that can have a random number of attachments on it, our program takes the attachments and merges them together in file.  The record I have been struggling with lately has 155 files that needs to merged together.  It currently fails on the 12th document. (I have other records that merge more than 12 files with no problems so I am guessing it’s the contents of these files that is causing the outofmemory exception.)  In this particular case the page count gets to 198 pages and then fails when trying to add just one additional page.

    I do see that the memory usage drops down after each concatenation but the problem is the memory spikes VERY high while each concatenation action is being performed (the memory consumption gets higher and higher with each call as the master copy grows in size)

     

     
  •  03-04-2010, 10:05 AM 225433 in reply to 225263

    Re: Concatenate/Insert/Append workaround?

    Hi Eric,

    In order to optimize memory utilization and avoid any memory spikes, you'll have to modify the code according to the new mechanism introduced in Aspose.Pdf.Kit for .NET 4.2.0. Please see the following code snippet:

    string[] files = new string[10001];
     files[0] = "AP1099.pdf";
     for (int i = 1; i < 10001; i++)
     files[i] = "AP10992.pdf";
    PdfFileEditor editor = new PdfFileEditor();
    FileProcessingStrategy strategy = Settings.Strategy;
    Settings.Strategy = FileProcessingStrategy.OptimizeMemoryUsage;
    editor.Concatenate(files, "result.pdf");
    Settings.Strategy = strategy;
    In this code, instead of using the memory streams we have used files. So, if you want to concatenate a large number of files then please make an array of all these files and use the code as suggested above. You can also see that we have used OptimizeMemoryUsage option for the optimal use of the memory. Please note that this option can only be effective if you use it with an array of files, whereas if you concatenate individual files in the loop then it won't help. Also, it is not effective in evaluation mode.

    Please try to modify your code as suggested above and see if it helps in your scenario. We would really appreciate if you share the results with us.

    We're sorry for the inconvenience and looking forward to help you out.
    Regards,






    Shahzad Latif - [Follow me on Twitter!]
    Support Developer/Developer Evangelist
    Aspose Sialkot Team
    Aspose - Your File Format Experts

    Keep in touch! We're on Twitter and Facebook
     
  •  03-05-2010, 9:35 AM 225673 in reply to 225433

    Re: Concatenate/Insert/Append workaround?

    I have tried to get the above approach to work however I get an empty file.
    Not sure what is wrong?
    I know the path to my PDFs is correct


                   string[] _filesArray ;
                   int i;
                Aspose.Pdf.Kit.PdfFileEditor pdfEditor;
                Aspose.Pdf.Kit.FileProcessingStrategy strategy;
                try
                {
                    i = 0;
                    _filesArray = new string[files.Count]; 
                    foreach (AttachedFile f in files)
                    {
                        _filesArray[i] = TempDir + f.FileID + ".pdf";
                        i++;
                        f.isMergedToMaster = true;
                    }

                    pdfEditor = new Aspose.Pdf.Kit.PdfFileEditor();
                    strategy =Aspose.Pdf.Kit. Settings.Strategy;
                    Aspose.Pdf.Kit.Settings.Strategy = Aspose.Pdf.Kit.FileProcessingStrategy.OptimizeMemoryUsage;
                    Aspose.Pdf.Kit.Settings.Strategy = strategy; 
                    pdfEditor.Concatenate(_filesArray, TempDir + "result.pdf");
                    

     
  •  03-05-2010, 10:03 AM 225679 in reply to 225673

    Re: Concatenate/Insert/Append workaround?

    Additional info...
    It appears that the call to pdfEditor.Concatenate is returning false, it returns false even if I comment out strategy lines
     
  •  03-05-2010, 11:36 AM 225700 in reply to 225679

    Re: Concatenate/Insert/Append workaround?

    I appear to have fixed my problem.
    Some of the .pdf files were empty and that was causing the problem. 

    I now have something that works.

    Thanks
     
  •  03-06-2010, 2:51 AM 225802 in reply to 225700

    Re: Concatenate/Insert/Append workaround?

    Hi Eric,

    We're very much pleased to know that the issue is resolved at your end. However, if you still find any issues or have some more questions, please do let us know.

    Regards,


    Shahzad Latif - [Follow me on Twitter!]
    Support Developer/Developer Evangelist
    Aspose Sialkot Team
    Aspose - Your File Format Experts

    Keep in touch! We're on Twitter and Facebook
     
  •  03-22-2010, 4:19 AM 228373 in reply to 225115

    Re: Concatenate/Insert/Append workaround?

    Hi Shahzad,

    What is the status of the attached bugs on this thread?
    We're waiting for a while now and we cannot sell 'no' to our customer any longer.

    Sincerely, 
    Freddy
     
  •  03-22-2010, 2:19 PM 228465 in reply to 228373

    Re: Concatenate/Insert/Append workaround?

    Hi Freddy,

    I would like to inform you that two issues were already resolved in the previous release (4.2.0), however the resolution for the remaining three issues will be available in our upcoming monthly release due at the end of March or early April.

    If you have any further questions, please do let us know.
    Regards,


    Shahzad Latif - [Follow me on Twitter!]
    Support Developer/Developer Evangelist
    Aspose Sialkot Team
    Aspose - Your File Format Experts

    Keep in touch! We're on Twitter and Facebook
     
  •  03-30-2010, 2:43 AM 229786 in reply to 216019

    Re: Concatenate/Insert/Append workaround?

    The issues you have found earlier (filed as 13206;13489;13481) have been fixed in this update.


    This message was posted using Notification2Forum from Downloads module by aspose.notifier.
     
Page 2 of 2 (25 items)   < Previous 1 2
View as RSS news feed in XML