Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Wed Dec 18, 2013 10:42 am

Hello,

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?

qbfinest
 
Posts: 2
Joined: Wed Dec 04, 2013 8:34 am

Thu Dec 19, 2013 6:54 am

Hello,

Thanks for your inquiry.
Please try the new method as below to merge pdf documents, if there are any questions, welcome to get it back to us.
Code: Select all
 
string inputFile = @"..\..\pdfs";
string outputFile = @"..\..\sample.pdf";
string[] path = Directory.GetFiles(inputFile);
PdfDocumentBase doc = PdfDocument.MergeFiles(path);
doc.Save(outputFile, FileFormat.PDF);

Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Wed Dec 25, 2013 9:09 am

Hello,

Has the issue been resolved? Could you please give us some feedback if convenience?

If there are any questions, welcome to get it back to us.

Thanks,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Wed Jan 29, 2014 11:05 am

Hello,

No it has not been resolved.

I decided to use another library (one that works).

qbfinest
 
Posts: 2
Joined: Wed Dec 04, 2013 8:34 am

Return to Spire.PDF