
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
This is a simple module to execute pdflatex in an easy and clean way. The pdflatex command line utility by default generates a lot of output and can create many files.
The PDFLaTeX class can be instantiated directly or through helpers:
jobname is any string that can be used to create a valid filename;
In all the following examples, no files are left on the filesystem, unless requested with the keep_pdf_file and keep_log_file parameters to the create_pdf method.
from pdflatex import PDFLaTeX
pdfl = PDFLaTeX.from_texfile('my_file.tex')
pdf, log, completed_process = pdfl.create_pdf(keep_pdf_file=True, keep_log_file=True)
The function create_pdf returns 3 results:
Also, create_pdf takes a few parameters:
import os
import pdflatex
import jinja2
env = pdflatex.JINJA2_ENV
env['loader'] = jinja2.FileSystemLoader(os.path.abspath('.'))
env = jinja2.Environment(**env)
template = env.get_template('jinja.tex')
pdfl = pdflatex.PDFLaTeX.from_jinja2_template(template, data='Hello world!')
pdf, log, cp = pdfl.create_pdf()
Quite self explanatory, just note that pdflatex includes a dictionary JINJA2_ENV with a suggestion of environment parameters for you to use with jinja2 and LaTeX. It os defined as:
JINJA2_ENV = {'block_start_string': '\BLOCK{',
'block_end_string': '}',
'variable_start_string': '\VAR{',
'variable_end_string': '}',
'comment_start_string': '\#{',
'comment_end_string': '}',
'line_statement_prefix': '%%',
'line_comment_prefix': '%#',
'trim_blocks': True,
'autoescape': False }
import pdflatex
with open('my_file.tex', 'rb') as f:
pdfl = pdflatex.PDFLaTeX.from_binarystring(f.read(), 'my_file')
pdf, log, cp = pdfl.create_pdf()
FAQs
Simple wrapper to calling pdflatex
We found that pdflatex demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.