Free Support Forum - aspose.com

Aspose words Linux support for inserHtml?

Hi Aspose Team,
We are trying below, please confirm aspose words compatibility with linux

//below code works in Linux and generates pdf with image. when we dont have any template.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.innerHtml("");
doc.save("/dir/dir/file.pdf");

//below code is not working in Linux, it generates pdf with blank image. when we use any doc template.

Document doc = new Document("/dir/dir/template.doc");

DocumentBuilder builder = new DocumentBuilder(doc);

builder.innerHtml("");

doc.save("/dir/dir/file.pdf");


But both the code snippets are working fine in windows OS,
Please help us in resolving this.


Thanks
Ganesh

Hi

Thanks for your inquiry. I cannot reproduce the problem on my side. Please make sure that the image and document exists on the following path. Maybe you should use full path instead of relative. The problem can occur because Aspose.Words cannot access this picture or document.

Best regards,

Thanks for your response,

  • if the image is not exist (or) path is not correct it should not create a pdf even when we remove template and use Document doc = new Document() instead of Document doc = new Document(/absolute_path/word_template.doc), but it is.
  • Template path is deffinetly not wrong becuse we are able to see the template in pdf, but only issue is the images are showing in pdf.[if we use apsose api builder.insertImage, images are printing without any issue but if we use html img tag and include using builder.inserHtml images are showing].

please note: Issue is occuring only in when we are trying from linux, with template and trying to include an image using thru builder.inserHtml("")

Thanks

Ganesh

Hello

Thanks for your request. Could you please attach the original template file and image here for testing?

Also which version of Aspose.Words for Java you use? To check version of Aspose.Words for java, unzip Aspose.Words.jar, open META-INF\ MANIFEST.MF file in notepad, you will see the following:

Manifest-Version: 1.0

Specification-Title: Aspose.Words for Java

Specification-Version: 10.5.0.0

Specification-Vendor: Aspose Pty Ltd

Implementation-Title: Aspose.Words for Java

Implementation-Version: 10.5.0.0

Implementation-Vendor: Aspose Pty Ltd

Release-Date: 2011.09.30

Best regards,

Thanks for your quick response,
I have attached complete Java files, images, templates for your reference.

OS:Linux
Version:2.6.18-194.17.1.el5
Platform: x86_64


Here is the aspose version.
Manifest-Version: 1.0
Specification-Title: Aspose.Words for Java
Specification-Version: 10.4.0.0
Specification-Vendor: Aspose Pty Ltd
Implementation-Title: Aspose.Words for Java
Implementation-Version: 10.4.0.0
Implementation-Vendor: Aspose Pty Ltd
Release-Date: 2011.08.30

Hi

Thanks for your request. I think, in your case, you should use code like the following:

Document doc = new Document("/opt/IBM/WebSphere/AppServer/java/jre/bin/Template.doc");

DocumentBuilder builder = new DocumentBuilder(doc);

builder.insertHtml("");

builder.insertHtml("ganesh");

doc.save("/opt/IBM/WebSphere/AppServer/java/jre/bin/tes11.pdf");

Hope this helps.

Best regards,

It works perfect, thanks a lot for your support.