Page MenuHomePhabricator

Handle scrollable references when generating PDFs
Closed, DeclinedPublic

Description

**This limitation has been recorded in https://www.mediawiki.org/wiki/Reading/Web/Projects/Print_Styles#Limitations**

When an article has scrollable references section (example: https://ar.wikipedia.org/wiki/%D9%82%D9%86%D8%A7%D8%A9_%D8%A7%D9%84%D8%B3%D9%88%D9%8A%D8%B3) the printed version looks very bad. The main cause is that references sections are wrapped with an element with inline max-height: 300px, overflow: auto styles.

Screen Shot 2018-06-05 at 5.34.05 PM.png (1×1 px, 708 KB)

Both the PDF renderer and browser print are affected.
We cannot do too much in that case as those styles are this is done by <div class="reflist4" style="max-height: 300px; overflow: auto; padding:12px"> added by the editor.

Close up:

Screen Shot 2018-08-16 at 2.45.36 PM.png (379×1 px, 203 KB)

Developer notes

This is a local wiki issue and can only be fixed by the community. Arabuc Wiki do not use any templates for reflist. If they did they could make use of TemplateStyles and make use of a media query to limit these styles to "screen" e.g. not "print" media

@media screen {
 .reflist {
    height: 300px; overflow: auto; padding:12px
  }
}
Other possible solutions
  1. add a javascript that runs before page.printToPDF() that goes through content children and removes max-heigh and overflow styles.

Event Timeline

Vvjjkkii renamed this task from Handle scrollable references when generating PDFs to 75aaaaaaaa.Jul 1 2018, 1:04 AM
Vvjjkkii raised the priority of this task from Low to High.
Vvjjkkii updated the task description. (Show Details)
Vvjjkkii removed a subscriber: Aklapper.
CommunityTechBot renamed this task from 75aaaaaaaa to Handle scrollable references when generating PDFs.Jul 2 2018, 9:32 AM
CommunityTechBot lowered the priority of this task from High to Low.
CommunityTechBot updated the task description. (Show Details)
CommunityTechBot added a subscriber: Aklapper.

It's tracked in limitations, so easy to revive this if needed.