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.

Sat Aug 27, 2016 12:18 am

Hi,

Using the free version of spire.doc. I am opening a template and saving multiple pages and then combining them into one document. All works well until I try to save the combined document as a PDF. Oddly it will work if there is only one page in the combined document, but fails if there is more then one page.

Is there something wrong with the code below?
Is there a limit on the SaveToFile PDF format in the free version?
Do I need to add the spire.pdf component to my project as well?


The exception error for what it is worth is:
Unable to sort because the IComparer.Compare() method returns inconsistent results. Either a value does not compare equal to itself, or one value repeatedly compared to another value yields different results. IComparer: 'System.Collections.Generic.ObjectComparer`1[sprᯚ]'.

thanks,
nja

Combining the individual files
===================
Code: Select all
                //foreach (FileInfo file in downloadedMessageInfo.GetFiles())
                while (x < filecount)
                {
                    //string fileName = Server.MapPath(Path.Combine("/", "App_Documents/Templates/CheckPreviewTemplate.docx"));
                    string fileMerge = Server.MapPath(Path.Combine("/", "App_Documents/Checks/" + files[x].Name));

                    //Create word document
                    Document documentMerge = new Document();
                    documentMerge.LoadFromFile(fileMerge, FileFormat.Docx);

                    // copy the new section, i.e. the new page, to the first file opened
                    foreach (Section sec in documentMerge.Sections)
                    {
                        document.Sections.Add(sec.Clone());
                    }

                    // increment our page counter
                    x++;

                }




serving up a multi-page word document => WORKS
==================================================

Code: Select all
               //Save doc file to the download location and trigger the download in the javascript
                document.SaveToFile(Server.MapPath(Path.Combine("/", "App_Documents/NewDocuments/Combined.docx")), FileFormat.Docx);



Code: Select all
                    $.post(url, { idArray: ids }, function (data) {
                        $("#resultMessage").html(data.message);
                        if (data.success) {
                            // on success open the new file
                            window.open('/App_Documents/NewDocuments/Combined.docx', '_blank');
                        }

                    });




serving up a multi-page PDF document => FAILS
==================================
Code: Select all
 document.SaveToFile(Server.MapPath(Path.Combine("/", "App_Documents/NewDocuments/Combined.PDF")), FileFormat.PDF);


                    $.post(url, { idArray: ids }, function (data) {
                        $("#resultMessage").html(data.message);
                        if (data.success) {
                            // on success open the new file
                            window.open('/App_Documents/NewDocuments/Combined.PDF', '_blank');
                        }

                    });

nja
 
Posts: 2
Joined: Fri Aug 26, 2016 11:41 pm

Mon Aug 29, 2016 3:10 am

Dear nja,

Thanks for your interests in Spire.Doc.
We suggest you try to use the latest Spire.Doc Pack(hot fix) Version:5.7.72, because we don't have any plan to maintain the free version. After trying this version, if the issue still persists, please provide us sample document which have issue, that would be helpful to investigate this issue.

Thanks,
Betsy
E-iceblue support team
User avatar

Betsy
 
Posts: 802
Joined: Mon Jan 19, 2015 6:14 am

Fri Sep 02, 2016 4:57 pm

Hi,
Just to clarify,

Are you saying that there will not be any updates for the free version going forward EVER?

Or that you don't provide support in the forum for the free version?

Thanks,
nja

nja
 
Posts: 2
Joined: Fri Aug 26, 2016 11:41 pm

Mon Sep 05, 2016 2:58 am

Dear nja,

Sorry for late reply as weekend.
We only maintain Free version when we have enough time, sorry that we don't have a plan to update Free version at present, but we provide technical support for it. Please try to ues the version I mentioned, if the issue still persists, please provide us sample document which has issue, that would be helpful to investigate this issue.

Thanks,
Betsy
E-iceblue support team
User avatar

Betsy
 
Posts: 802
Joined: Mon Jan 19, 2015 6:14 am

Return to Spire.Doc

cron