As I am new to Aspose, I need help in below case.
I want to merge multiple PDF into 1 PDF using Aspose, I can do it easily but the problem is, I want to limit the PDF size to 200MB.
That means, If my merged PDF size is greater than 200MB, then I need to split the PDF into multiple PDF. For Example, If my merged PDF is of 300MB, then first PDF should be of 200MB and second one PDF should be 100MB.
Main problem is, I am not able to find the size of the document in below code. I am using below code.
//Merge PDF one by one
Document destinationPdfDocument = new Document();
Document sourcePdfDocument = new Document();
for (int i = 0; i < filesFromDirectory.Count(); i++)
{
if (i == 0)
{
destinationPdfDocument = new Document(filesFromDirectory[i].FullName);
}
else
{
// Open second document
sourcePdfDocument = new Document(filesFromDirectory[i].FullName);
// Add pages of second document to the first
destinationPdfDocument.Pages.Add(sourcePdfDocument.Pages);
//** I need to check size of destinationPdfDocument over here to limit the size of resultant PDF**
}
}
// Encrypt PDF
destinationPdfDocument.Encrypt("userP", "ownerP", 0, CryptoAlgorithm.AESx128);
string finalPdfPath = Path.Combine(destinationSourceDirectory, destinatedPdfPath);
// Save concatenated output file
destinationPdfDocument.Save(finalPdfPath);
Other way of merging PDF based on size also be appreciated.
Thanks in Advance