LogoLogo
Developer HubGitHubContact Us
  • Welcome!
  • Olive Helps
    • Platform
      • How Olive Helps Works
      • Installation
      • Account Creation
      • Distributing Olive Helps
    • FAQs
      • General Loop FAQs
      • Loop Development FAQs
      • Olive Helps User FAQs
      • Security / IT FAQs
    • Data Security
      • User Data
      • Antivirus and Firewalls
  • Loop Development Kit
    • Your First Loop
      • Become a Loop Author
      • Creating a Loop
      • Build Your Loop
      • Local Loop Installation
      • Restarting Local Loops
    • Troubleshooting
    • Loop Security
      • Permissions
      • Environment Permissions
    • Loop Publication
      • Loop Approval Checklist
    • Loop Analytics Library
    • Examples
  • Documentation
  • Interfaces
  • Type Alias
  • Enumerations
  • Whisper Components
    • Base Attributes
    • Autocomplete
    • Box
    • Breadcrumb
    • Button
    • Chart
    • CollapseBox
    • Grid
    • Checkbox
    • Date Time
    • Divider
    • DropZone
    • Email
    • Icon
    • List Pair
    • Link
    • Pagination
    • Number
    • Markdown
    • Message
    • Password
    • Progress
    • Radio
    • Rating
    • RichTextEditor
    • Section Title
    • Select
    • Text Input
    • Telephone
    • Typography
  • APTITUDES
    • What are Aptitudes?
    • Browser
    • Clipboard
    • Config
    • Cursor
      • Screen Scaling Behavior
    • Document
    • Filesystem
    • Keyboard
    • Network
    • Process
    • Screen
    • Search
      • Index
    • System
    • UI
      • Loop UI Handlers
    • User
      • JWT
    • Vault
    • Whisper
      • Whisper Updates
      • JSX Whispers
    • Window
      • Screen Scaling Behavior
  • Release Notes
    • What's New
      • Olive Helps v0.55.0
      • Olive Helps v0.54.1
      • Olive Helps v0.53.1
      • Olive Helps v0.51.2
      • LDK v4.0.0
      • Olive Helps v0.50.3
      • Olive Helps v0.49.5
      • LDK v 3.18.0
      • Olive Helps v0.47.2
      • Olive Helps v0.46.2
      • LDK v 3.17.0
      • Olive Helps v0.45.4
      • Olive Helps v0.44.2
      • Olive Helps v0.43.1
      • Olive Helps v0.42.1
      • Olive Helps v0.41.4
      • Olive Helps v0.40.2
      • Olive Helps v0.39.4 & LDK v3.16.0
      • Olive Helps v0.38.8 & LDK v3.15.0
      • Olive Helps v0.36.5
      • Olive Helps v0.36.4
    • Archive
      • Olive Helps v0.36.3 & LDK v3.14.0
      • Olive Helps v0.34.4
      • LDK v3.13.0
      • Olive Helps v0.32.2 & LDK v3.12.0
      • Olive Helps v0.31.2 & LDK v3.11.0
      • Olive Helps v0.30.2 & LDK v3.10.0
      • Olive Helps v0.29.4
      • Olive Helps v0.29.3 & LDK v3.9.0
      • Olive Helps v0.28.3 & LDK v3.8.0
      • Olive Helps v0.27.7
      • Olive Helps v0.27.5
      • Olive Helps v.027.4
      • Olive Helps v0.27.2 & LDK v3.7.0
      • Olive Helps v0.25.3 & LDK v3.5.1
      • Olive Helps v0.24.6 & LDK v3.4.0
      • Olive Helps v0.23.2 & LDK v3.3.0
      • Olive Helps v0.22.3 & LDK v3.2.0
Powered by GitBook
On this page

Was this helpful?

  1. APTITUDES

Document

The Document Aptitude provides the ability to interact with documents (currently only XLSX files).

PreviousCursorNextFilesystem

Last updated 3 years ago

Was this helpful?

readPDF

readPDF provides the ability to input a PDF as a Uint8Array (either from the or Aptitudes) and parse the text content inside it.

import { document, filesystem } from '@oliveai/ldk';

const pdfFile = await filesystem.readFile('./earnings-report.pdf');
const pdfContent = await document.readPDF(pdfFile);
const expected = {
    // "1" is the page number
    "1": {
        "Content": [
            {"Value": "Test text", "Type": "text"},
            {"Value": "", "Type": "newLine"},
            {"Value": "More text on the next line", "Type": "text"},
            {"Value": "base64 string", "Type": "photo"},
        ]
    }
}

console.log(pdfContent === expected)
// true

readPDFwithOcr

import { document, filesystem } from '@oliveai/ldk';

const pdfFile = await filesystem.readFile('./test.pdf');
const pdfContent = await document.readPDFwithOcr(pdfFile);
const expected = {
    // "1" is the page number
    "1": {
        "Content": [
            {"Value": "Test text", "Type": "text"},
            {"Value": "", "Type": "newLine"},
            {"Value": "More text on the next line", "Type": "text"},
            {"Value": "base64 string", "Type": "photo"},
            {"value": "Text from image", "Type": "photoText"},
        ]
    }
}

