Skip to content
This repository was archived by the owner on Dec 9, 2018. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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