How to Disable Hyperlink while converting a word doc to PDF?

Hi Team,

Can you please guide me with some sample code which processes the word document to disable the hyperlinks when converted to PDF?

PFA - Sample word document with some hyperlinks.

Found http://www.aspose.com/docs/display/wordsjava/How+to++Replace+or+Modify+Hyperlinks

But wanted a simple way to disable the hyperlinks when converted to PDF. Hope to get a simple yet concrete code to handle disabling of all kind of hyperlinks.

Thanks,

Satyendra

Hi Satyendra,

Thanks for your inquiry. You can convert all Hyperlink fields in a Word document to static texts by using the following code snippet:

Document doc = new Document("C:\\Temp\\Hyperlink_Test.docx");
FieldsHelper.convertFieldsToStaticText(doc, FieldType.FIELD_HYPERLINK);
doc.save("C:\\Temp\\out.pdf");

You can find the implementation of “convertFieldsToStaticText” method in the following page:

If we can help you with anything else, please feel free to ask.

PS: However, upon opening the output Pdf document with Pdf readers (Acrobat, Chrome, Foxit etc), it appears that these readers treat normal text starting with “http://” as links.

Best regards,

In which package will I find FieldsHelper class? I am using 13.6.0 Aspose.words. Please let me know.

Thanks,
Satyendra

Hi Satyendra,

Thanks for your inquiry. Please find the FieldsHelper class at following documentation link.

Tahir,

Is this class not part of Aspose.words implementation?
Should we separately create this class and then use it?

Thanks,
Satyendra

Hi Satyendra,

Thanks for your inquiry. The FieldsHelper class is not a part of Aspose.Words for Java API. You can reuse the code of FieldsHelper class. If we can help you with anything else, please feel free to ask.

Best regards,

Hi Hafeez,

Thank you for your promt responses. So far its doing good. Thank you again

Satyendra

Hi Satyendra,


Thanks for your feedback. In case you have further inquires or need any help, please let us know.

Best regards,