Skip to content

Commit

Permalink
Fix coolwanglu#769 Open at 100% width
Browse files Browse the repository at this point in the history
  • Loading branch information
yoooooooooooooooooooooooo authored May 30, 2018
1 parent f12fc15 commit 2bea4ec
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion share/pdf2htmlEX.js.in
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ var DEFAULT_CONFIG = {
'hashchange_handler' : true,
// register view history handler, allowing going back to the previous location
'view_history_handler' : true,
// Fit page width on start
'fit_width': true,

'__dummy__' : 'no comma'
};
Expand Down Expand Up @@ -335,6 +337,10 @@ Viewer.prototype = {

this.initialize_radio_button();
this.render();

// Fit page to container
if (this.config['fit_width'])
this.fit_width();
},

/*
Expand Down Expand Up @@ -766,9 +772,11 @@ Viewer.prototype = {
this.schedule_render(true);
},

// Rescale pages to fit container width.
fit_width : function () {
var page_idx = this.cur_page_idx;
this.rescale(this.container.clientWidth / this.pages[page_idx].width(), true);
// .98 is used to add a small left/right margin because it looks better than 100% width
this.rescale(this.container.clientWidth * .98 / this.pages[page_idx].width(), true);
this.scroll_to(page_idx);
},

Expand Down

0 comments on commit 2bea4ec

Please sign in to comment.