Skip to content

Commit

Permalink
fix: fix opening pdf in new window (#216)
Browse files Browse the repository at this point in the history
Resolves #213
  • Loading branch information
EdieLemoine committed Feb 27, 2023
1 parent 6046813 commit f28a95f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions views/js/admin/src/services/openPdfInNewWindow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { usePdfWindow } from '@/composables/usePdfWindow';
* Creates a new window from given base64 encoded pdf string.
*/
export function openPdfInNewWindow(pdf: string): void {
const buffer = Buffer.from(pdf, 'base64');
const byteArray = new Uint8Array(buffer);
const byteArray = Uint8Array.from(atob(pdf), (element) => element.charCodeAt(0));

const file = new Blob([byteArray], { type: 'application/pdf;base64' });
const fileURL = URL.createObjectURL(file);

Expand Down

0 comments on commit f28a95f

Please sign in to comment.