1.0.2 • Published 2 years ago

@alitajs/fileviewer v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@alitajs/fileviewer

Documents and images viewer

Install

npm install @alitajs/fileviewer
npx cap sync

iOS

  • in Xcode, open Info.plist and add a new Information Property like Privacy - Photo Library Usage Description and set a value to We need to write photos. This is required to have the Shareof images and the create Movie working.

API

openDocument(...)

openDocument(options: OpenDocumentOptions) => Promise<void>
ParamType
optionsOpenDocumentOptions

previewImage(...)

previewImage(options: PreviewImageOptions) => Promise<PreviewImageResult>
ParamType
optionsPreviewImageOptions

Returns: Promise<PreviewImageResult>


Interfaces

OpenDocumentOptions

PropTypeDescription
filePathstring文件本地路径

PreviewImageResult

PropTypeDescription
resultbooleanresult set to true when successful else false
messagestringa returned message
imageIndexnumberResult Image index at closing returned

PreviewImageOptions

PropTypeDescription
imagesImage[]List of image
optionsViewerOptionsViewer options (optional)
mode'gallery' | 'slider' | 'one'Viewer mode ("gallery","slider","one") (default "slider")
startFromnumberViewer image index to start from for mode ("slider","one")

Image

PropTypeDescription
urlstringimage url
titlestringimage title optional

ViewerOptions

PropTypeDescription
sharebooleandisplay the share button (default true)
titlebooleandisplay the image title if any (default true)
transformerstringtransformer Android "zoom", "depth" or "none" (default "zoom")
spancountnumberGrid span count (default 3)
maxzoomscalenumberMax Zoom Scale (default 3)
compressionqualitynumberCompression Quality for Sharing Image range 0-1 (default 0.8)
dividstringDiv HTML Element Id (Web only) (default 'photoviewer-container')
movieoptionsMovieOptionsMovie Options iOS only

MovieOptions

PropTypeDescription
namestringMovie Name (default "myMovie") iOS only
imagetimenumberImage Time Duration in Seconds (default 3) iOS only
modestringMovie Mode "portrait" / "landscape" (default "landscape") iOS only
ratiostringMovie Ratio "4/3" / "16/9" (default "16/9") iOS only

How to use this plugin in existing native project

ios

in Podfile

pod 'AlitajsBarcode'

android

in build.gradle

repositories {
  ...
  maven { url 'https://jitpack.io' }
}

dependencies {
  implementation 'com.github.alitajs:alitajs-native-barcode:Tag'
}