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.

Thu Jun 16, 2022 6:42 pm

When saving a document to pdf, in addition to taking more than 10 seconds, it ends up giving this java error. I use java 11.

java.lang.NoSuchMethodException: java.util.prefs.WindowsPreferences.WindowsRegOpenKey(int, [B, int)
at java.base/java.lang.Class.getDeclaredMethod(Class.java:2475)
at com.spire.doc.packages.sprffl.<clinit>(Unknown Source)
at com.spire.doc.packages.spraml.spr??(Unknown Source)
at com.spire.doc.packages.sprbjl.spr??(Unknown Source)
at com.spire.doc.packages.sprhel.spr??(Unknown Source)
at com.spire.doc.packages.sprhel.<clinit>(Unknown Source)
at com.spire.doc.packages.sprgxy.spr???—(Unknown Source)
at com.spire.doc.packages.sprgxy.spr–??—(Unknown Source)
at com.spire.doc.packages.sprhyaa.spr???—(Unknown Source)
at com.spire.doc.Document.spr???—(Unknown Source)
at com.spire.doc.Document.saveToFile(Unknown Source)
at nova.util.NDocTemplate.CreatePDF(NDocTemplate.java:138)
at PruebaDocTemplate.main(PruebaDocTemplate.java:65)

jmparada
 
Posts: 47
Joined: Wed May 25, 2022 7:50 am

Fri Jun 17, 2022 5:48 am

Hi,

Please provide the docx file to us to help us reproduce this issue. Thanks in advance.
Sincerely,
Andy
E-iceblue support team
User avatar

Andy.Zhou
 
Posts: 483
Joined: Mon Mar 29, 2021 3:03 am

Fri Jun 17, 2022 8:01 am

Attached document "PruebaWord.docx".

Additionally, I also take the opportunity to ask why the resulting word file is smaller than the original when nothing has really been changed. I attach the document "PruebaDocTemplate_Procesado" to check it.

Finally, comment that the pdf document ends up being generated after about 10 seconds (too long, it's rare), even causing the error. However, it can be seen how the part of the footer where the numbering of the pages is indicated does not come out correctly.

jmparada
 
Posts: 47
Joined: Wed May 25, 2022 7:50 am

Fri Jun 17, 2022 9:55 am

Hi,

I did some tests to convert the file "PruebaWord.docx" to PDF but did not encounter any error. I'm not sure if you are using the lastest version(v10.6.0) of Spire.Doc For Java. If not, please update and test again.

As for the problem that the conversion takes a long time, this is related to the content and structure of the document. In general, the most influential factors are the pictures and tables in the document. Therefore, for documents containing many or large pictures or complex tables, the conversion will be relatively more time-consuming.

As for the problem of footer, system fonts missing is a high probability cause. In "PruebaWord.docx", font "Montserrat" is used. But in the result PDF, it is "Times New Roman" instead of "Montserrat". Please note that WORD to PDF conversion requires fonts. Please try to install font "Montserrat" in your system and test again.
Sincerely,
Andy
E-iceblue support team
User avatar

Andy.Zhou
 
Posts: 483
Joined: Mon Mar 29, 2021 3:03 am

Fri Jun 17, 2022 12:28 pm

I have used the latest version 10.6.0 and the error keeps coming.

As I see in the error, it mentions the exception for the lack of a method, and also referring to WindowsPreferences as to enter the windows registry.

jmparada
 
Posts: 47
Joined: Wed May 25, 2022 7:50 am

Mon Jun 20, 2022 10:26 am

Hi,

We have reproduced this issue with higher JDK version(17) and found a solution for it. Please find your registry information according to the image below and add a new items (Prefs) in the location shown in the image. Then test your project again.
2AB62EC8-1872-4f5e-A8F3-C71499AAF771.png
Sincerely,
Andy
E-iceblue support team
User avatar

Andy.Zhou
 
Posts: 483
Joined: Mon Mar 29, 2021 3:03 am

Mon Jun 20, 2022 11:29 am

It's not clear to me if this change could be made everywhere I need to use Spire.Doc. could you tell me why Spire.Doc needs this?
Thanks.

jmparada
 
Posts: 47
Joined: Wed May 25, 2022 7:50 am

Tue Jun 21, 2022 1:49 am

Hi,

Sorry, I'm not very clear on how it works either. It seems to only appears in higher version JDK environments. This solution is what we found in technical communities like stackoverflow and github, and it works. Below are the relevant links for your reference.

https://stackoverflow.com/questions/16428098/groovy-shell-warning-could-not-open-create-prefs-root-node
https://gitlab.com/CDAGaming/CraftPresence/-/issues/89
Sincerely,
Andy
E-iceblue support team
User avatar

Andy.Zhou
 
Posts: 483
Joined: Mon Mar 29, 2021 3:03 am

Wed Jun 22, 2022 5:03 pm

I've verified that this registry entry exists and it still doesn't work. Any other option?

jmparada
 
Posts: 47
Joined: Wed May 25, 2022 7:50 am

Wed Jun 29, 2022 6:08 pm

I have no solution to this. From what I have been able to search, it seems that with version 11 of java the way of using this method has changed and the solutions I find go through modifying the calls. I understand this must be from Spire.Doc which must not be supporting this change. is this so?, i use java 11 and this would be a big problem.

The following link talks about this problem:

https://stackoverflow.com/questions/656 ... regopenkey

jmparada
 
Posts: 47
Joined: Wed May 25, 2022 7:50 am

Thu Jun 30, 2022 3:27 am

Hi,

I tested in both java11 and 17 environment. The last solution really didn't work for them as I had been using java8 before. I have reported this issue to the dev team, and the issue number is SPIREDOC-8077. After preliminary investigation, it was confirmed that this issue was caused by our previous changes related to finding registered fonts. We will fix it and let you know. Sorry for the inconvenience caused.
Sincerely,
Andy
E-iceblue support team
User avatar

Andy.Zhou
 
Posts: 483
Joined: Mon Mar 29, 2021 3:03 am

Tue Jul 12, 2022 9:57 am

Hello,

Thanks for your patience!

Glad to inform you that we just released Spire.Doc For Java Version:10.7.4 which fixes your issue SPIREDOC-8077.

Please download the fix version from the following links to test.
Website link:
Code: Select all
https://www.e-iceblue.com/Download/doc-for-java.html

Maven:
Code: Select all
https://repo.e-iceblue.com/service/rest/repository/browse/maven-public/e-iceblue/spire.doc/10.7.4/
Sincerely,
Andy
E-iceblue support team
User avatar

Andy.Zhou
 
Posts: 483
Joined: Mon Mar 29, 2021 3:03 am

Wed Jul 13, 2022 7:28 am

Works!!!, thanks.

jmparada
 
Posts: 47
Joined: Wed May 25, 2022 7:50 am

Wed Jul 13, 2022 8:03 am

You are welcome!
Sincerely,
Andy
E-iceblue support team
User avatar

Andy.Zhou
 
Posts: 483
Joined: Mon Mar 29, 2021 3:03 am

Return to Spire.Doc