@blocklet/pdf is a package that integrates the react/pdf service to provide universal pdf capability for blocklets. For more information about react/pdf, refer to the official documentation.
The package is composed of both frontend and backend components. The frontend code resides in the index.js
file
# You can use npm / yarn
pnpm add @blocklet/pdf
To install the required dependencies, run the following command:
pnpm i
To build the packages, execute the following command:
pnpm build
For building, watching changes, and running the development server, use the following command:
pnpm run dev
import { lazy } from 'react';
const PdfComponent = React.lazy(() =>
// @ts-ignore
import('@blocklet/pdf').then((module) => {
return {
default: module.PdfComponent,
};
})
);
---
<Box>
<PdfComponent url={pdfUrl} maxHeight="60vh" />
</Box>;
This package is licensed under the MIT license.