-
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.
Vote-2725: Load PDF on App Load (#302)
* Update app.jsx with new loaded pdf * Create new file to load PDF * Generate PDF files updates with new loaded pdf function
- Loading branch information
Showing
4 changed files
with
33 additions
and
23 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { PDFDocument } from 'pdf-lib'; | ||
|
||
const loadPdf = async () => { | ||
const lang = document.documentElement.lang; | ||
const locale = lang!== "en"? `/${lang}` : ""; | ||
const formUrl = `/data${locale}/Federal_Voter_Registration_${lang}.pdf`; | ||
const formPdfBytes = await fetch(formUrl).then(res => res.arrayBuffer()) | ||
const pdfDoc = await PDFDocument.load(formPdfBytes) | ||
const form = pdfDoc.getForm() | ||
return { pdfDoc, form }; | ||
}; | ||
|
||
export default loadPdf; |