I have attached the file again. It seems to only throw the exception when saving to a memory stream. If I save to a file it works fine.
I have attached the entire solution as a .zip.
//Global.log.Debug("[ConvertImagesToPdf] - Saving created Pdf document to memory stream");
MemoryStream ms = new MemoryStream();
byte outputDocument = null;
doc = new Document(ms);
// Optimzie the file size by removing unused objects
AllowReusePageContent = true,
LinkDuplcateStreams = true,
RemoveUnusedObjects = true,
RemoveUnusedStreams = true,
CompressImages = true,
ImageQuality = 80
ms = new MemoryStream();
outputDocument = ms.ToArray();
We are sorry for the inconvenience caused.