Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Wed Dec 18, 2019 9:21 pm

Performance Issue while converting Doc to PDF in .Net core using Spire office
I have taken 2 console applications, 1 is using .net core(3.1) and 1 is using .net framework(4.7.2)
1.PNG

I have installed NuGet package on both applications
I have taken some files which are in equal sizes 2.89 MB
I have used below code to convert from docx to pdf in both core and .Net framework
Code: Select all
  static void Main(string[] args)
        {
            var st = Stopwatch.StartNew();
            Console.WriteLine("\n Process Started" + st.Elapsed.ToString());
            var floderpath = @"C:\Users\testuser1\Desktop\Agenda Docs\New folder";
            var pdfpath = @"C:\Users\testuser1\Desktop\Agenda Docs\New folder\pdf";


            var files = Directory.GetFiles(floderpath).ToList();

            files.ForEach((file) =>
            {
                using (Document document = new Document(@file, Spire.Doc.FileFormat.Docx, Spire.Doc.Documents.XHTMLValidationType.None) { TrackChanges = false })
                {

                    var filename = Path.GetFileNameWithoutExtension(file);
                    var st2 = Stopwatch.StartNew();
                    Console.WriteLine($"\n File Name: \t{ filename}\t\t{ st2.Elapsed.ToString()} \t Started \t Source File \t {Path.GetFileName(file)}");
                    document.SaveToFile($"{pdfpath}\\{filename}.pdf", Spire.Doc.FileFormat.PDF);

                    st2.Stop();
                    Console.WriteLine($"\n File Name: \t{ filename}\t\t{ st2.Elapsed.ToString()} \t Eneded");

                }
            });
            st.Stop();
            Console.WriteLine($"\n Completed All files \t{st.Elapsed.ToString()}");

            Console.ReadLine();
        }

While running the test, I can convert the file to pdf in 4.5 sec in .Net framework on average. Please see the below screen shot. While I am using same thing on .net core, it is taking 14.5 sec on average. It means the conversion time change is 10 sec. I have tested in different machines as well; however, it is showing the difference of 10 sec.
Test results on.Net framework
7.0.PNG

Test results on.Net core
7.1.PNG


Can you please give us some solution for this ?

bmcilquham
 
Posts: 2
Joined: Mon Dec 02, 2019 10:37 pm

Thu Dec 19, 2019 3:17 am

Hi,

Thanks for your inquiry.
After an initial test with the latest Spire.Office Platinum (DLL Only) Version:4.11.2, I didn't notice the issue you mentioned. The time on .net framework and .net core is almost the same. To help us investigate the issue accurately, please provide following information.
1. The input Word files
2. The OS and Region information, e.g. Win7 64bit, RAM 8GB, China/Chinese

You could provide the information here or send it to us(support@e-iceblue.com) via email.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Mon Dec 30, 2019 7:29 pm

Thanks for the reply.
I have tested with hot fix Spire.Office Platinum (DLL Only) Version:4.11.2 and It is working as expected.
Thanks for the support :)

bmcilquham
 
Posts: 2
Joined: Mon Dec 02, 2019 10:37 pm

Tue Dec 31, 2019 1:15 am

Hi,

Thanks for your feedback.
Please feel free to contact us if there is any question.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Return to Spire.Doc