@@ -9,7 +9,7 @@ if (pdfjsLib != null) {
99}
1010
1111export async function init ( id , invoke , options ) {
12- await addLink ( './_content/BootstrapBlazor.PdfReader/css/pdf_viewer .css' ) ;
12+ await addLink ( './_content/BootstrapBlazor.PdfReader/css/pdf_reader .css' ) ;
1313
1414 const el = document . getElementById ( id ) ;
1515 if ( el === null ) {
@@ -109,8 +109,6 @@ const loadPdf = async (el, invoke, options) => {
109109}
110110
111111const loadMetadata = ( el , pdfViewer , metadata ) => {
112- console . log ( metadata ) ;
113-
114112 const filename = el . querySelector ( '.bb-view-pdf-dialog-filename' ) ;
115113 const docTitle = el . querySelector ( '.bb-view-subject' ) ;
116114 filename . textContent = docTitle . textContent ;
@@ -371,6 +369,9 @@ const addEventBus = (el, pdfViewer, eventBus, invoke, options) => {
371369
372370const addToolbarEventHandlers = ( el , pdfViewer , invoke , options ) => {
373371 const toolbar = el . querySelector ( ".bb-view-toolbar" ) ;
372+ [ ...el . querySelectorAll ( '.invisible' ) ] . forEach ( i => {
373+ i . classList . remove ( 'invisible' ) ;
374+ } ) ;
374375
375376 EventHandler . on ( toolbar , "click" , '.bb-view-bar' , e => {
376377 const thumbnailsEl = el . querySelector ( ".bb-view-thumbnails" ) ;
@@ -436,6 +437,17 @@ const addToolbarEventHandlers = (el, pdfViewer, invoke, options) => {
436437 pdfViewer . spreadMode = 0 ;
437438 }
438439 } ) ;
440+ EventHandler . on ( toolbar , "click" , ".bb-view-download" , e => {
441+ if ( options . url ) {
442+ const docTitle = el . querySelector ( '.bb-view-subject' ) ;
443+ const anchorElement = document . createElement ( 'a' ) ;
444+ anchorElement . href = options . url ;
445+ anchorElement . download = docTitle . textContent ;
446+ anchorElement . click ( ) ;
447+ anchorElement . remove ( ) ;
448+ }
449+ } ) ;
450+
439451 EventHandler . on ( toolbar , "click" , ".dropdown-item-presentation" , async e => {
440452 e . delegateTarget . classList . toggle ( "active" ) ;
441453
0 commit comments