mirror of
https://github.com/john-okeefe/foliate-js.git
synced 2026-09-09 11:29:14 -04:00
@@ -105,9 +105,14 @@ const makeTOCItem = item => ({
|
||||
})
|
||||
|
||||
export const makePDF = async file => {
|
||||
const data = new Uint8Array(await file.arrayBuffer())
|
||||
const transport = new pdfjsLib.PDFDataRangeTransport(file.size, [])
|
||||
transport.requestDataRange = (begin, end) => {
|
||||
file.slice(begin, end).arrayBuffer().then(chunk => {
|
||||
transport.onDataRange(begin, chunk)
|
||||
})
|
||||
}
|
||||
const pdf = await pdfjsLib.getDocument({
|
||||
data,
|
||||
range: transport,
|
||||
cMapUrl: pdfjsPath('cmaps/'),
|
||||
standardFontDataUrl: pdfjsPath('standard_fonts/'),
|
||||
isEvalSupported: false,
|
||||
|
||||
Reference in New Issue
Block a user