Hi Asad Ali,
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. Also I am not getting the reply button from this URL
Please help me out in this as soon.
For Your Reference I am providing my Actual application code here.
Right now I have made the compression mode as configurable. Please go through this code let me know if there is any changes in the code.
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();
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 < 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() + ".pdf");
doc.Save(tempLocalPDFPath + "\\" + r2Item.ItemName + "_" + pdfCount.ToString() + ".pdf");
ListPageCount.Add(r2Item.ItemName + "_" + pdfCount.ToString() + ".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;
}
Thanks
P. Saravanan.
This Topic is created by asad.ali using the Email to Topic plugin.