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.

Mon Feb 09, 2026 10:25 am

Hi,

We are experiencing a performance issue when using the SaveToStream method with Spire.OfficeforNETStandard.

The SaveToStream operation is extremely slow, even for moderately sized documents. The execution time is significantly longer than expected and is affecting our production environment.

Environment details:

    Spire version: Spire.OfficeforNETStandard 10.11.0
    Framework: .NET Core 2.2

Code: Select all
string[] inputFiles =
{
@"C:\Temp\LargePdf1.pdf",
@"C:\Temp\LargePdf2.pdf"
};

MemoryStream[] streams = new MemoryStream[inputFiles.Length];

for (int i = 0; i < inputFiles.Length; i++)
{
streams[i] = new MemoryStream();
using (FileStream fs = new FileStream(inputFiles[i], FileMode.Open, FileAccess.Read))
{
PdfDocument pdf = new PdfDocument(fs);
pdf.SaveToStream(streams[i]);
}
}


Thank you for your support.

LauraNM
 
Posts: 92
Joined: Tue Feb 19, 2019 1:23 pm

Tue Feb 10, 2026 3:56 am

Hello,

Thanks for your feedback.

Regarding the issue of slow performance during SaveToStream operations, this is primarily related to the content and structure of the PDF document. To help us conduct a thorough investigation and determine whether further optimization is possible, could you please provide your PDF file?

If the file is large, you could upload it to Dropbox or OneDrive and share the download link with us. If it’s not convenient to share the file here, please send it directly via email to [email protected].

Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 3008
Joined: Wed Jun 27, 2012 8:50 am

Return to Spire.PDF