Skip to contents

Converts the interactive HTML report into a static PDF file using headless Chrome. This ensures that the layout matches the HTML view exactly.

Usage

av_export_pdf(obj, output_file, open = TRUE, ...)

Arguments

obj

An object of class AlphaVarSet.

output_file

Character string. Path to the output PDF file.

open

Logical. If TRUE, opens the PDF after creation. Default is TRUE.

...

Additional arguments passed to av_create_report or internal rendering.

Value

The path to the generated PDF file (invisibly).

Details

This function requires the pagedown package and a strictly local installation of Chrome or Chromium. It generates a temporary HTML report first, then prints it to PDF.

Examples

example_file <- system.file("extdata", "bcl11a_rs1427407_example.csv",
                            package = "AlphaVaR")
obj <- av_import_csv(example_file)
#> Reading bcl11a_rs1427407_example.csv ...
print(obj)
#> === AlphaVarSet Object ===
#> Entries:    2,676 
#> Variants:   2 
#> Modalities: 11 
#> Columns:    25 (incl. 19 extra)
#> Score Mode: quantile_score 
#> Source:     bcl11a_rs1427407_example.csv 

# PDF export prints the HTML report through a headless Chrome binary, which
# is absent on check machines, so the call runs interactively only.
if (interactive() && requireNamespace("pagedown", quietly = TRUE)) {
  pdf_path <- file.path(tempdir(), "bcl11a_report.pdf")
  av_export_pdf(obj, output_file = pdf_path, open = FALSE)
  file.exists(pdf_path)
}