console.log(pdfContent === expected)
//true

xlsxEncode

xlsxEncode provides ability to encode a workbook object into XLSX data. It returns A promise of Uint8Array.

import { document } from '@oliveai/ldk';

// Imagine that we have a workbook, that workbook contains a worksheet. 
// To locate a single cell, we need the row numbner and cell number.
// We need a workbook object
const workbook = {
    worksheets: [
        {
            hidden: false,
            hiddenColumns: [],
            hiddenRows: [],
            name: 'name',
            rows: [{ cells: [{ value: 'cell value' }] }],
        },
    ],
 };
const uint8ArrayData = await document.xlsxEncode(workbook);

xlsxDecode

xlsxDecode Decodes uint8Array into a Workbook Object. It returns a promise of Workbook.

import { document } from '@oliveai/ldk';

// Decode Uint8Array to a Workbook Object.
// The uint8ArrayData is the same as the one we get from xlsxEncode method.
const workbook = document.xlsxDecode(uint8ArrayData);

This is the structure of a workbook:

Workbook: {

worksheets: Worksheet[];

}

Worksheet: {

hidden: boolean;

// Representation of a basic workbook with a single sheet where some rows and columns are hidden

hiddenColumns: number[];

hiddenRows: number[];

name: string;

rows: Row[];

}

Row: {

cells:cell[];

}

Cell: {

value:string;

}

Imagine that you want to read a patient's workbook programmatically. A good way to achieve this is to convert a workbook into xlsx data, which is an Uint8Array if using xlsxEncode(). In this example we created a Workbook object for demonstration, but you can use any XLSX file (workbook file with .xlsx extension) to achieve this.

Let's look at an example to better illustrate the point.

import { document } from '@oliveai/ldk';
import { Workbook } from '@oliveai/ldk/dist/document/types';

// Create a workbook Object. 
const workbook: Workbook = {
    worksheets: [
        {
            hidden: false,
            hiddenColumns: [],
            hiddenRows: [],
            name: 'Iron Man',
            rows: [{ cells: [{ value: 'Age' }, {value: '48'}] }],
        },
    ],
};

// Use xlseEncode to convert workbook Object to Uint8Array 
 const uint8ArrayData =  document.xlsxEncode(JSON.stringify(workbook));
 
// Convert uint8Array data to workbook Object
 const convertedWorkbook =  document.xlsxDecode(uint8ArrayData);
 
 // Check cell Data of converted workbook
 const cellData = convertedWorkbook.worksheets[0].rows[0].cells[1].value;
 console.log('workbook is:', JSON.stringify(workbook));
 console.log('uint8ArrayData is: ', uint8ArrayData);

