SDPDFViewer
Visualize PDF documents in Smart Devices aplications

The external object sca.SDPDFViewer is implemented for Android and iOS platforms and it works both online and offline mode.

Main characteristics:

  • Works online and offline
  • Posibility to add markers to the pages (iOS only)
  • Print PDF (iOS only)
  • Send PDF by email. (iOS only)

Demo: you can try it running downloading our app Simplifica Labs where you can find other controls and external objects too, Simplifica Labs

 
How is it used? Event 'ViewPDFDocument' scaSDPdfViewer.Open(&url) Endevent     Next, examples of the control being used in iPhone and iPad.    
 
Installation:   
  • Copy the folder SDPdfViewer to <GX INSTALLATION FOLDER>\UserControls

  • Copy the folder Android to <GX INSTALLATION FOLDER>

  • If the file GXCustomExternalObjectsMapper.m already exist in the folder <GX INSTALLATION FOLDER>\iOS\Templates\iOS_Genexus\Classes then add the followings lines to the method externalObjectClassNameForObjectName,

if ([name isEqualToString:@"scaSDPdfViewer"]) return @"scaSDPdfViewerHandler";

if the file doesn`t exist, copy the files GXCustomExternalObjectsMapper.h and GXCustomExternalObjectsMapper.m to the folder 

  • Copy the file scaSDPdfViewerHandler.h and <GX INSTALLATION FOLDER>\iOS\Templates\iOS_Genexus\Classes

  • Copy the file scaSDPdfViewerHandler.m and <GX INSTALLATION FOLDER>\iOS\Templates\iOS_Genexus\Classes

  • Open with a text editor the file GX INSTALLATION FOLDER>\iOS\iOS.impl, for example Notepad++.

Add the followings lines to the bootstrapping section:

  <Template Id="iOS_Genexus\Classes\GXCustomExternalObjectsMapper.h" Output="iOS\Genexus\Classes\GXCustomExternalObjectsMapper.h"/> <Template Id="iOS_Genexus\Classes\GXCustomExternalObjectsMapper.m" Output="iOS\Genexus\Classes\GXCustomExternalObjectsMapper.m"/> <Template Id="iOS_Genexus\Classes\scaSDPdfViewerHandler.h" Output="iOS\Genexus\Classes\scaSDPdfViewerHandler.h"/> <Template Id="iOS_Genexus\Classes\scaSDPdfViewerHandler.m" Output="iOS\Genexus\Classes\scaSDPdfViewerHandler.m"/>
  • Edit the file <GX INSTALLATION FOLDER>\Android\FlexibleClient\src\com\artech\application\MyApplication.java adding to the  method connectExternalApis to the following line 

new ExternalApiDefinition("scaSDPdfViewer", "com.simplifica.external.pdfviewer.PdfViewerAPI"), //$NON-NLS-1$ //$NON-NLS-2$
  • Edit the file <GX INSTALLATION FOLDER>\Android\Templates\AndroidManifest.xml adding the following code:

        <activity android:name="com.artifex.mupdf.MuPDFActivity" android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar"> </activity>
  • Execute <GX INSTALLATION FOLDER>\GeneXus /install

  • Open GeneXus and import the XPZ of example.

  NOTE: To use the EO you should have in a SDPanel the UC sca.SDPdfViewer

IMPORTANT

If you want to generate with iOS in GeneXus versions below Upgrade 5 you must do the following steps:
  1. - Go to the folder: ...\GeneXus_PDF\iOS\Templates\iOS_Genexus.
  2. - Find the file: MainName-Info.plist
  3. - Edit the file adding the followings lines:
<key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key><true/> </dict>