Fixed issue with some PDFs not detecting SHC QR codes

* Doubling the pdfScale from 2 to 4 seems to make them big enough
  that the library can then find them
This commit is contained in:
Ryan Slobojan 2021-10-23 21:13:08 -04:00
parent 67a4a15007
commit 8ba81a8498
2 changed files with 2 additions and 5 deletions

View File

@ -36,9 +36,6 @@ function Page(props: PageProps): JSX.Element {
</footer>
</main>
</div>
<br/>
<br/>
<br/>
<canvas id="canvas" style={{display: 'none'}}/>
</div>
)

View File

@ -42,7 +42,7 @@ export async function getPayloadBodyFromFile(file: File): Promise<PayloadBody> {
async function getImageDataFromPdfPage(pdfPage: PDFPageProxy): Promise<ImageData> {
const pdfScale = 2;
const pdfScale = 4;
const canvas = <HTMLCanvasElement>document.getElementById('canvas');
const canvasContext = canvas.getContext('2d');
@ -61,7 +61,7 @@ async function getImageDataFromPdfPage(pdfPage: PDFPageProxy): Promise<ImageData
await renderTask.promise;
// Return PDF Image Data
return canvasContext.getImageData(0, 0, canvas.width, canvas.height);
return Promise.resolve(canvasContext.getImageData(0, 0, canvas.width, canvas.height));
}