Free Support Forum - aspose.com

Working fine in Windows machine but failing in Unix machine

Hi,

I need to convert a doc to pdf. Its working fine in windows because the file paths are as follows :

Document doc = new Document("C:/AsposeTest/aug/Test result_HtmlTags.doc");

doc.save("C:/AsposeTest/aug/output.pdf", com.aspose.words.SaveFormat.PDF);

But when i am running this in Unix machine the its not able to convert it to pdf where the

file path is coming as "/usr/local/Test.doc" .

Even I tried as below :

Document doc = new Document("C:\\AsposeTest\\aug\\Test result_HtmlTags.doc");

doc.saveToPdf("C:\\AsposeTest\\aug\\1.pdf");

Hello Sriman,

Thanks for using our products.

I have tested the scenario using Aspose.Pdf for Java 2.9.0 over Red Hat Enterprise Linux 5 (64Bit) with JRE 1.6.0_21-rev-b10 and I am unable to notice any problem. The PDF document is properly being generated.

I have also tried converting the same XML file into PDF over Windows 7 Professional (64Bit) where my JDK version is 1.6.0_20 and Aspose.Pdf for Java is 2.9.0 and I am also unable to notice any issue. Can you please share the sample XML file causing issue so that we can test the scenario at our end. We apologize for your inconvenience.

[Java]

Pdf pdf = new Pdf();
pdf.bindXML("SampleXML.xml", null);
pdf.save("result.pdf");
System.out.println("Aspose PDF is saved successfully");

Hello Sriman,

The initial intimation that I have received was regarding problem in PDF generation using BindXML(...) method of Aspose.Pdf for Java. Now that I can see the problem description is updated for Word to PDF conversion, so it seems to be related to Aspose.Words for Java.

For your convenience, I am moving this thread to Aspose.Words forum where I believe my fellow workers taking care of this product would be in better position to answer this query. We apologize for this inconvenience.

Hello Sriman,

Thanks for your request. I'm a representative for Aspose.Words. Using Aspose.Words you can convert any Word documents to PDF. Please see the following link to learn more:

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net/howto-convert-a-document-to-pdf.html

Could you please attach the document you are getting problem with? I will check it on my side and provide you more information.

Please let me know in case of any issue. I will be glad to help you.

Best regards,

Hi, Its not specific to any document.

If the file path is as follows its throwing the exception. However Its working fine in windows machine where that path is "C:/etc/etc/test.doc"

I tried with aspose word 4.0.3 and 10.0 (by downloading from http://www.aspose.com/community/files/72/java-components/aspose.words-for-java/default.aspx)

Document doc = new Document("/usr/AsposeTest/aug/Test result_HtmlTags.doc");

doc.save("/usr/AsposeTest/aug/output.pdf", com.aspose.words.SaveFormat.PDF);

I am using Aspose java 2.7.0

Hello

Thanks for your request. When you render documents to PDF, XPS or convert to EPUB that requires embedding of fonts into a document, then Aspose.Words needs to have access to TrueType fonts. If you run Aspose.Words on a Windows system, then by default it will search for fonts in the system Windows\Fonts folder. But if you run Aspose.Words on a Linux system, it does not have a default location for fonts and you need to specify it explicitly.

Use the new com.aspose.words.FontSettings class and setFontsFolder/setFontsFolders methods to specify the location of TrueType fonts.


FontSettings.setFontsFolder("C:\\Users\\Andrey\\IdeaProjects\\awtest");

DocumentBuilder b = new DocumentBuilder();

b.getFont().setName("Water on the Oil");

b.getFont().setSize(72);

b.writeln("Hello World!");

b.getDocument().save("TestHelloWorld Out.pdf");

http://www.aspose.com/community/files/72/java-components/aspose.words-for-java/entry294447.aspx

Best regards,

Hi I am getting the following exception :

ERROR FileAttachmentHelper: Exception while converting the file :/local/temp/1105-2578166_1309270046087/AllDocsType/1.doc into Pdf
java.lang.IllegalStateException: Cannot find any fonts installed on the system.
at asposewobfuscated.pq.a(TTFontFiler.java:106)
at asposewobfuscated.pq.a(TTFontFiler.java:35)
at com.aspose.words.n.a(AttributeConverter.java:40)
at com.aspose.words.fo$b.C(DocumentRunSplitter.java:484)
at com.aspose.words.fo$b.moveNext(DocumentRunSplitter.java:456)
at com.aspose.words.fo.a(DocumentRunSplitter.java:200)
at com.aspose.words.aol.UG(RunWriter.java:170)
at com.aspose.words.aol.b(RunWriter.java:138)
at com.aspose.words.fo.(DocumentRunSplitter.java:77)
at com.aspose.words.aqx.a(SpanGenerator.java:225)
at com.aspose.words.fp.ak(DocumentSpanConverter.java:652)
at com.aspose.words.fp.BL(DocumentSpanConverter.java:592)
at com.aspose.words.fp.moveNext(DocumentSpanConverter.java:167)
at com.aspose.words.fp.Bh(DocumentSpanConverter.java:203)
at com.aspose.words.vi.a(LayoutDocument.java:37)
at com.aspose.words.Document.updatePageLayout(Document.java:1402)
at com.aspose.words.Document.ab(Document.java:1335)
at com.aspose.words.Document.zY(Document.java:1348)
at com.aspose.words.Document.getPageCount(Document.java:1383)
at com.aspose.words.pj.a(FixedPageWriterBase.java:21)
at com.aspose.words.Document.a(Document.java:1280)
at com.aspose.words.Document.a(Document.java:774)
at com.aspose.words.Document.f(Document.java:737)
at com.aspose.words.Document.save(Document.java:728)

Hello

Thanks for your request. FontsFolder should contain fonts, which are using in your document. At least this folder should contain one valid TrueType font. Please try creating folder, put there few valid MS TrueType fonts (Arial and Times New Roman, for example) and specify this folder as FontsFolder. Also, please make sure that you application can read fonts from this folder.

Best regards,