i'm writing uwp app in javascript.
contains list of links each call pdf.
pdfs stored locally in app.
goal provide library of hands-free documentation hololens (windows ar)
anyway open pdfs with:
windows.system.launcher.launchfileasync(file)
this works great.
pdfs reference each other hyperlinks.
can modify hyperlinks whatever when pdfs generated.
how can make hyperlinks still reference 1 when opened in user's default pdf app.
again default pdf app can whatever.
works fine in adobe acobat windows,
port functionality on uwp.
current code , working:
window.onload = function () { document.getelementbyid("#id").onclick = function (evt) { pdfopen("pdf.pdf") } function pdfopen(pdf) { var imagefile = "assets\\" + pdf; // image file package's image directory windows.applicationmodel.package.current.installedlocation.getfileasync(imagefile).then( function (file) { // launch retrieved file using default app var options = new windows.system.launcheroptions(); windows.system.launcher.launchfileasync(file) } );
appreciate in advance <3
but how can make hyperlinks still reference 1 when opened in user's default pdf app.
when use launchfileasync
method without launcheroptions
, alsway use default app open .pdf files.
if set use app open .pdf files, should able use launcheroptions.targetapplicationpackagefamilyname
set package family name of target package should used launch file. can add launcheroptions
in launchfileasync(istoragefile, launcheroptions)
starts default app associated specified file, using specified options.
for example use edge open .pdf files:
var options = new windows.system.launcheroptions(); options.targetapplicationpackagefamilyname = "microsoft.microsoftedge_8wekyb3d8bbwe"; windows.system.launcher.launchfileasync(file, options).then( function(success) { if (success) { // file launched } else { // file launch failed } });
Comments
Post a Comment