currently there are only some assumptions about image dimensions which are hard coded in Bookreader.js (D6: fileviewer.js). The appended patch examines these dimensions and makes the values available in the appropriate js-functions.
The functionality is tested in D6. Please check in D7 !

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

shenzhuxi’s picture

schildi, I'm sorry.
I tried your patch and got different problems on chrome and Firefox.
First, it makes everything very slow on both of them (seems because I have a pdf with many pages).
The reader display incorrectly in Chrome.
On firefox only the first page is displayed.

schildi’s picture

Hello shenzhuxi

thanks for your efforts testing my half cooked patch. It was tested by me on D6 only.
I invested some time to make it running on D7 too, but there are still some issues remaining:

  1. Speed:
    it looks that the main issues are in "Bookreader" itself. When testing with a three pages PDF document I realized that functions getImageHeight / getImageWidth are called 24 times before the first page is shown.
    It helps a lot that there are caches defined by function fv_ImageDim (1 entry) and fileviewer_getimagesize (cache table), but every ajax/json call takes about 300ms to finish (on a 6 years old machine).
    Bookreader itself establishes a cache for image dimensions (compare "prefetchedImgs") but seems to not use it.
    So, from my point of view function "fileviewer_getimagesize" is fast enough when BookReader uses its own cache as it should.
    One possible way of acceleration is to fill fileviewer_getimagesize cache when the PNG images are created. And then load BookReaders internal cache at once when the first page is addressed.
  2. I also realized that there is only one page shown. Is it possible that it has to do with some error messages I got and are shown in the image attached to this post?
  3. To ease collaboration I attached the whole bunch of fileviewer-D7 files to this post.
shenzhuxi’s picture

Status: Active » Fixed

After "Search inside" was added, fileviewer uses a new way for getImageHeight / getImageWidth.

There are still problem for getImageHeight / getImageWidth is "search inside" is turn off.
The bookreader itself needs to improve itself.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.