We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Image Rendering while generating Stamped PDF file is not happening

Initial document contains image and text. We noticed, image rendering is not happening on the rendered pdf file. Image is missing from the rendered file. Attached is the evidence for the issue.


Hi Shilpa,


Thank you for contacting support. Please provide us your source Visio and the sample code (only Aspose API part) in this forum thread. It’ll help us replicating the problem on our side. We’ll investigate and reply you appropriately.

Hello,


Please find the attached document for the sample file for which Image rendering is not happening as expected.

Following is the source code for the doc file :
------------------------------------
try {
// Document doc = new Document(“d:\test_doc.doc”);
com.aspose.words.License license = new com.aspose.words.License();
license.setLicense(new FileInputStream(“d:\Aspose.Total.Java.lic”));

//Once the builder is created, its cursor is positioned at the beginning of the document.
docToPDF(“D:\GEHC_FILE_SAMPLES\ft1.doc”, “D:\GEHC_FILE_SAMPLES\ft1.doc.pdf”, “”, “C:\WINDOWS\Fonts”);


} catch (Exception e) {
System.out.println(e);
}

------------------------------------
Note :
1) Aspose word jar should be there in the class path
2) Fonts folder should contains the fonts
-----------------------------------
JAR files used are as follows :

aspose-cells-2.5.4.18.jar
aspose-metafiles-1.6.1-20100110.jar
aspose-pdf-jdk16.jar
aspose-pdf-kit-3.6.0.jar
aspose.slides-14.4.0.jar
Aspose.Words.jdk15.jar

Hi Shilpa,


This query is related to the Aspose.Words API. I’m moving it to the Aspose.Words forum. One of my fellow workers shall reply you soon there.

Hi Shilpa,

Thanks for your inquiry. The input document shared in this forum thread have 0kb file size. Could you please re-attach your input Word document here for testing? We will investigate the issue on our side and provide you more information.

Hi Tahir Manzoor,


Please find the attachment for the sample document. Size of the doc is 802KB.
Please revert if you find any challenge to download the file, we can mail you separately.

Regards,
Shilpa
Hi Shilpa,

Thanks for sharing the detail. We have tested the scenario using latest version of Aspose.Words for Java 16.1.0 and have not found the shared issue. The images render correctly in output Pdf. Please use Aspose.Words for Java 16.1.0.

Moreover, 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 refer to the following articles:

How Aspose.Words Uses True Type Fonts
How to Specify True Type Fonts Location
How to Receive Notification of Missing Fonts and Font Substitution during Rendering

Hi Tahir,


we tried using new Words java file as per your suggestion and we encountered following error :
Expected static method
com.aspose.words.FontSettings.setFontsFolders([Ljava/lang/String;Z)V

TrueFont installed already. Could you please share the latest JARs info required for doc files and the rendered file you were able to generate from the sample document.

Regards,
Shilpa
Hi Shilpa,

Thanks for your inquiry. Please note that all methods of FontSettings class made instance methods. Static methods are replaced with static DefaultInstance property. Please read about this public API change in Aspose.Words v16.1.0 from following link.
Public API Changes in Aspose.Words 16.01.0

If you are using FontSettings.setFontsFolders, please use it as shown in following code example. We suggest you please read following article. We will update our documentation according to this new API change soon.
How to Specify True Type Fonts Location

Document doc = new Document(getMyDir() + "Rendering.doc");

FontSettings.getDefaultInstance().setFontsFolders(new String[] {"C:\\MyFonts\\", "D:\\Misc\\Fonts\\"}, true);

doc.save(getMyDir() + "Rendering.SetFontsFolders Out.pdf");