Buffer cannot be null

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF CoreSuite for .NET (v7)  /  Buffer cannot be null

DynamicPDF CoreSuite for .NET (v7) Forum

 Nov 06 2020 3:17 PM
We are using DynamicPDF For .NET (4.0)  version 7.0.1.40
This code is throwing an exception.

 private MergeDocument CombineFiles(IPrint[] docs)
    {
        MergeDocument mergedDoc = new MergeDocument();

        foreach (IPrint pdfPrinter in docs.Where(doc => doc.DocumentType == DocType.PDF | doc.DocumentType == DocType.DOCXasPDF))
 
            mergedDoc.Append(new PdfDocument(pdfPrinter.Document));

        return mergedDoc;
    }

Exception occurred: Buffer cannot be null.
Parameter name: buffer    at System.IO.MemoryStream..ctor(Byte[] buffer, Boolean writable)

Please advise.
 Nov 06 2020 5:36 PM
Posted by a ceTe Software moderator
Hi,

What is the data type of pdfPrinter.Document? If it is a byte array, please ensure it does not have a value of null.

Thanks,
ceTe Software Support Team

All times are US Eastern Standard time. The time now is 6:09 PM.