ZK 9.5 PdfViewer

asked 2020-12-02 23:47:44 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16

Only a question or hint. We change our current pdf viewer to the new PdfViewer from ZK. Our pdf pages are all in landscape mode (not normal portrait mode) created. So i must to initialize the new PdfViewer with

pdfViewer.setRotation(90); // because, orientation of the reports is landscape

Is there no automatic that the pdfViewer knows the print mode of the media (protrait/landscape) when gets the pdf ?

thanks Stephan

delete flag offensive retag edit

2 Answers

Sort by ยป oldest newest most voted

answered 2020-12-03 14:57:50 +0800

MDuchemin gravatar image MDuchemin
2390 1 6
ZK Team

Hi Terrytornado,

That's a pretty good suggestion, will be stealing that :) here's the feature request: https://tracker.zkoss.org/browse/ZK-4740

You can override it, but only by overriding the whole /web/js/zkex/pdfviewer/Pdfviewer.src.js and /web/js/zkex/pdfviewer/Pdfviewer.js files in your project.

You can update here:

    _getPage: function _getPage(pageNum) {
  var _this3 = this;

  var pdfFirstRender = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  if (!this._pdf) return;

  if (this._pageRendering) {
    this._pendingPageNum = pageNum;

  this._pageRendering = true;
  return this._pdf.getPage(pageNum).then(function (page) {
    var viewport = page.getViewport({
      scale: _this3._zoom,
      rotation: _this3._rotation += page._pageInfo.rotate //THIS PART ADDING THE ROTATION

I've also put in a feature request to improve on that, and allow granular overrides.


link publish delete flag offensive edit


Many thanks MDuchemin

terrytornado ( 2020-12-04 23:22:09 +0800 )edit

answered 2020-12-29 16:19:25 +0800

MDuchemin gravatar image MDuchemin
2390 1 6
ZK Team

Hey there!

auto rotate is now available for PDFs that include page orientation by default :)

try it out in current FL: 9.5.1.FL.20201228(-Eval)

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

1 follower



Asked: 2020-12-02 23:47:44 +0800

Seen: 21 times

Last updated: Dec 29 '20

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More