[英]Deep linking href in pdf
I have a deep link that works when in the chrome browser to open my app with a certain ID. 当我在Chrome浏览器中打开具有特定ID的应用程序时,我有一个有效的深层链接。 This link looks like following: 该链接如下所示:
intent://m/#Intent;scheme=myapp://app.com/reference/2016062910185811;package=some.package.com;end
this works when in a webbrowser via <a href="intent://...;end">click</a>
. 当通过<a href="intent://...;end">click</a>
在网络浏览器中时,此功能有效。
But when setting this link in a PDF (via aspose) this doesn't do anything, although it recognizes that it is a link (I can see the click animation). 但是,当在PDF中设置此链接(通过aspose)时,尽管它认识到它是一个链接(我可以看到单击动画),但是它什么也没做。
The link is set via the following code:: 通过以下代码设置链接:
var img = new Aspose.Pdf.Generator.Image(sec1);
tr.Paragraphs.Add(img);
//Assign a new instance of hyperlink to hyperlink property of segment
img.Hyperlink = new Hyperlink {
LinkType = HyperlinkType.File,
Url = "intent://m/#Intent;scheme=myapp://app.com/reference/" + input.Reference + ";package=some.package.com;end"
};
Non-standard URL schemes (which is what intent://
is, literally) aren't always treated as links. 非标准URL方案(实际上是intent://
的意思)并不总是被视为链接。 It sounds like the PDF viewer you're using isn't set up to recognize them correctly, and even if it were, the link would be broken anywhere except on Android devices. 听起来您使用的PDF查看器未正确识别它们,即使链接正确,该链接也会在Android设备上的任何地方断开。
Your best option is to somehow wrap that URL inside a link that the PDF viewer CAN recognize ( http://
or https://
), and then take care of opening your app later, usually by way of some sort of automatic redirect. 最好的选择是将URL包裹在PDF查看器可以识别的链接( http://
或https://
)中,然后照顾以后再打开您的应用程序,通常是通过某种自动重定向的方式。 This is how we handle things at Branch.io , to make sure the app always launches no matter where the link is opened. 这就是我们在Branch.io处处理事情的方式 ,以确保无论在哪里打开链接,应用程序始终启动。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.