Wordml to PDF save throwing exception

Hi,

I am trying to save wordml to PDF, facing the below exception.

I am using Aspose.word 16.2.0-jdk16.jar

Please advice what is the reason and how to resolve the issue

Please make sure you have “Visual C++
Redistributable Packages” installed (see https://www.microsoft.com/en-us/download/details.aspx?id=30679)

java.lang.UnsatisfiedLinkError:
C:\apache-tomcat-7.0.70\temp\WindowsNativeCall\WindowsNativeCall_x64.dll: Can’t
find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1938)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1821)
at java.lang.Runtime.load0(Runtime.java:809)
at java.lang.System.load(System.java:1086)
at asposewobfuscated.zz6B.zzBM(Unknown Source)
at com.aspose.words.WindowsNativeCall.(Unknown Source)
at com.aspose.words.PrinterMetrics.(Unknown Source)
at com.aspose.words.zzZOW.zzZNw(Unknown Source)
at com.aspose.words.zzZOW.zzZ(Unknown Source)
at com.aspose.words.zzZOW.zzZP(Unknown Source)
at com.aspose.words.zzZOW.zzZNA(Unknown Source)
at com.aspose.words.zzZOW.zzZPG(Unknown Source)
at com.aspose.words.zzZP8.hashCode(Unknown Source)
at com.aspose.words.zzZOW.hashCode(Unknown Source)
at java.util.HashMap.hash(HashMap.java:338)
at java.util.HashMap.get(HashMap.java:556)
at com.aspose.words.zzZOW.zzX(Unknown Source)
at com.aspose.words.zzZ4H.zzYN(Unknown Source)
at com.aspose.words.zzBE.moveNext(Unknown Source)
at com.aspose.words.zzZRD.zzZ(Unknown Source)
at com.aspose.words.Document.updatePageLayout(Unknown Source)
at com.aspose.words.zz73.perform(Unknown Source)
at com.aspose.words.zz74.zzNF(Unknown Source)
at com.aspose.words.zz4E.zzZj(Unknown Source)
at com.aspose.words.zz4E.zzZ(Unknown Source)
at com.aspose.words.zz4E.zzZR(Unknown Source)
at com.aspose.words.Document.zzZ(Unknown Source)
at com.aspose.words.Document.zzZ(Unknown Source)
at com.aspose.words.Document.zzZ(Unknown Source)
at com.aspose.words.Document.save(Unknown Source)

Hi Muthulakshmi,

Thanks for your inquiry. Could you please attach your input WordML document here for testing? We will investigate the issue on our side and provide you more information.

Hi,
When converting wordml to PDF using standalone program its working fine, but when I deployed the code in server, I am facing the mentioned exception. I want to know what is the use of
WindowsNativeCall_x64.dll
and why aspose.word is expecting to install Visual C++ Redistributable Packages 2012 update
Same type of issue i found in this link
https://forum.aspose.com/t/aspose-words-for-java-dependency/32242/2
but i have no permission to view this post. Please suggest

Hi Muthulakshmi,

Thanks for your inquiry. In case you are using older version of Aspose.Words, we suggest you please upgrade to the latest version of Aspose.Words for Java 16.7.0.

If you still face problem, please share your working environment e.g. operating system, Jdk version etc. along with input document and code. We will investigate the issue on our side and provide you more information.

After upgrading to 16.7.0, used two different server machines even then the exception persists

Environment:

Windows 2008 R2 standard

Windows Server 2012 R2

JDK Version:

1.8

Code Snippet:

Please refer the screenshot Code_Snippet_with_Error.jpg

Xml file used: Refer attached Sample.xml

Before installing Visual C++ Redistributable Packages" installed (see https://www.microsoft.com/en-us/download/details.aspx?id=30679) update, got the error while converting wordml to PDF. The output_error.pdf generated with formatting issue refer 13th page of PDF where signature block split into two pages.

After installing Visual C++ Redistributable Packages" installed (see https://www.microsoft.com/en-us/download/details.aspx?id=30679) update. Wordml converted to PDF with out issue. The output_success.pdf generated without any formatting issue

Please let me know why server machine alone expecting the VS2012 update where as client machine works fine without this update.

Also let me know why aspose requires VS2012 update and some times even after installing the update the PDF conversion has formatting issues.

Please let me know whether this update is required.

Hi Muthulakshmi,

Thanks for sharing the detail.

MS Word has the “Use printer metrics to lay out document” option under the “Options -> Advanced -> Compatibility options for” section. By default this feature is enabled which allows Word to check printer settings to calculate formatting and layout.

Please have a look at the Disable the “Use printer metrics to lay out document option” https://support.microsoft.com/en-us/kb/918793 section

The only way to retrieve the same metrics is to use native calls so we had to create our own “WindowsNativeCall_x86|x64.dll” which is stored in the OS temp folder.

To reduce the size of Aspose.Words’ library, we decided not to include additional libraries and let users install “Visual C++ Redistributable Packages” on their side if it has not been installed yet. So please install Visual C++ Redistributable Packages to avoid the exception.

Hi,

Thanks for the explanation.

As per you suggestion, When I disable use printer metrics option, I didn’t get any exception but the generated PDF has formatting issues noticed that signature split up in Page 13.

My understanding is that use printer metrics is required to correct the formatting in the generated PDF. correct me if am wrong.

LoadOptions opt = new LoadOptions();
opt.setLoadFormat(LoadFormat.WORD_ML);
Document d1 = new Document("C:\4224\Sample.xml", opt);
d1.getCompatibilityOptions().setUsePrinterMetrics(false);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
d1.save(baos, SaveFormat.PDF); 
d1.save("C:\4224\output.pdf", SaveFormat.PDF);

