cvfosammmm / Setzer

LaTeX editor written in Python with Gtk
https://www.cvfosammmm.org/setzer/
Other
388 stars 34 forks source link

Bug: PDF preview can't show differing aspect ratios #320

Open evamvid opened 1 year ago

evamvid commented 1 year ago

If individual pages are rotated in the PDF /Rotate page attribute (for example using the pdflscape package, the pdf preview displays them incorrectly.

In the PDF preview: Screenshot from 2023-04-13 13-44-21

How it should look: Screenshot from 2023-04-13 13-45-08

MWE:


\documentclass[]{report}

\usepackage{tabularx}
\usepackage{pdflscape}

\begin{document}

lorem ipsum
\pagebreak

\begin{landscape}
\begin{table}[h]
\begin{tabular}{cc}

lorem & ipsum\\ 

lorem & ipsum

\end{tabular}

\end{table}
\end{landscape}
\end{document}

The PDF should show the second page in a landscape format in this MWE.

evamvid commented 1 year ago

Seems like the existing width/height code

            page_size = self.poppler_document.get_page(0).get_size()
            self.page_width = page_size.width
            self.page_height = page_size.height

actually will deliver widths and heights for rotated pages, without having to manually inspect the PDF page attributes. So to implement this, the layouter would need to query that for each individual page rather than just the first one. It makes the code for calculating the overall width and height, as well as zoom, offsets, and synctex boxes more complicated, though.