Bloom Interactive

Bloom Interactive

← Back to home
Preview of PDF Print FilenameView on GitHub ↗

PDF Print Filename


Problem:

window.open(blobUrl) navigates the user away from the page. Solutions like print.js open the PDF in the same tab — better, but still not ideal (and unmaintained). When a user goes Print → Save as PDF, the browser pulls the default filename from document.title — not the PDF.

Solution:

  • printBlobUrl — hidden iframe triggers the print dialog without any navigation, 10s load timeout, cleanup in finally
  • guardPrintTitle — sets document.title and holds it via MutationObserver against framework resets, returns a cleanup fn to restore original title