Skip to content
Encode, Decode, View the pdf from Fuse apps
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Assets
AndroidImpl.uno
Licence
MainView.ux
PDFViewAndroid.uno
PDFViewNative.uno
PDFViewScriptClass.uno
PDFViewiOS.uno
PdfJs.uno
PreviewImpl.uno
iOSImpl.uno
pdf.unoproj
readme.md

readme.md

FUSE.PDF

Works on iOS & Android

Initatialisation.

You can initialize the module by simply require it in you JS file.

var PDF = require("PDF")

Base64 to PDF saved locally

You can decode the base64 pdf comming from the server by this way, the function takes one argument, the name of the file with his extention. the function return a path of where your file have been saved.

	function DecodeFromBase64(){
		PDF.DecodeFromBase64(data, "file.pdf").then(function(results){
			console.log(JSON.stringify(results))
		}, function(err){
			console.log(JSON.stringify(err))
		})
	}

Local pdf to Base64.

You can encode local pdf to base64 by this way, the fuction takes one argument, the name of the file saved in the application directoty with his extension. the function return a base64 encoded string.

function EncodePDFToBase64(){
	PDF.EncodeToBase64("file.pdf").then(function(base64){
		console.log(JSON.stringify(base64))
	}, function(err){
		console.log(JSON.stringify(err))
	})
}

View the pdf file on both iOS and Android.

for viewving you pdf file you will need to add Native.PDF inside a NativeViewHost. add an ux:Name to your Native.PDF and call on it Open function. Open function takes one argument , the name of the file you are trying to see and the .pdf extension

			<NativeViewHost>
				<Native.PDF ux:Name="PDFVIEW"/>
			</NativeViewHost>

		function ViewPDF(){
			PDFVIEW.Open("file.pdf");
		}

You can’t perform that action at this time.