After installing VS2012 c++ update in windows 2012 server, when I run the code in eclipse its working fine without formatting issue. When I deploy the code in server, formatting issue still persists. Any specific requirement for deploying in server.

I used Tomcat server for deployment. Please let me know how to resolve this

If VS C++2012 update is mandatory then how we can handle in case of Linux Server

Hi Muthulakshmi,

Thanks for your inquiry. Please note that Aspose.Words mimics the same behavior as MS Word does. If you convert document to Pdf with/without UsePrinterMetrics option, you will get the same output.

loginmuthu:

After installing VS2012 c++ update in windows 2012 server, when I run the code in eclipse its working fine without formatting issue. When I deploy the code in server, formatting issue still persists. Any specific requirement for deploying in server.

Please note that Aspose.Words requires TrueType fonts when rendering documents to fixed-page formats (JPEG, PNG, PDF or XPS). You need to install fonts on the machine where you’re converting documents to Pdf. Please make sure that you are not using following line of code in your application.

d1.getCompatibilityOptions().setUsePrinterMetrics(false);

loginmuthu:

If VS C++2012 update is mandatory then how we can handle in case of Linux Server

We are in communication with our product team about this query. We will get back to you soon.

Hi,

Please see my inline comments

Please note that Aspose.Words mimics the same behavior as MS Word does. If you convert document to Pdf with/without UsePrinterMetrics option, you will get the same output.

When I convert the sample.xml to PDF using word with user printer metrics enabled option, I am not seeing any formatting issues, Whereas if I disable use printer metrics and convert the sample.xml to PDF I am getting the formatting issue in 13th page

Please note that Aspose.Words requires TrueType fonts when rendering documents to fixed-page formats (JPEG, PNG, PDF or XPS). You need to install fonts on the machine where you’re converting documents to Pdf. Please make sure that you are not using following line of code in your application.

d1.getCompatibilityOptions().setUsePrinterMetrics(false);

I am not using the above code, but In my windows server true type font is installed in c:\windows\fonts

Even after installing 2012 update, I am getting formatting issue when code is deployed in tomcat and run as services. what library path must we include for the tomcat service to work?

If VS C++2012 update is mandatory then how we can handle in case of Linux Server

Waiting for your updates.

Hi Muthulakshmi,

Thanks for your inquiry.

loginmuthu:

I am not using the above code, but In my windows server true type font is installed in c:\windows\fonts

Even after installing 2012 update, I am getting formatting issue when code is deployed in tomcat and run as services. what library path must we include for the tomcat service to work?

We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSJAVA-1426. You will be notified via this forum thread once this issue is resolved. We apologize for your inconvenience.

loginmuthu:

Waiting for your updates.

We will update you via this forum thread as soon as we get update from our product team. Thanks for your patience.

Hi,

I want to move this ticket to another user id (aspose enterprise support ).

Please let me know the procedure to do the same.

Thanks,

M.Muthulakshmi

Hi Muthulakshmi,

Thanks for your inquiry. If you already bought enhanced support, we request you to please use your other “Enterprise Support” account and post your query in Aspose.Enterprise.Support forum to be able to raise the priority of this issue. Thanks for your cooperation.

Best regards,

Hi,

Please mark this thread as public thread. I am not getting the Make Public/Make Private button.

So please do the same from your end.

Hi Muthulakshmi,

Thanks for your inquiry. We have made this forum thread as public. Unfortunately, we don’t see “Enterprise Support” badge associated with your account. We won’t be able to raise the priority of this issue as you reported this issue via our normal forum.

If you already bought enhanced support, please post your query in Aspose.Enterprise.Support forum. We will then raise the priority of this issue.

Hi,

Still I am anot able to see this post from other accounts. Please do the needful.

Also I don’t have “Enterprise Support” badge for this account, but I have for other account where I posted the same request again. If possible please link this post to user “mhsmck”

Hi Muthulakshmi,

Thanks for your inquiry. This forum thread is now public. Please check and let us know if you have any more queries.

Hi Muthulakshmi,

>> client machine works fine without this update.

Probably the client machine had already got this package.

>> If VS C++2012 update is mandatory then how we can handle in case of Linux Server

We don’t have appropriate solution for this issue on Unix-based systems yet.

We are working on it.

>> When I deploy the code in server, formatting issue still persists. Any specific requirement for deploying in server.

No specific requirements needed for deploying in servers.

Aspose Words copies the native library (WindowsNativeCall_x64.dll) into the server’s “tmp” folder which is “%TOMCAT_HOME\temp”.

Then if a document has “Use printer metrics to lay out document” option enabled, Aspose Words loads this library from the temp directory and gets the font metrics via native GDI calls.

In order to solve this problem try to perform these simple steps:

  1. Check the log file first. Are there any exceptions?

  2. Then check if the file %TOMCAT_HOME\temp\WindowsNativeCall\WindowsNativeCall_x64|x86.dll exists.

  3. Then check if VS2012 package has been installed on the server machine.

Also please use the latest Aspose Words version (16.8). It has a lot of performance improvements.

Please let us know the results.

Thanks

No exceptions. Tomcat temp folder has the dll. VisualStudio2012 C++2012 update is there. Only problem is this issue occurs when Tomcat is running as service. But when run as console its working fine. ASPOSE already locked this as defect as you can see in the previous thread from Tahir Manzoor( 770405 in reply to 769917)

Hi Muthulakshmi,

Thanks for your feedback. We reproduced this issue using a simple web application. We will inform you via this forum thread once there is any update available on this issue. Thanks for your patience and understanding.

The issues you have found earlier (filed as WORDSJAVA-1426) have been fixed in this Aspose.Words for .NET 17.3.0 update and this Aspose.Words for Java 17.3.0 update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(1)