Skip to content

Instantly share code, notes, and snippets.

@dontpaniclabsgists
Created July 10, 2025 19:57
Show Gist options
  • Save dontpaniclabsgists/3ff9c07491387dea5bbb436d19eb8149 to your computer and use it in GitHub Desktop.
Save dontpaniclabsgists/3ff9c07491387dea5bbb436d19eb8149 to your computer and use it in GitHub Desktop.
<button (click)="downloadAndDisplayPdf"> open your pdf </button>
private async downloadAndDisplayPdf(): void {
const win = window.open("", "_blank")
Manager.GetIllustrationDownload()
.then((response) => {
If (win) {
// these lines let us take a pdf file and get a blob url that we can use to navigate to it directly in browser
const pdfFile = new File([response.fileContent], response.fileName, { type: 'application/pdf', lastModified: Date.now() });
const objectURL = URL.createObjectURL(pdfFile);
win.location = objectURL; // Navigate after async completes
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment