-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat : pdfWorker for PDF conversion (#96)
Feat : pdfWorker for PDF conversion
- Loading branch information
Showing
7 changed files
with
130 additions
and
93 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 9 additions & 4 deletions
13
src/components/course/drawer/courseMaterial/CourseMaterialLoading.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { pdf } from '@react-pdf/renderer'; | ||
import { createElement } from 'react'; | ||
import MaterialPDFDocument from '../../components/classroom/pdf/MaterialPDFDocument'; | ||
import { expose } from 'comlink'; | ||
|
||
const generatePDF = async (materials: CourseMaterialWorkbook) => { | ||
const blob = await pdf( | ||
createElement(MaterialPDFDocument as any, { materials }) as any | ||
).toBlob(); | ||
return URL.createObjectURL(blob); | ||
}; | ||
|
||
expose(generatePDF); | ||
|
||
export type GeneratePDF = (material: CourseMaterialWorkbook) => Promise<string>; |