Hi All,
We are having issues when merging PDF , it is throwing this exception even the PDF is correct.
We are using version 5.0.57, please advice.
“Message: Unknown error encountered on server. Message:'Property 'Pages' can not be empty.' when merging pdfs.”
protected byte[] MergePdfs(byte[] masterPdf, IEnumerable<ClientFile> additionalPdfs)
{
try
{
Runtime.AddLicense(ConfigurationManager.AppSettings["EOPDFLicense"]);
PdfDocument basePDF;
using (var basePDFStream = new MemoryStream(masterPdf))
{
basePDF = new PdfDocument(basePDFStream);
}
foreach (var pdf in additionalPdfs)
{
using (var tempStream = new MemoryStream(pdf.FileBytes))
{
var pdfToAppend = new PdfDocument(tempStream);
basePDF = PdfDocument.Merge(basePDF, pdfToAppend);
}
}
using (var stream = new MemoryStream())
{
basePDF.Save(stream);
masterPdf = stream.ToArray();
}
return masterPdf;
}
catch (Exception e)
{
IntelliCorpLogger.Write("RegistrationToolsController.MergePdfs",
String.Format("Unknown error encountered on server. Message:'{0}' when merging pdfs.", e.Message),
new List<string> { "Exception" });
return null;
}
}
Thanks