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.

Tue Dec 14, 2021 10:01 pm

When attached document .docx is being saved to images or .pdf exception "System.ArgumentException: 'Parameter is not valid.'" is thrown. As I can see it happens on page 54.

Variant 1
Code: Select all
            Document document = new Document(Settings.FileToProcess);
            document.SaveToFile(Settings.FileResultType+".pdf", Spire.Doc.FileFormat.PDF);


Variant 2
Code: Select all
            Document document = new Document(Settings.FileToProcess);
            Image[] images = document.SaveToImages(Spire.Doc.Documents.ImageType.Bitmap);


Variant 3
Code: Select all
            Document document = new Document(Settings.FileToProcess);
            List<Image> images = new List<Image>();
            for (int i = 0; i < document.PageCount; i++)
            {
                images.Add(document.SaveToImages(i, Spire.Doc.Documents.ImageType.Bitmap));
            }

Kazax_Kazax
 
Posts: 13
Joined: Tue Nov 30, 2021 4:58 pm

Wed Dec 15, 2021 8:17 am

Hello,

Thank you for your inquiry.
I tested your Word file with the code you provided, and did reproduce the issues you mentioned. But for Word to PDF, I used the new engine method to do a test, there is no problem, the sample code is as follows, please use this code to test on your side. Regarding the issue of converting Word to image, I have logged it into our bug tracking system with the ticket number SPIREDOC-7116. Our development team will investigate and fix it. Once it is resolved, I will inform you in time. Sorry for the inconvenience caused.
Code: Select all
Document document = new Document("20211214.docx");
document. UseNewEngine = true;
document.SaveToFile("output1215.pdf", FileFormat.PDF);

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1643
Joined: Wed Apr 07, 2021 2:50 am

Thu Dec 16, 2021 10:05 pm

Yes, saving to .pdf woks with new engine, but saving to images doesn't work. We need saving to images too.
As I have noticed if Spire.Doc license IS NOT applied all work well, but if license is applied we have the exception.

Kazax_Kazax
 
Posts: 13
Joined: Tue Nov 30, 2021 4:58 pm

Fri Dec 17, 2021 2:51 am

Hello,

Thank you for your further response.
Regarding the issue of converting Word to images, I have submitted it to our Devt team for investigation and processing. In addition, kindly note that if you do not use a license for the commercial version, only supports converting the first 10 pages to images. In this case, the program has not yet reached the problematic page (page 54).

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1643
Joined: Wed Apr 07, 2021 2:50 am

Thu Mar 10, 2022 8:01 am

Hello,

Glad to inform that we just released Spire.Doc Pack(hot fix) Version:10.3.3 which fixes the issue of SPIREDOC-7116, please download and refer to the sample code for testing.
Website link: https://www.e-iceblue.com/Download/download-word-for-net-now.html
Nuget link: https://www.nuget.org/packages/Spire.Doc/10.3.3
Code: Select all
Document document = new Document("20211214.docx");
document.UseNewEngine = true;
Image[] images = document.SaveToImages(Spire.Doc.Documents.ImageType.Bitmap);

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1643
Joined: Wed Apr 07, 2021 2:50 am

Return to Spire.Doc

cron