npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

latex-to-pdf

v1.0.37

Published

**LaTeX to PDF** is a Node.js module that allows you to generate PDF reports from LaTeX templates with dynamic data injection. It provides functionalities for parsing templates, generating TypeScript interfaces for type safety, and compiling LaTeX files i

Readme

LaTeX to PDF Documentation

Overview

LaTeX to PDF is a Node.js module that allows you to generate PDF reports from LaTeX templates with dynamic data injection. It provides functionalities for parsing templates, generating TypeScript interfaces for type safety, and compiling LaTeX files into PDFs.

Dependencies

  • pdflatex
    • Windows install: https://www.tug.org/texlive/
    • Mac install: brew install texlive
    • Debian/Ubuntu: sudo apt install texlive-latex-base then optionally sudo apt install texlive-latex-extra texlive-fonts-recommended

Installation

Using git

Setup the package in it's own directory

git clone https://github.com/TytoLtd/latext_to_pdf_ts.git
cd latex-to-pdf
yarn install
yarn build
yarn link

Link to another project. In the other project:

yarn link latex-to-pdf

Using the package manager if I decide to publish it (haven't yet)

yarn add latex-to-pdf

Usage

Generating TypeScript Interfaces from Templates

Before generating PDFs, you need to extract fields from LaTeX templates and generate TypeScript interfaces:

latex-to-pdf-setup <TEMPLATE_DIRECTORY>

This command scans the provided directory for .tex templates, extracts placeholders, and generates corresponding TypeScript interfaces. <TEMPLATE_DIRECTORY> is where you decide to keep your latex templates. An example latex template is provided below.

API Reference

LatexToPdf Class

class LatexToPdf {
  constructor(reportType: string);
  populate<T>(data: T, output: string): string;
}

Methods:

  • constructor(reportType: string): Initializes the generator with a report type. The type must be pre-generated using generateAllTypes.
  • populate<T>(data: T, output: string): string: Injects data into the LaTeX template and generates a PDF.

generateAllTypes

function generateAllTypes(templateDir: string): string[];

Scans a directory for .tex templates and generates TypeScript interfaces.

Configuration

Ensure the pdflatex command is installed and available in your system path to enable PDF generation. See above dependency.

Example

Latex Template



\documentclass{article}
\usepackage{longtable}
\begin{document}
{{let cust1:import<Customer,"../src/Customer.ts">}}
{{let results_table:[new<date:string,item:string,price:number>]}}
{{let meeps:[import<Meep,"../src/Meep.ts">]}}
{{let date:raw<string>}}
Invoice for {{cust1.name}}

Date: {{date}}

\begin{longtable}{|l|c|c|}
    \hline
    \textbf{Date} & \textbf{Item} & \textbf{Price (ZAR)} \\
    \hline
    {{table(results_table,[date,item,price])}}
    \hline
    \end{longtable}

\section{Meep}
{{for meep in meeps
    {\textbf{Meep ID:} {{meep.id}} \\}
}}

\section{Magic}
{{if ({{date}} == "Meep")
    {\textbf{Magic:} 1 \\}else{\textbf{Not Magic:} 0 \\}
}}

\end{document}

TS Code

import { LatexToPdf } from "latex-to-pdf";
import { Customer } from "./src/Customer";
import { InvoiceData } from "./latex_interfaces/invoice";


const pdfGenerator = new LatexToPdf("invoice"); // Same as template name just without .tex. So invoice.tex -> invoice

// The data type for a template will always be called {templateName}Data. 
// You can find the structure in the generated folder "node_modules/latex-to-pdf/generated"

let cust: Customer={
    name: "Mikey",
    id: 123
}

let data: InvoiceData={
    cust1: cust,
    results_table: [
        {
            date: "2021-01-01",
            item: "Item 1",
            price: 10
        },
        {
            date: "2021-01-02",
            item: "Item 2",
            price: 20
        }
    ],
    meeps: [
        {
            id: 999
        },
        {
            id: 9991
        }
    ],
    date: "not Meep"
}

const pdfPath = pdfGenerator.populate(data, "./output/test.pdf");
console.log(`Generated PDF at: ${pdfPath}`);

License

© 2025 Tyto Insights. All Rights Reserved.