Skip to content

Set variable to text undefined ? #21

@hieuluis96

Description

@hieuluis96

Hi, your library was be useful for my project that i had been working, but when i went to set text from variable, it displayed "undefined ". My code look like 👍

cretePDF
 = ({name}) => () => {
const fs = RNFetchBlob.fs;
const dirs = fs.dirs;
// Create page
const page1 = PDFPage.create()
.setMediaBox(Dimensions.get('window').width, Dimensions.get('window').height)
.drawRectangle({
x: 0,
y: Dimensions.get('window').height - 100,
width: Dimensions.get('window').width,
color: '#eaff0a',
height: 100,
})
.drawText(`${name}`, {
x: Dimensions.get('window').width / 2,
y: Dimensions.get('window').height - 16,
fontSize: 16
})
const path = `${dirs.DownloadDir}/SAMPLE.pdf`;
PDFDocument.create(path).addPage(page1).write().then((res) => {
console.log("File saved at: " + res);
})
}

Result:
image

Thank you for reply

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions