Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

Force PDF form to open in browser?

Avatar

Former Community Member

I'm just wondering if it is possible to force a pdf file to open in a web browser. So that, if the file is saved to someone's computer, when you open it, it automatically opens in the web browser

Thanks,


Nik

1 Reply

Avatar

Level 8

Of course you can set the target operating system to associate the pdf extension with a web browser but I think you're probably looking for the form itself to be able to control that regardless of operating system.

If so, try putting this in the top level subform's docReady event:

if (!event.target.external){

cURL=event.target.path;

cURL=cURL.replace(/\/(\w)\//,"$1:/");

app.launchURL(cURL,true);

event.target.closeDoc();

}

Adobe will show you a warning to Cancel or Allow but that can't be supressed for security reasons.

Kyle