PDfViewer hyperlink not working

hi,

Is there a setting in PDFViewer or PDFDoc so the hyperlinks in document are not flatten as clear text?

thanks,
MarcM

By default no flattening occurs.

Are you calling a flattening function?

Can you please explain in more detail what you are doing, including what output you got, and what you expected.

Thanks for the reply,

we have a wpf project that essentially does:

//… code snippet example
var _pdfDocument = new PDFDoc(bookPath);
//…

public PDFDoc CurrentPdfDocument
{
get { return _pdfDocument; }
}

and in xaml :

we bind to that…

<pdf:PDFViewWPF x:Name=“PdfViewer”

CurrentPageViewMode="{Binding CurrentDocumentPageViewMode, Mode=TwoWay}"
CurrentPagePresentationMode="{Binding CurrentDocumentPagePresentationMode, Mode=TwoWay}"
CurrentDocument="{Binding CurrentPdfDocument}"
CurrentPageNumber="{Binding CurrentPageNumber, Mode=TwoWay}"/>

Am I missing default property settings?

As for the example I can take any pdf that has any link. all link in them will be seen as text and not link.

MarcM

I posted yesterday but it did not get released or something…

Example:

var document = new PDFDoc(path); // path point to any pdf that has either hyperlink to external link or reference to chapter in the same document);

a snippet of the user control with PDFViewer

<pdf:PDFViewWPF x:Name=“PdfViewer”

CurrentPageViewMode="{Binding CurrentDocumentPageViewMode, Mode=TwoWay}"
CurrentPagePresentationMode="{Binding CurrentDocumentPagePresentationMode, Mode=TwoWay}"
CurrentDocument="{Binding CurrentPdfDocument}"
CurrentPageNumber="{Binding CurrentPageNumber, Mode=TwoWay}"/>

CurrentDocument will get the pointer to the new PDFDoc

I do not do anything special and all hyperlinks are not clickable.

MarcM

Most likely the links are actually just regular text (and not proper link annotations).

Try calling the following when you instantiate your PDFViewWPF object.

pdfviewwpf.UseURLExtraction = true;

If that doesn’t help you will need to post here, or here, the PDF file, and clearly indicate the page and link you expected to work.

Thanks for trying to help. If I build a simpler application all works properly…Obviously a bug in our code :frowning:

Found the reason, we call toolmanager.createtool with ToolManager.ToolType.e_text_select on startup. When I set it to e_pan links are enable again. I was hoping to find a way to switch that base on user action but so far no luck using mouse down and up event.

Do you know a way to do this other then having user select what mode explicitly?
Thanks,

MarcM

Attached are modified ToolManager, TextSelectStructural, and LinkAction, which should make this possible. You should be able to replace the same versions in your code base.
You have to set ToolManager.TextSelectCanClickLinks = true after you create the ToolManager.
If you want to change how some nuances work, please see where TextSelectStructural is referring to mToolManager.TextSelectCanClickLinks.

LinksWhileTextSelecting.zip (11.3 KB)