// The console log results are attached below
// workbook is: {"worksheets":[{"hidden":false,"hiddenColumns":[],"hiddenRows":[],"name":"Iron Man","rows":[{"cells":[{"value":"Age"},{"value":"48"}]}]}]}
// uint8ArrayData is: 80,75,3,4,20,0,8,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0,0,0,91,67,111,110,116,101,110,116,95,84,121,112,101,115,93,46,120,109,108,172,148,207,110,212,48,16,198,239,60,69,228,43,90,123,219,3,66,40,73,15,252,57,66,37,202,3,24,123,146,88,107,123,172,153,233,146,125,123,148,100,187,66,5,170,68,221,75,124,137,191,223,207,254,172,169,239,198,20,171,35,16,7,204,141,186,209,123,85,65,118,232,67,238,27,245,227,225,203,238,189,170,88,108,246,54,98,134,70,157,128,213,93,251,166,126,56,21,224,106,76,49,115,163,6,145,242,193,24,118,3,36,203,26,11,228,49,197,14,41,89,97,141,212,155,98,221,193,246,96,110,247,251,119,198,97,22,200,178,147,41,67,181,245,183,35,16,5,15,213,189,37,249,106,19,52,202,140,209,200,0,9,150,239,141,30,83,84,213,199,101,227,196,110,148,45,37,6,103,37,96,54,199,236,159,81,119,216,117,193,129,71,247,152,32,139,158,99,222,78,41,109,109,158,128,255,69,179,156,34,240,171,161,92,8,172,231,1,64,82,212,75,232,106,135,95,72,135,159,136,135,107,91,76,171,78,54,228,117,38,30,221,61,97,97,99,75,121,181,10,140,2,217,131,223,21,194,2,36,97,237,125,92,44,28,18,108,215,56,63,63,61,237,222,204,62,119,49,95,28,155,121,185,221,174,240,98,41,151,252,213,70,60,88,2,255,93,40,228,254,234,15,245,207,236,191,141,62,65,103,31,163,84,159,167,50,151,185,65,16,121,155,192,83,35,4,113,254,135,135,80,46,172,51,225,159,168,151,143,250,60,192,204,115,170,253,29,0,0,255,255,80,75,7,8,232,197,0,177,95,1,0,0,231,4,0,0,80,75,3,4,20,0,8,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0,0,0,120,108,47,116,104,101,109,101,47,116,104,101,109,101,49,46,120,109,108,236,153,207,111,219,54,20,199,239,251,43,8,222,87,201,63,100,199,65,149,34,177,227,118,107,210,22,141,219,161,199,103,137,150,88,83,164,64,210,73,124,27,218,211,46,3,6,116,195,46,3,118,219,97,24,86,96,5,86,236,178,63,38,64,139,173,251,35,6,73,142,77,218,116,155,46,238,208,13,181,15,17,169,207,123,252,242,61,242,81,114,174,94,59,205,24,58,38,82,81,193,67,92,187,226,99,68,120,36,98,202,147,16,223,27,244,63,222,194,72,105,224,49,48,193,73,136,167,68,225,107,59,31,93,133,109,157,146,140,160,211,140,113,181,13,33,78,181,206,183,61,79,69,41,201,64,93,17,57,225,167,25,27,9,153,129,86,87,132,76,188,88,194,9,229,73,198,188,186,239,183,188,12,40,199,136,67,70,66,124,123,52,162,17,65,131,194,37,222,57,119,190,207,72,70,184,86,69,71,196,228,81,84,142,104,90,148,108,60,174,21,127,212,84,117,153,68,199,192,66,124,66,121,44,78,6,228,84,99,196,64,233,46,147,33,246,203,15,246,118,174,122,115,35,166,215,216,26,118,253,242,51,179,155,25,196,227,122,105,39,147,225,220,176,217,12,154,173,221,185,255,122,229,127,149,219,111,239,183,246,91,115,127,37,0,81,68,248,76,139,201,6,123,157,189,94,48,99,13,168,186,116,248,238,181,123,141,154,197,27,254,27,43,252,110,80,124,45,190,177,224,155,43,124,191,223,93,196,208,128,170,203,192,17,147,118,189,219,180,248,96,193,183,86,248,182,191,219,107,182,45,190,132,82,70,249,120,133,246,131,86,163,123,62,219,57,50,18,236,134,19,239,4,205,126,187,62,195,23,148,103,172,174,202,158,235,117,107,45,131,135,66,246,5,215,101,114,65,83,142,244,52,39,35,136,72,136,187,192,232,80,82,116,64,147,84,99,148,3,23,138,132,216,175,251,125,191,225,215,203,111,179,188,42,35,2,219,4,12,235,170,43,82,43,93,133,30,164,34,73,115,29,226,79,115,224,216,64,94,60,127,126,246,232,217,217,163,95,207,30,63,62,123,244,243,108,236,85,187,27,192,19,211,238,213,15,95,253,245,221,231,232,207,95,190,127,245,228,107,55,175,76,254,229,79,95,188,252,237,247,215,185,215,150,172,111,158,190,124,246,244,197,183,95,254,241,227,19,7,190,43,97,104,226,3,154,17,133,110,145,19,116,87,100,192,93,3,144,161,124,59,139,65,10,212,178,128,84,100,224,0,247,117,106,129,183,166,192,92,220,30,177,67,120,95,82,30,187,192,235,147,135,150,214,163,84,78,52,117,128,55,211,204,2,15,133,96,123,66,58,167,115,179,24,203,156,206,132,39,238,193,229,196,228,238,2,28,187,198,238,46,37,120,127,146,167,36,163,46,151,221,148,88,50,239,48,224,26,18,194,137,70,197,61,49,38,196,97,246,128,82,43,174,135,52,146,66,137,145,70,15,40,218,3,234,12,201,128,14,181,219,232,6,205,128,193,212,37,112,144,130,21,155,195,251,104,79,48,151,251,30,57,182,73,224,9,48,151,75,194,172,48,94,135,137,134,204,169,24,50,102,146,7,160,83,151,200,163,169,140,172,128,43,45,129,39,132,9,180,31,19,165,92,54,183,229,212,146,123,19,24,117,167,253,144,77,51,155,148,154,142,93,228,1,8,97,146,61,49,238,166,144,229,78,205,148,167,38,251,137,26,11,193,0,221,17,218,41,66,216,59,164,104,11,70,129,175,77,247,125,74,244,219,109,235,123,52,73,221,11,164,184,51,145,174,45,65,132,189,31,167,108,4,164,116,238,45,149,244,140,242,55,214,247,165,202,30,252,59,149,221,93,116,55,80,211,221,224,101,170,249,174,164,206,61,181,92,195,215,113,255,193,202,221,131,9,191,67,120,234,66,63,20,238,15,133,251,127,95,184,215,237,229,205,151,235,69,133,246,42,67,227,201,61,91,251,224,62,162,140,29,233,41,35,7,170,172,237,74,48,26,247,41,99,101,163,52,154,191,39,228,105,151,201,217,112,22,151,72,40,175,145,20,250,51,170,211,163,20,114,18,226,90,57,66,162,102,174,19,133,114,161,66,236,227,181,190,139,27,108,146,29,138,184,234,173,213,206,95,77,97,91,129,94,244,251,193,188,95,83,174,171,222,86,123,241,14,54,119,95,182,18,101,10,8,74,167,23,23,97,12,102,139,104,56,68,180,27,23,19,81,243,55,165,162,227,80,177,85,123,157,10,207,200,10,163,28,1,79,66,28,52,43,69,72,69,192,72,92,228,169,178,63,207,238,198,51,189,46,152,246,180,235,142,233,117,154,23,11,242,5,50,109,137,48,150,155,45,194,88,134,41,196,100,185,123,195,185,238,116,220,169,174,59,101,180,183,222,69,174,189,213,218,192,184,221,66,39,33,110,53,2,31,163,8,242,16,143,24,104,140,162,44,143,67,172,138,186,9,44,225,33,142,244,44,208,255,164,178,228,82,233,30,168,180,194,202,91,213,252,51,170,137,68,140,102,33,222,50,211,192,248,66,91,173,222,246,223,95,113,29,255,253,139,156,183,156,100,50,26,145,72,175,233,89,52,15,148,174,156,56,239,94,18,46,26,98,162,137,60,74,227,19,52,100,19,121,23,226,16,7,237,90,17,192,152,42,61,143,102,76,165,177,184,23,81,92,42,87,179,173,104,253,100,182,216,162,192,242,20,102,39,138,89,204,43,188,188,158,203,49,230,81,42,93,158,149,231,10,225,48,233,111,226,212,125,179,209,142,93,52,215,28,32,237,181,85,236,221,29,242,134,170,134,91,85,224,172,117,157,173,55,156,18,151,63,16,12,105,91,110,105,13,183,180,117,103,199,6,31,8,140,225,90,107,226,86,127,237,153,116,137,211,96,121,213,122,198,115,101,217,90,249,223,132,24,62,36,145,238,145,17,76,152,86,165,84,114,170,37,116,207,127,85,158,87,130,210,116,231,239,0,0,0,255,255,80,75,7,8,55,48,252,24,76,5,0,0,117,25,0,0,80,75,3,4,20,0,8,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,0,0,0,120,108,47,119,111,114,107,115,104,101,101,116,115,47,115,104,101,101,116,49,46,120,109,108,140,144,205,106,235,48,16,133,247,247,41,196,236,111,228,20,90,74,176,28,10,33,180,187,210,191,189,98,141,99,17,73,99,52,147,218,125,251,98,39,54,89,118,119,208,232,251,152,51,229,118,136,65,125,99,102,79,201,192,122,85,128,194,84,147,243,233,104,224,243,99,255,255,17,20,139,77,206,6,74,104,224,7,25,182,213,191,178,167,124,226,22,81,212,16,67,98,3,173,72,183,209,154,235,22,163,229,21,117,152,134,24,26,202,209,10,175,40,31,53,119,25,173,155,160,24,244,93,81,60,232,104,125,130,139,97,147,255,226,160,166,241,53,238,168,62,71,76,114,145,100,12,86,60,37,110,125,199,80,149,206,71,76,99,31,149,177,49,240,180,134,170,212,203,99,85,78,27,124,121,236,249,38,43,177,135,119,12,88,11,58,3,146,207,8,106,236,120,32,58,141,243,23,103,160,24,69,11,113,155,103,211,126,90,245,53,43,135,141,61,7,121,163,254,25,253,177,21,3,235,251,133,158,127,93,161,157,21,59,143,174,121,185,110,245,27,0,0,255,255,80,75,7,8,31,2,97,73,250,0,0,0,161,1,0,0,80,75,3,4,20,0,8,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,15,0,0,0,120,108,47,119,111,114,107,98,111,111,107,46,120,109,108,140,145,65,111,219,48,12,133,239,251,21,2,239,141,37,35,13,130,192,114,129,97,27,150,195,134,28,186,246,172,72,116,44,68,18,13,73,110,146,127,63,200,169,151,12,189,244,244,236,71,250,35,249,220,60,157,189,99,111,24,147,165,32,65,44,56,48,12,154,140,13,7,9,127,158,127,60,172,129,165,172,130,81,142,2,74,184,96,130,167,246,75,115,162,120,220,19,29,217,217,187,144,36,244,57,15,155,170,74,186,71,175,210,130,6,12,103,239,58,138,94,229,180,160,120,168,210,16,81,153,212,35,102,239,170,154,243,85,229,149,13,112,37,108,226,103,24,212,117,86,227,55,210,163,199,144,175,144,136,78,101,75,33,245,118,72,51,205,235,207,224,188,138,199,113,120,208,228,7,149,237,222,58,155,47,19,20,152,215,155,237,33,80,84,123,135,18,206,226,113,38,159,197,227,7,180,183,58,82,162,46,47,52,249,247,37,63,220,43,120,37,196,245,228,182,233,172,195,151,107,234,76,13,195,111,229,203,20,7,204,169,148,191,27,155,209,72,88,1,115,116,194,255,140,56,14,95,71,235,140,4,177,92,214,28,218,166,186,99,181,255,254,203,46,50,131,157,26,93,126,238,209,207,117,9,98,181,228,66,0,235,172,203,24,119,209,190,41,125,145,144,227,136,133,117,251,188,109,138,190,88,60,165,27,181,188,178,147,13,134,78,63,209,30,250,44,97,205,5,135,119,239,213,154,220,151,205,214,188,228,245,58,153,18,56,176,203,237,249,110,74,193,181,77,117,55,104,138,107,86,22,166,88,182,145,2,251,165,2,176,201,221,26,9,53,176,184,177,70,66,220,154,101,33,78,149,89,83,219,104,229,244,46,178,34,165,95,212,117,45,68,105,188,22,238,118,104,255,6,0,0,255,255,80,75,7,8,42,141,81,104,157,1,0,0,3,3,0,0,80,75,3,4,20,0,8,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,95,114,101,108,115,47,46,114,101,108,115,148,208,193,74,196,48,16,6,224,187,79,17,230,190,205,238,10,34,178,233,94,68,216,155,72,125,128,49,153,182,161,73,38,36,81,179,111,47,122,113,139,21,237,113,96,248,255,143,255,112,172,222,137,55,74,217,114,80,176,107,182,32,40,104,54,54,12,10,158,187,135,205,45,136,92,48,24,116,28,72,193,153,50,28,219,171,195,19,57,44,150,67,30,109,204,162,122,23,178,130,177,148,120,39,101,214,35,121,204,13,71,10,213,187,158,147,199,146,27,78,131,140,168,39,28,72,238,183,219,27,153,46,51,160,157,101,138,147,81,144,78,230,26,68,135,105,160,162,192,176,126,76,28,179,196,24,155,234,29,136,238,28,233,63,173,220,247,86,211,61,235,87,79,161,44,148,75,170,133,130,33,179,137,137,35,165,98,233,19,36,47,69,203,190,253,130,79,115,162,117,192,223,103,145,158,10,26,44,248,149,186,154,183,251,230,85,39,223,57,77,47,204,211,58,220,223,235,205,63,126,202,102,103,110,63,2,0,0,255,255,80,75,7,8,179,71,177,30,240,0,0,0,117,2,0,0,80,75,3,4,20,0,8,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,0,100,111,99,80,114,111,112,115,47,97,112,112,46,120,109,108,156,207,207,74,52,49,16,4,240,251,247,20,161,239,59,153,207,131,200,146,201,34,248,231,234,97,244,30,146,158,221,64,210,29,210,237,146,245,233,69,4,215,179,199,162,224,71,149,59,140,90,204,25,187,100,166,5,254,79,51,24,164,200,41,211,113,129,215,245,105,119,7,70,52,80,10,133,9,23,184,160,192,193,255,115,47,157,27,118,205,40,102,212,66,178,192,73,181,237,173,149,120,194,26,100,226,134,52,106,217,184,215,160,50,113,63,90,222,182,28,241,129,227,123,69,82,123,51,207,183,22,135,34,37,76,187,246,3,194,183,184,63,235,95,209,196,241,107,159,188,173,151,134,2,222,173,172,161,172,185,162,159,157,189,6,119,223,90,201,49,104,102,242,207,108,30,71,196,146,63,208,217,223,133,179,215,179,254,51,0,0,255,255,80,75,7,8,243,65,153,196,193,0,0,0,49,1,0,0,80,75,3,4,20,0,8,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,0,0,0,100,111,99,80,114,111,112,115,47,99,111,114,101,46,120,109,108,164,145,79,107,243,48,12,135,239,239,167,8,190,39,114,90,40,239,66,146,30,54,122,218,96,176,142,141,221,140,173,182,102,241,31,44,119,113,191,253,72,218,166,29,235,109,224,147,126,143,30,100,169,94,38,211,101,95,24,72,59,219,176,178,224,44,67,43,157,210,118,219,176,215,245,42,255,207,50,138,194,42,209,57,139,13,59,32,177,101,251,175,150,190,146,46,224,115,112,30,67,212,72,89,50,157,165,74,250,134,237,98,244,21,0,201,29,26,65,133,243,104,147,233,54,46,24,17,169,112,97,11,94,200,79,177,69,152,113,190,0,131,81,40,17,5,12,194,220,79,70,118,82,42,57,41,253,62,116,163,64,73,192,14,13,218,72,80,22,37,92,216,136,193,208,205,134,49,185,34,141,142,7,143,55,209,115,56,209,137,244,4,246,125,95,244,243,17,157,113,94,194,251,211,227,203,248,213,92,219,97,85,18,89,91,43,89,201,128,34,186,208,166,125,208,53,92,21,234,211,148,199,2,170,44,145,174,142,179,156,147,183,249,253,195,122,197,218,97,65,57,191,203,203,197,154,243,106,124,31,131,235,71,255,69,104,156,210,27,253,7,227,89,208,214,240,235,194,237,119,0,0,0,255,255,80,75,7,8,150,226,5,53,29,1,0,0,45,2,0,0,80,75,3,4,20,0,8,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,26,0,0,0,120,108,47,95,114,101,108,115,47,119,111,114,107,98,111,111,107,46,120,109,108,46,114,101,108,115,172,209,203,106,132,48,20,198,241,125,159,34,156,125,141,99,47,148,98,156,77,41,204,182,181,15,16,244,104,194,228,34,57,167,173,190,125,193,66,71,233,44,92,184,73,200,230,255,253,32,229,113,244,78,124,97,34,27,131,130,67,150,131,192,208,196,214,134,94,193,71,253,122,251,4,130,88,135,86,187,24,80,193,132,4,199,234,166,124,67,167,217,198,64,198,14,36,70,239,2,41,48,204,195,179,148,212,24,244,154,178,56,96,24,189,235,98,242,154,41,139,169,151,131,110,206,186,71,89,228,249,163,76,203,6,84,171,166,56,181,10,210,169,45,64,212,58,245,200,10,136,39,135,148,141,222,129,168,167,1,183,236,197,174,179,13,190,196,230,211,99,224,43,179,242,183,10,85,41,151,243,215,49,119,23,12,27,244,40,231,243,176,55,105,174,110,19,221,95,68,114,116,242,59,166,51,25,68,38,57,95,197,222,180,191,129,109,188,135,53,143,140,78,216,190,115,178,161,223,255,35,151,241,255,188,213,147,170,159,0,0,0,255,255,80,75,7,8,130,11,55,245,244,0,0,0,249,2,0,0,80,75,3,4,20,0,8,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,0,0,0,120,108,47,119,111,114,107,115,104,101,101,116,115,47,115,104,101,101,116,50,46,120,109,108,76,144,77,75,196,48,16,134,239,254,138,48,119,55,173,7,17,73,178,172,136,224,217,143,123,182,153,221,150,77,50,37,51,182,245,223,75,86,45,189,189,204,195,251,193,152,253,146,162,154,176,240,64,217,66,187,107,64,97,238,40,12,249,108,225,227,253,229,246,1,20,139,207,193,71,202,104,225,27,25,246,238,198,204,84,46,220,35,138,90,82,204,108,161,23,25,31,181,230,174,199,228,121,71,35,230,37,197,19,149,228,133,119,84,206,154,199,130,62,92,77,41,234,187,166,185,215,201,15,25,156,9,67,194,92,23,168,130,39,11,135,22,156,209,235,209,153,171,231,115,192,153,55,90,137,63,190,97,196,78,48,88,144,242,133,160,234,170,35,209,165,242,215,96,161,169,65,171,99,171,255,147,158,189,120,103,10,205,170,88,168,189,93,21,135,22,148,88,96,112,102,114,141,209,147,51,186,251,99,79,91,214,174,76,23,90,11,126,67,245,250,35,247,19,0,0,255,255,80,75,7,8,249,167,34,97,228,0,0,0,103,1,0,0,80,75,3,4,20,0,8,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,0,0,0,120,108,47,115,104,97,114,101,100,83,116,114,105,110,103,115,46,120,109,108,68,200,81,106,195,48,12,0,208,255,157,194,232,127,81,22,198,8,195,118,24,131,158,160,61,128,73,212,196,96,203,169,165,148,244,246,165,148,210,207,247,236,176,231,100,174,84,37,22,118,240,213,180,96,136,199,50,69,158,29,156,142,135,207,30,140,104,224,41,164,194,228,224,70,2,131,255,176,34,106,246,156,88,28,44,170,235,47,162,140,11,229,32,77,89,137,247,156,206,165,230,160,210,148,58,163,172,149,194,36,11,145,230,132,93,219,254,96,14,145,193,140,101,99,117,208,129,217,56,94,54,250,127,217,91,137,222,170,255,155,201,162,122,139,15,62,235,187,127,15,138,168,191,7,0,0,255,255,80,75,7,8,159,99,127,136,158,0,0,0,196,0,0,0,80,75,3,4,20,0,8,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,0,0,0,120,108,47,115,116,121,108,101,115,46,120,109,108,164,152,95,143,219,42,22,192,223,247,83,32,191,207,216,164,73,38,19,217,174,86,173,42,85,234,174,70,106,87,234,43,193,56,65,195,31,11,112,150,244,234,126,247,43,112,140,157,56,51,165,78,164,216,228,152,243,3,14,231,143,73,254,209,114,6,142,68,105,42,69,145,192,199,44,1,68,96,89,81,177,47,146,255,253,248,242,176,73,128,54,72,84,136,73,65,138,228,68,116,242,177,252,87,174,205,137,145,239,7,66,12,0,150,51,161,139,228,96,76,179,77,83,141,15,132,35,253,40,27,34,44,103,181,84,28,25,253,40,213,62,213,141,34,168,210,78,139,179,116,145,101,235,148,35,42,146,142,176,69,77,12,68,214,53,197,228,179,196,45,39,194,116,20,98,13,17,21,169,30,26,37,27,162,12,37,186,135,202,217,80,220,106,35,249,13,36,138,33,86,10,253,159,138,253,173,117,226,25,250,248,128,148,9,128,74,205,69,124,238,100,129,36,121,148,125,174,81,146,55,200,208,29,101,212,156,122,86,181,231,51,80,21,69,123,133,120,15,97,115,140,195,36,126,37,213,39,36,142,40,108,82,67,231,144,26,138,77,171,72,15,177,179,12,61,114,243,43,115,71,209,110,249,162,34,12,25,42,133,62,208,38,44,177,138,10,186,183,93,251,39,103,61,42,106,231,110,145,56,50,135,96,173,24,200,111,114,128,102,81,16,255,232,27,221,41,164,78,83,8,143,218,122,142,212,107,219,60,92,248,178,103,133,245,184,132,119,197,225,20,43,169,101,109,30,177,228,103,139,164,196,98,114,99,45,92,203,56,125,175,153,193,243,182,180,52,36,154,169,69,223,214,71,216,208,35,249,25,34,187,105,166,222,246,182,54,150,71,162,94,208,158,188,40,57,120,24,174,232,52,61,188,3,241,243,239,29,228,171,232,172,77,165,120,65,130,4,95,195,230,15,144,156,24,84,33,131,82,44,133,33,194,252,56,53,33,58,133,185,81,118,98,80,157,247,235,176,81,236,79,22,25,48,76,138,253,203,164,56,240,105,117,136,96,13,69,198,203,254,109,140,162,187,214,140,176,154,138,215,223,144,169,120,77,23,25,204,46,139,13,92,198,77,232,156,196,220,196,158,210,77,186,152,148,156,63,7,193,236,102,209,65,179,72,227,69,53,116,198,178,96,54,73,239,177,144,73,210,122,78,159,47,38,100,227,205,211,39,11,152,189,83,40,44,92,162,105,18,139,159,27,194,67,145,136,116,238,209,254,111,174,171,50,215,50,118,121,126,2,217,211,36,151,85,123,30,139,184,216,178,171,153,88,184,138,131,92,155,5,102,41,132,151,123,6,23,115,109,12,97,10,71,54,182,112,53,155,228,167,53,66,69,38,237,9,103,153,42,114,164,238,53,126,64,45,102,178,86,129,181,24,96,31,102,194,214,1,246,97,128,69,122,194,59,176,229,0,155,235,17,3,108,53,192,214,119,195,134,247,7,245,116,55,236,105,128,109,238,134,109,6,216,243,221,176,231,1,6,179,187,105,48,27,225,224,253,56,56,194,205,13,131,17,110,20,7,240,254,64,128,163,72,136,77,138,239,225,70,177,48,59,61,142,112,67,52,192,185,209,176,156,38,219,245,29,233,40,91,156,97,28,111,191,238,133,84,104,199,72,145,96,184,4,254,197,4,32,184,4,254,165,0,88,247,245,50,95,67,65,165,27,224,203,23,240,21,8,88,184,2,62,243,3,159,181,129,85,192,170,5,176,234,3,176,106,9,172,90,1,171,214,192,170,39,96,213,6,88,245,12,156,131,187,11,116,23,215,21,186,190,142,165,60,204,125,215,192,175,16,112,9,184,5,252,8,36,56,134,234,25,121,12,224,8,143,170,232,230,242,44,17,121,20,112,140,112,28,185,66,28,139,164,85,98,123,214,127,8,250,238,8,180,229,8,111,143,195,129,80,190,215,183,27,235,124,235,53,222,165,119,100,181,109,105,85,36,127,101,231,207,67,150,101,240,161,111,117,151,254,243,119,82,230,181,20,70,3,44,91,97,138,4,158,5,101,174,127,129,35,98,69,2,157,40,213,191,202,28,75,38,21,48,7,194,73,215,49,245,146,50,23,136,147,174,243,39,196,232,78,81,247,204,9,203,188,70,156,178,83,247,112,225,196,157,192,53,252,40,254,166,203,188,166,140,133,73,184,142,78,80,230,13,50,134,40,241,133,50,6,206,109,119,54,41,18,33,5,113,184,81,7,7,243,183,223,168,238,21,58,193,197,234,45,109,127,211,101,190,147,170,34,234,194,48,157,168,204,25,169,221,212,187,155,162,251,131,251,117,190,27,217,148,121,234,175,59,105,140,228,101,158,246,13,247,150,37,5,114,131,140,154,61,245,220,208,101,142,9,99,223,205,137,145,159,245,197,248,182,6,162,229,95,184,249,90,21,73,150,0,103,187,190,73,25,59,55,59,76,247,163,204,83,91,187,141,26,17,59,254,221,104,96,235,233,24,1,239,7,187,24,33,72,129,243,140,34,249,175,59,182,178,1,3,118,45,101,134,138,0,13,10,227,182,46,243,202,14,83,247,29,157,160,204,141,203,86,151,195,102,9,168,72,141,90,102,94,232,81,26,255,176,72,134,246,55,183,101,112,29,122,253,8,136,34,25,218,255,33,21,109,185,119,222,209,24,46,38,194,191,179,229,63,1,0,0,255,255,80,75,7,8,163,250,220,212,193,4,0,0,226,21,0,0,80,75,1,2,20,0,20,0,8,0,8,0,0,0,0,0,232,197,0,177,95,1,0,0,231,4,0,0,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,91,67,111,110,116,101,110,116,95,84,121,112,101,115,93,46,120,109,108,80,75,1,2,20,0,20,0,8,0,8,0,0,0,0,0,55,48,252,24,76,5,0,0,117,25,0,0,19,0,0,0,0,0,0,0,0,0,0,0,0,0,160,1,0,0,120,108,47,116,104,101,109,101,47,116,104,101,109,101,49,46,120,109,108,80,75,1,2,20,0,20,0,8,0,8,0,0,0,0,0,31,2,97,73,250,0,0,0,161,1,0,0,24,0,0,0,0,0,0,0,0,0,0,0,0,0,45,7,0,0,120,108,47,119,111,114,107,115,104,101,101,116,115,47,115,104,101,101,116,49,46,120,109,108,80,75,1,2,20,0,20,0,8,0,8,0,0,0,0,0,42,141,81,104,157,1,0,0,3,3,0,0,15,0,0,0,0,0,0,0,0,0,0,0,0,0,109,8,0,0,120,108,47,119,111,114,107,98,111,111,107,46,120,109,108,80,75,1,2,20,0,20,0,8,0,8,0,0,0,0,0,179,71,177,30,240,0,0,0,117,2,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,71,10,0,0,95,114,101,108,115,47,46,114,101,108,115,80,75,1,2,20,0,20,0,8,0,8,0,0,0,0,0,243,65,153,196,193,0,0,0,49,1,0,0,16,0,0,0,0,0,0,0,0,0,0,0,0,0,112,11,0,0,100,111,99,80,114,111,112,115,47,97,112,112,46,120,109,108,80,75,1,2,20,0,20,0,8,0,8,0,0,0,0,0,150,226,5,53,29,1,0,0,45,2,0,0,17,0,0,0,0,0,0,0,0,0,0,0,0,0,111,12,0,0,100,111,99,80,114,111,112,115,47,99,111,114,101,46,120,109,108,80,75,1,2,20,0,20,0,8,0,8,0,0,0,0,0,130,11,55,245,244,0,0,0,249,2,0,0,26,0,0,0,0,0,0,0,0,0,0,0,0,0,203,13,0,0,120,108,47,95,114,101,108,115,47,119,111,114,107,98,111,111,107,46,120,109,108,46,114,101,108,115,80,75,1,2,20,0,20,0,8,0,8,0,0,0,0,0,249,167,34,97,228,0,0,0,103,1,0,0,24,0,0,0,0,0,0,0,0,0,0,0,0,0,7,15,0,0,120,108,47,119,111,114,107,115,104,101,101,116,115,47,115,104,101,101,116,50,46,120,109,108,80,75,1,2,20,0,20,0,8,0,8,0,0,0,0,0,159,99,127,136,158,0,0,0,196,0,0,0,20,0,0,0,0,0,0,0,0,0,0,0,0,0,49,16,0,0,120,108,47,115,104,97,114,101,100,83,116,114,105,110,103,115,46,120,109,108,80,75,1,2,20,0,20,0,8,0,8,0,0,0,0,0,163,250,220,212,193,4,0,0,226,21,0,0,13,0,0,0,0,0,0,0,0,0,0,0,0,0,17,17,0,0,120,108,47,115,116,121,108,101,115,46,120,109,108,80,75,5,6,0,0,0,0,11,0,11,0,198,2,0,0,13,22,0,0,0,0

In this example, we created a Workbook Object and use xlsxEncode to encode our workbook to Uint8Array. Since Uint8Array represents an array of 8-bit unsigned integer, which means it's not that easy for people to identify its content and value. You may need to convert it to string so it's gonna be readable. But right now we'll skip this part and leave it to you to decide whether you want to convert the Uint8Array data to something else. So we converted the Uint8Array back to a workbook to check if we can still get the same value.

To use the Document Aptitude, simply set the following permissions in your package.json under the ldk object.

...
"ldk": {
  "permissions": {
    "document": {},
    ...
  }
},
...

readPDFwithOcr is an enhanced function for readPDF , it provides the ability to input a PDF as a Uint8Array (either from the or Aptitudes) and parse the text content inside it including ocr any images with text. NOTE: this function will need to have screen permission, check permission tab in Aptitude.

Please see our page for more information.

Filesystem
Network
Filesystem
Network
Screen
Permissions