View Single Post
Old 10-16-2021, 02:08 PM   #6
RbnJrg
Wizard
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 1,827
Karma: 8700631
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Sorry for bother you, Kovid. I was able to find a way to employ custom margins with Calibre Viewer in paged mode. In fact, I could find TWO ways, but the last one has an inconvenience that, so far, I was not able to fix.

If you open MarginsTestCase-ONE with Calibre Viewer, you'll see that your program can display pages without issues, in spite of the epub has custom margins, modified by a script. To get that, I enclosed all the content in a div wrapper and I applied margins to it. Probably, this is the most economic way to get custom margins with Calibre Viewer.

Now, if you open MarginsTestCase-TWO, you'll see a totally different script to apply custom margins. This script takes into account, the current values managed for Viewer for width, column-width and column-gap. And it calculates the new margins according to those previous values. And it works fine, except for the last paragraph of any .xhtml file.

Click image for larger version

Name:	Image1.png
Views:	142
Size:	47.7 KB
ID:	189664Click image for larger version

Name:	Image2.png
Views:	136
Size:	47.8 KB
ID:	189665Click image for larger version

Name:	Image3.png
Views:	131
Size:	47.9 KB
ID:	189666Click image for larger version

Name:	Image4.png
Views:	144
Size:	40.2 KB
ID:	189667

Evidently I need to modify another more parameter of the Viewer to fix that, but I couldn't locate it in your layout() function. Could you tell me, according to your experience and since you are the creator and the developer of Calibre, what do you think I have to modify, to fix that bleeding of the last pages? Thank you very much in advance.
Attached Files
File Type: epub MarginsTestCase-ONE.epub (4.3 KB, 141 views)
File Type: epub MarginsTestCase-TWO.epub (4.6 KB, 126 views)
RbnJrg is offline   Reply With Quote