pdf_png
¶
copy_photo_next_to_typst_file(rendercv_model, typst_path)
¶
Copy CV photo to Typst file directory for compilation.
Why
Typst compiler resolves image paths relative to source file location. Copying photo ensures compilation succeeds regardless of original photo location.
Parameters:
-
rendercv_model(RenderCVModel) –CV model containing photo path.
-
typst_path(Path) –Path to Typst source file.
Source code in src/rendercv/renderer/pdf_png.py
generate_pdf(rendercv_model, typst_path)
¶
Compile Typst source to PDF using typst-py compiler.
Why
PDF is the primary output format for CVs. Typst compilation produces high-quality PDFs with proper fonts, layout, and typography from the intermediate Typst markup.
Parameters:
-
rendercv_model(RenderCVModel) –CV model for path resolution and photo handling.
-
typst_path(Path | None) –Path to Typst source file to compile.
Returns:
-
Path | None–Path to generated PDF file, or None if generation disabled.
Source code in src/rendercv/renderer/pdf_png.py
generate_png(rendercv_model, typst_path)
¶
Compile Typst source to PNG images using typst-py compiler.
Why
PNG format enables CV preview in web applications and README files. Multi-page CVs produce multiple PNG files with sequential numbering.
Parameters:
-
rendercv_model(RenderCVModel) –CV model for path resolution and photo handling.
-
typst_path(Path | None) –Path to Typst source file to compile.
Returns:
-
list[Path] | None–List of paths to generated PNG files, or None if generation disabled.
Source code in src/rendercv/renderer/pdf_png.py
get_typst_compiler(file_path, input_file_path)
cached
¶
Create cached Typst compiler with font paths configured.
Why
Compiler initialization is expensive. Caching enables reuse for both PDF and PNG generation. Font paths include package fonts and optional user fonts from input file directory.
Parameters:
-
file_path(Path) –Typst source file to compile.
-
input_file_path(Path | None) –Original input file path for relative font resolution.
Returns:
-
Compiler–Configured Typst compiler instance.