jooeyvh
Problem storing iText7 pdf in a memoryStream
Hey,
I am having a problem that I hope someone can help me sort out. I'm working on a project in C#, my solution will create a pdf file and I'm using iText7 for that purpose. It works fine storing the pdf locally but the next step is to store it in a memoryStream instead of a local file for later upload to Azure. However, something is weird and I just can't figure it out.
Hopefully someone here will be able to help me or can give me a hint in right direction.
These errors occur in the "memoryStream.Position" part:
ReadTimeout = 'memoryStream.ReadTimeout' threw an exception of type 'System.InvalidOperationException'
WriteTimeout = 'memoryStream.WriteTimeout' threw an exception of type 'System.InvalidOperationException'
My code:
MemoryStream memoryStream = new MemoryStream();
PdfWriter writer = new PdfWriter(filePath);
PdfDocument pdf = new PdfDocument(writer);
Document document = new Document(pdf);
{
// Code for constructing and mapping information to pdf
}
memoryStream.Position = 0;
Utilities.UploadToBlobStorage(memoryStream, connectionString, containerName, blobName);
memoryStream.Dispose();
12 replies