I am merging documents that I am downloading from Azure.
I have a problem with files bigger than 4 MB.
I tried to to do this in two ways.
The pdfDocument variable is created like this:
- Code: Select all
byte[] pdfReport = somevaluehere
using (var pdfDocument = new PdfDocument(pdfReport))
{
foreach (var document in documents)
{
//logic to add documents to the original document
}
pdfDocument.SaveToStream(outputStream);
}
The first is using the stream from Azure directly:
- Code: Select all
using (var document = new PdfDocument(fileStream))
{
pdfDocument.AppendPage(document);
}
The second one is by first getting the stream content to a byte array (so we know the data is already there):
- Code: Select all
var length = fileStream.Length;
var buffer = new byte[length];
fileStream.Read(buffer, 0, (int)length);
using (var document = new PdfDocument(buffer))
{
pdfDocument.AppendPage(document);
}
Everything works as long as the files are below 4 MB.
If there is a bigger file we get an exception "Invalid/Unsupported format" in the contructor.
Does your product support bigger files (preferably up to 50 MB).
If so how to deal with them?