diff options
author | Karl Berry <karl@freefriends.org> | 2024-01-21 21:18:12 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2024-01-21 21:18:12 +0000 |
commit | 6c477ac1852f9f18cf33a863f27bf97791464dfe (patch) | |
tree | 48fd3318ddd581e017bd0cd512f77d213f4610e5 /Master/texmf-dist/doc | |
parent | 312e817982ce06903abc1a8d94613a2bd847333b (diff) |
ppmcheckpdf (21jan24)
git-svn-id: svn://tug.org/texlive/trunk@69527 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc')
-rw-r--r-- | Master/texmf-dist/doc/support/ppmcheckpdf/README.txt | 4 | ||||
-rw-r--r-- | Master/texmf-dist/doc/support/ppmcheckpdf/ppmcheckpdf.pdf | bin | 0 -> 25067 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/support/ppmcheckpdf/ppmcheckpdf.tex | 106 |
3 files changed, 110 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/support/ppmcheckpdf/README.txt b/Master/texmf-dist/doc/support/ppmcheckpdf/README.txt new file mode 100644 index 00000000000..daf87bd3d07 --- /dev/null +++ b/Master/texmf-dist/doc/support/ppmcheckpdf/README.txt @@ -0,0 +1,4 @@ +Package: Convert PDF to PNG and compare PNG files after l3build +Author: Jianrui Lyu <tolvjr@163.com> +Repository: https://github.com/lvjr/ppmcheckpdf +License: The LaTeX Project Public License 1.3c diff --git a/Master/texmf-dist/doc/support/ppmcheckpdf/ppmcheckpdf.pdf b/Master/texmf-dist/doc/support/ppmcheckpdf/ppmcheckpdf.pdf Binary files differnew file mode 100644 index 00000000000..6a893fa85b6 --- /dev/null +++ b/Master/texmf-dist/doc/support/ppmcheckpdf/ppmcheckpdf.pdf diff --git a/Master/texmf-dist/doc/support/ppmcheckpdf/ppmcheckpdf.tex b/Master/texmf-dist/doc/support/ppmcheckpdf/ppmcheckpdf.tex new file mode 100644 index 00000000000..8b32a8259e1 --- /dev/null +++ b/Master/texmf-dist/doc/support/ppmcheckpdf/ppmcheckpdf.tex @@ -0,0 +1,106 @@ +% -*- coding: utf-8 -*- +\documentclass[oneside,12pt]{article} +\usepackage[a4paper,margin=2cm]{geometry} + +\newcommand*{\myversion}{2024B} +\newcommand*{\mydate}{Version \myversion\ (\the\year-\mylpad\month-\mylpad\day)} +\newcommand*{\mylpad}[1]{\ifnum#1<10 0\the#1\else\the#1\fi} + +\setlength{\parindent}{0pt} +\setlength{\parskip}{4pt plus 1pt minus 1pt} + +\usepackage{codehigh} +\usepackage{hyperref} +\hypersetup{ + colorlinks=true, + urlcolor=blue3, + linkcolor=green3, +} + +\NewDocumentCommand\mypkg{m}{\textcolor{blue3}{\mbox{\ttfamily#1}}} +\NewDocumentCommand\myopt{m}{\textcolor{brown3}{\mbox{#1}}} +\NewDocumentCommand\mycmd{m}{\textcolor{green3}{\ttfamily\fakeverb{#1}}} +\NewDocumentCommand\myfile{m}{\textcolor{purple3}{\mbox{#1}}} +\NewDocumentCommand\myprg{m}{\textcolor{cyan3}{\mbox{#1}}} + +\begin{document} + +\title{\sffamily + \textcolor{green3}{The \texttt{ppmcheckpdf} tool}\\ + {\large Convert PDF to PNG and compare PNG files after \texttt{l3build}}% +} +\author{% + Jianrui Lyu (tolvjr@163.com)% + %\\\url{https://github.com/lvjr/ppmcheckpdf} +} +\date{\mydate} +\maketitle + +The \mypkg{l3build} system is a useful and powerful tool for regression testing. +With \mypkg{l3build} you normally print the contents of some boxes from \myfile{.lvt} files +to corresponding \myfile{.tlg} files. Sometimes \LaTeX{} kernel or some package your package +depends on adds a whatisit or \mycmd{\kern0pt}, and your test files will fail even if +the PDF files look the same as before and are still correct. + +This \mypkg{ppmcheckpdf} tool provides an alternative way for regression testing: +Instead of printing box contents in \myfile{.lvt} files, you could just convert PDF files +to PNG files and compare PNG files after \mypkg{l3build} finishes its job. + +\section{Installation} + +Normally your TeX distribution will copy \myfile{ppmcheckpdf.lua} file to the correct folder +when you install this tool. If a manual installation is needed, you could download +\href{https://ctan.org/pkg/ppmcheckpdf}{\myfile{ppmcheckpdf.lua}} +from CTAN and install it to \myfile{TEXMF/scripts/ppmcheckpdf/ppmcheckpdf.lua}. + +The \mypkg{ppmcheckpdf} tool uses \myprg{pdftoppm} program for image converting. +This program is installed by default on MiKTeX. For TeX Live, you can install it by running +\begin{codehigh} +tlmgr install wintools.windows +\end{codehigh} +on Windows, or running +\begin{codehigh} +sudo apt-get install poppler-utils +\end{codehigh} +on Ubuntu/Debian Linux. + +\section{Usages} + +First create a \myfile{buildend.lua} file with the following lines in the folder of your package +(next to \myfile{build.lua} file for \mypkg{l3build}): +\begin{codehigh} +kpse.set_program_name("kpsewhich") +dofile(kpse.lookup("ppmcheckpdf.lua")) +\end{codehigh} +Then you could run the folllowing commands +\begin{codehigh} +l3build check +texlua buildend.lua +\end{codehigh} + +The first run of \mypkg{ppmcheckpdf} will save image and md5 files to \myfile{testfiles} folder, +and the subsequent runs of it will compare new md5 values with existing md5 values. + +You could force \mypkg{ppmcheckpdf} to save new image and md5 files to \myfile{testfiles} folder +by passing \myopt{save} option to it: +\begin{codehigh} +l3build check +texlua buildend.lua save +\end{codehigh} + +\section{Customizations} + +The \myprg{pdftoppm} program supports several types of image files. +By default the \mypkg{ppmcheckpdf} tool will use \myfile{.png} file, +and you could change it in \myfile{build.lua} file like this: +\begin{codehigh} +imgext = ".ppm" +\end{codehigh} +\begin{codehigh} +imgext = ".pgm" +\end{codehigh} +\begin{codehigh} +imgext = ".pbm" +\end{codehigh} + +\end{document} |