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

Free Support Forum - aspose.com

Aspose.words making an outbound call when converting word to pdf

I am converting a docx to pdf usiing Aspose.Words.

In the document I have multiple Images , videos , table , checkboxes etc. No External URL / References

I found Aspose.Words makes an outbound call when it encounters an image. In my case would it make an outbound call ?

Sample Code Snippet :

	Document doc = new Document("temp.docx");
	pdfSream = new ByteArrayOutputStream();
	doc.save(pdfSream, SaveFormat.PDF);
	pdfbytes = pdfSream.toByteArray();
	//output has to be pdf.
	out = new FileOutputStream(new File("temp.pdf"));
	out.write(pdfbytes);
	out.flush();
	out.close();

@kapil.patil,

Thanks for your inquiry. Have you also tried the latest version of Aspose.Words for Java i.e. 19.11 on your end? In case the problem still remains, please ZIP and upload your simplified input Word document you are getting this problem with here for testing. We will then investigate the issue on our end and provide you more information.

hi awais , I am trying to understand behind the scene working of Aspose.Word and whether it makes an outbound HTTP call in following scenarios :

1- If .docx has any external reference e.g img src=“http:…”/
2- If .docx has an image without any external reference image

I am using the latest 19.8 package

@kapil.patil,

If .docx has any external reference e.g img src=“http:…”/ etc then yes Aspose.Words will make outbound HTTP calls to download those external resources.

If .docx has an image without any external reference image etc then Aspose.Words will not make any outbound HTTP calls.

However, if you do not want Aspose.Words to make outbound HTTP calls to load any external resources in any case, then please try using the following code. Hope, this helps:

LoadOptions opts = new LoadOptions();
opts.setResourceLoadingCallback(new HandleResourceLoadingCallback());
Document doc = new Document("E:\\temp\\in.docx", opts);
doc.save("E:\\temp\\19.10.pdf");

private static class HandleResourceLoadingCallback implements IResourceLoadingCallback {
    public int resourceLoading(ResourceLoadingArgs args) {
        return (args.getResourceType() != ResourceType.DOCUMENT)
                ? ResourceLoadingAction.SKIP
                : ResourceLoadingAction.DEFAULT;
    }
}

Thanks for the response