suttacentral / publications

SuttaCentral books: make HTML, EPUB, PDF
Creative Commons Zero v1.0 Universal
2 stars 1 forks source link

fix cover images on pdf #139

Closed sujato closed 1 year ago

sujato commented 2 years ago

See previous: https://github.com/suttacentral/publications/issues/138

This spells out what I believe is a good solution to the problem of unwanted backgrounds on imported images. The basic idea is to make the cover in three steps:

This ensures that the rasterizing when the pdf is flattened applies only to the image, not the fonts.

use font for logo

Focusing on the SC logo, it also has the same problem of a unwanted background color. To solve this I have made our logo into a font. The logo is at the character 0.

We should use the same font for the logo inside the book. I have dealt with this in #140

produce background image

Use a tex template such as dhp-cover-background.tex. This has only two things:

It is created to the same size as the full cover. We need to add the variable leaf image per volume, just as with the old design. But here is the basic template.

\documentclass[coverheight=9in,coverwidth=6in,spinewidth=0.32126126126126126in,pagecolor=backgroundcolor,bleedwidth=.125in,marklength=0in,12pt]{bookcover}%

\usepackage{graphicx}

% orange colors
\providecolor{backgroundcolor}{HTML}{E48C07}

% images. position of cover image can be adjusted if necessary
\newcommand*{\coverimage}[1]{\vspace*{3in}\hspace*{2in}{\includegraphics[height=8in]{orange1.png}}}

\begin{document}%
\pagestyle{empty}%
\normalsize%
\begin{bookcover}

\bookcovercomponent{normal}{bg front}{
{\coverimage{}}
}

\end{bookcover}%
\end{document}

flatten background image

Something like:

pdf2ps dhp-cover-background.pdf - | ps2pdf - orange1.pdf

make cover

Mostly the same as it is now, except we do not make a background color, instead we just import the flattened image:

\newcommand*{\coverimage}{\includegraphics{orange1.pdf}}