Generate blank PDFs in React Native
PSPDFKit for React Native enables you to generate a blank PDF document. You can provide configuration options and a name or a local path for the new PDF document.
To generate a blank PDF, use the Processor
class:
// Define your configuration. const configuration = { name:'newBlankPDF.pdf', width: 595, height: 842, override: true // Delete the existing file with the same name. }; const { fileURL } = await Processor.generateBlankPDF(configuration); // Do something with the new file by accessing it from a `fileURL` path.
In this example, you define the size of the PDF document with the width
and height
parameters, and the name of the PDF file with the name
parameter. The blank document is saved in the local Documents
folder. You then use the override
parameter to overwrite the file with the same name if it already exists in the Documents
folder.
To specify a different path, use the filePath
parameter. In this case, any value provided for the name
parameter is ignored.
See the list of configuration options you can use with Processor
.