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.

Fri Nov 15, 2024 6:46 am

My computer is running Windows 11, and I am running Spire.Doc.java through Spring Boot with Maven imports.
Code: Select all
 <dependency>
            <groupId>e-iceblue</groupId>
            <artifactId>spire.doc</artifactId>
            <version>12.11.0</version>
</dependency>

<repository>
            <id>com.e-iceblue</id>
            <name>e-iceblue</name>
            <url>https://repo.e-iceblue.com/nexus/content/groups/public/</url>
</repository>


When using a Java program to convert a DOCX file to PDF, the resulting PDF file size is 0 bytes. When trying to open it with WPS, the error message appears: "The file type is not supported or the file is corrupted, filename: xxxx.pdf." Meanwhile, the Java program hangs in the conversion function, unable to complete for an extended period, with CPU usage continuously increasing as if it is stuck in an infinite loop. The protection type is also set to No_Protection.
However, the conversion works successfully when using the Live Demo.
Code: Select all
@SpringBootApplication
public class ConvertWordToPdfApplication {
    public static void main(String[] args) {

        // Create a Document object
        Document doc = new Document();

        // Load a Word document
        doc.loadFromFile("C:\\Users\\12627\\Desktop\\doc\\7a66b2d4.docx");

        ProtectionType type = doc.getProtectionType();

        System.out.println("ProtectionType: " + type);

        // Save the document to PDF
        doc.saveToFile("C:\\Users\\12627\\Desktop\\doc\\ToPDF.pdf", FileFormat.PDF);

        // Dispose resources
        doc.dispose();

        System.out.println("OK");
    }
}


The result of the pringln:
Code: Select all
ProtectionType: No_Protection


But it gets stuck in the saveToFile function. I previously used the getPageCount function, and the program also froze for several minutes.And there are no exceptions or error messages in the program.

gaoyukun
 
Posts: 5
Joined: Sat Aug 17, 2024 1:24 am

Fri Nov 15, 2024 9:51 am

Hi,

Thanks for bringing this issue to our attention.
I have logged this issue into our bug tracking system with reference number SPIREDOC-10941. Our dev team will investigate and fix it. Once it's resolved, we will inform you ASAP. Sorry for any inconvenience caused.

Sincerely,
Doris
E-iceblue support team
User avatar

Doris.Liu
 
Posts: 455
Joined: Mon Nov 07, 2022 8:10 am

Sat Nov 16, 2024 3:54 am

I used to use your product Spire.Doc for C# to perform conversions. For the DOCX file I provided, the result of the function
Code: Select all
document.ProtectionType
was
Code: Select all
AllowOnlyRevisions
. However, in the Java program, the result is
Code: Select all
NO_Protection
, and the conversion fails, causing the program to enter a loop. I hope this information is helpful for identifying the problem. Thank you.

gaoyukun
 
Posts: 5
Joined: Sat Aug 17, 2024 1:24 am

Mon Nov 18, 2024 9:55 am

Hi,

Thank you very much for providing further information.
I conducted a test using the C# version and found that it indeed failed to output any results. However, when I used doc.ProtectionType to check, the result was also "NoProtection". Additionally, I used Microsoft Word to open the document you provided and confirmed that there are indeed no restrictions; any text can be edited. Please confirm that the same document was used for both of your tests.

Sincerely,
Doris
E-iceblue support team
User avatar

Doris.Liu
 
Posts: 455
Joined: Mon Nov 07, 2022 8:10 am

Wed Nov 20, 2024 6:17 am

"I tested again, and the result is still
Code: Select all
AllowOnlyRevisions
."

gaoyukun
 
Posts: 5
Joined: Sat Aug 17, 2024 1:24 am

Wed Nov 20, 2024 9:37 am

Hello,

Are you using our latest version 12.11.7 to test with C#? If not, it is recommended to use the latest version for testing. Additionally, I have attached my test demo for your reference. Please download it and run the project directly on your side. I would greatly appreciate it if you could provide feedback on your test results.

Download: https://www.e-iceblue.com/Download/download-word-for-net-now.html

Sincerely,
Doris
E-iceblue support team
User avatar

Doris.Liu
 
Posts: 455
Joined: Mon Nov 07, 2022 8:10 am

Fri Nov 22, 2024 2:48 am

I tested it again using the program you provided, and the protection type is indeed
Code: Select all
NoProtection
. The version of my program is 11.11.8.0, and the result is
Code: Select all
AllowOnlyRevisions
.

gaoyukun
 
Posts: 5
Joined: Sat Aug 17, 2024 1:24 am

Fri Nov 22, 2024 7:39 am

Hello,

Thank you for your feedback.
I have tested and indeed verified the error in version 11.11.8. However, we have already addressed this issue in our latest version. If you need to test the Net program, I recommend using our latest version. We sincerely appreciate your repeated testing and feedback. Once the bug you reported is resolved, we will inform you promptly.

Nuget Download:
https://www.nuget.org/packages/Spire.Docfor.NETStandard/12.11.7
https://www.nuget.org/packages/Spire.Doc/12.11.7

Sincerely,
Doris
E-iceblue support team
User avatar

Doris.Liu
 
Posts: 455
Joined: Mon Nov 07, 2022 8:10 am

Return to Spire.Doc