Why does breaking out of a foreach loop cause complaint “Cannot access a closed Stream”?
问题 Based on the suggestion in the comments here, I refactored my method to try to assign data to a MemoryStream outside of the iTextSharp.text.Document "using" (but within the MemoryStream using clause): internal static HttpResponseMessage GeneratePDFOfReportFutures() { HttpResponseMessage result = null; futureReports = GetAllFutureReports(); try { using (var ms = new MemoryStream()) { using (var doc = new Document(PageSize.A4.Rotate(), 25, 25, 25, 25)) // the "Rotate" makes it landscape