Titanium, displaying PDF

Hi,
in NG/Titanium

scopes.svyIO.openFileWithDefaultViewer(‘F:/Eigene Dateien/servoy_workspace_Arbeit/NG_BIB/medias/Historie.pdf’)

is no longer support

Any idea, how display a PDF- and an EXCEL-file in Titanium solutions?

Thanks and hope to see you all during Servoycamp

Ralf

Hi Ralf,

There is no way you can control the file system from a browser, so you can not open files directly.

If you want / need more integration with your local machine, you could look into NGDesktop, which has some extensions that will enable you to do quite a lot of things that could been done in smart client
Otherwise, most browsers can display pdf files natively, but you can also look into the pdf viewer component.

Hope this helps, see you at ServoyCamp :-)

Hi Marc,

thanks and which way I should choose using NGDesktop Client???

Best
Ralf

You use a JNLP-File right now, if I remember correctly?

With NGDesktop-Client you need a special client which can be exported in the Developer. You need a link to the solution (same link you use in the browser) an Icon and a logo and then you receive a mail with the link to the installer / files for the auto-update (windows only).

With this client you can use desktop-features, if you install the relevant webcomponents NG-Desktop File plugin (Handling files similar to smartclient, but with much more callback), NGDesktop UI plugin for Menus (Mac-Users can only use Cmd-C / X / V if the menu is defined, example is included) and NG Desktop Utils which gives the ability to check if you are in NGDesktop and to execute programms / open URLs.

You can then do something like

plugins.ngdesktopfile.openFile(targetFileName);

of if you want to go the manual route and adapt the code from scopes.svyIO:

	if (application.getApplicationType() == APPLICATION_TYPES.NG_CLIENT && scopes.svyDocumentManagement.isNgDesktopFile()) {
		fileName = '"' + fileName + '"';
		var osName = application.getOSName();
		if (/Windows/.test(osName)) {
			plugins.ngdesktoputils.executeCommand('rundll32', ['url.dll,FileProtocolHandler', fileName]);
		} else if (/Linux|Freebsd/.test(osName)) {
			plugins.ngdesktoputils.executeCommand('mozilla', [fileName]);
		} else if (/Mac/.test(osName)) {
			plugins.ngdesktoputils.executeCommand('open', [fileName]);
		}
	}

for pdf just the file plugin will work fine i think so: plugins.file.openFile()

for excel i guess it depends a bit what is installed and what the browsers does…