Hello Team,
when we hover on footnote then url shown on footnote in doc as below given screen shot.
Doc file Screen Shot
But after conversion in pdf url does not shown on footnote when we hover on footnote.
In PDF file:
So please can you suggest that how can fix it.
As below code are using.
Document worddoc=new Document();
DocumentBuilder documentBuilder = new DocumentBuilder(worddoc);
documentBuilder.InsertHtml("Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the
industry's standard dummy text ever since the 1500s.");
worddoc.Range.Replace(new Regex(@"#" + #0002_1_, new FindandInsertFootNote(@"" + " <span style='font-size:9pt;font-family:"Helvetica",sans-serif;color:#404040;'>Source: <a style='font-size:9pt;font-family:"Helvetica",sans-serif;color:#0000EE;' href='https://www.w3schools.com/html/tryit.asp?filename=tryhtml_default_default'><u>https://www.w3schools.com/html/tryit.asp?filename=tryhtml_default_default</u></a><span style='font-size:9pt;font-family:"Helvetica",sans-serif;color:#404040;'>, test data</span></span>"), false);
@RiteshK10 Could you please attach your output DOCX and PDF documents here for our refence? We will check the issue and provide you more information.
Also according to the syntax, it looks like you are using some very old version of Aspose.Words. Have you tried using the latest 23.12 version of Aspose.Words?
Hello @alexey.noskov Thanks for update.
I have attached pdf and doc file please check footnote hover issue and footnote value not clickable in pdf.
AfterConvertsionPdfFile_DocFile_FootNoteHover.pdf (9.9 KB)
DocFile_FootNoteHover.docx (17.3 KB)
@RiteshK10 Footnote reference should not be clickable in PDF document. If you convert your document to PDF using MS Word you will observe exactly the same behavior.
Regarding the footnote value. As I can see test
hyperlink is clickable in PDF document, the same as in MS Word.
Hello @alexey.noskov thanks for update but please confirm me on another point as well that if we hover on footnote url is appearing, but it is not appearing in pdf when we hover on footnote.
@RiteshK10 The link in footnote works fine in the PDF document you have uploaded:
Hello @alexey.noskov Thanks for update as url is not showing on footnote text in PDF file as given below screen shot.
@RiteshK10 This is an expected behavior. If you convert your document to PDF using MS Word you will observe the same behavior.
Hello @alexey.noskov thanks for update.
But in some cases behavior is same in both file PDF and doc file. As doc and pdf file is attached for your reference.
In below attached file footnote value (1) is clickable in both doc and pdf file. And URL is also showing when we hover on footnote value(1) in PDF.
PDF_File_AfterConversion_FootnOte_Hover_Issue.pdf (22.0 KB)
Doc_File_AfterConversion_FootnOte_Hover_Issue.docx (17.8 KB)
@RiteshK10 In this example the footnote reference is hyperlink, so it is exported as hyperlink to PDF:
<w:hyperlink r:id="rId7" w:tgtFrame="_blank" w:tooltip="https://www.nippon.com/en/behind/l10626/" w:history="1">
<w:r>
<w:rPr>
<w:rStyle w:val="FootnoteReference"/>
</w:rPr>
<w:footnoteReference w:id="1"/>
</w:r>
</w:hyperlink>
Hello @alexey.noskov So can you please suggest that how can achieve the footnote reference is hyperlink using code.
as I am using below code for creating footnote.
Document worddoc=new Document();
DocumentBuilder documentBuilder = new DocumentBuilder(worddoc);
documentBuilder.InsertHtml("Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the
industry's standard dummy text ever since the 1500s.#0002_1_");
worddoc.Range.Replace(new Regex(@"#" + #0002_1_, new FindandInsertFootNote(@"" + " <span style='font-size:9pt;font-family:"Helvetica",sans-serif;color:#404040;'>Source: <a style='font-size:9pt;font-family:"Helvetica",sans-serif;color:#0000EE;' href='https://www.w3schools.com/html/tryit.asp?filename=tryhtml_default_default'><u>https://www.w3schools.com/html/tryit.asp?filename=tryhtml_default_default</u></a><span style='font-size:9pt;font-family:"Helvetica",sans-serif;color:#404040;'>, test data</span></span>"), false);
@RiteshK10 You can achieve this using code like the following:
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Insert some text
builder.Write("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce ac dictum lorem. Praesent at sollicitudin dui, eu malesuada purus.");
// Insert a hyperlink with empty display value
Field hyperlink = builder.InsertHyperlink("", "https://www.aspose.com", false);
// Move documet buidler cursor inside the field and insert footnote.
builder.MoveTo(hyperlink.End);
builder.InsertFootnote(FootnoteType.Footnote, "This is my cool footnote");
doc.Save(@"C:\Temp\out.docx");
doc.Save(@"C:\Temp\out.pdf");
Thanks @alexey.noskov now it’s working fine.
1 Like