Error for chrome_print: Failed to open http://127.0.0.1:7421/custom.css
When running the following code:
chrome_print( report_html, options = list(displayHeaderFooter = TRUE, headerTemplate = format(header, indent = FALSE), footerTemplate = format(footer, indent = FALSE) ) )
Get an error:
Error in force(expr) : Failed to generate output. Reason: Failed to open http://127.0.0.1:7421/custom.css (HTTP status code: 404) 6. stop("Failed to generate output. Reason: ", e) 5. force(expr) 4. with_loop(loop, expr) 3. with_temp_loop_maybe({ ws = websocket::WebSocket$new(get_entrypoint(debug_port, verbose), autoConnect = FALSE) ws$onClose(kill_chrome) ... 2. pagedown::chrome_print(input = file_path, options = list(scale = scale))
- html_to_pdf(report_html)
R Session Info:
sessionInfo() R version 4.3.3 (2024-02-29 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 11 x64 (build 26100)
Matrix products: default
locale: [1] LC_COLLATE=English_United States.utf8 LC_CTYPE=English_United States.utf8 LC_MONETARY=English_United States.utf8 [4] LC_NUMERIC=C LC_TIME=English_United States.utf8
time zone: America/New_York tzcode source: internal
attached base packages: [1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] knitr_1.45 RDCOMClient_0.96-1 htmltools_0.5.7 kableExtra_1.4.0 pagedown_0.22 psycModel_0.5.0
[7] tinytex_0.50 rmdformats_1.0.4 formatR_1.14 officer_0.6.5 ggrepel_0.9.5 rmarkdown_2.28
[13] data.table_1.15.2 Rfast_2.1.0 RcppParallel_5.1.9 RcppZiggurat_0.1.6 Rcpp_1.0.12 openxlsx_4.2.6.1
[19] xml2_1.3.6 rvest_1.0.4 flextable_0.9.5 rlang_1.1.3 readxl_1.4.3 assertthat_0.2.1
[25] janitor_2.2.0 glue_1.7.0 lubridate_1.9.3 forcats_1.0.0 stringr_1.5.1 dplyr_1.1.4
[31] purrr_1.0.2 readr_2.1.5 tidyr_1.3.1 tibble_3.2.1 ggplot2_3.5.0 tidyverse_2.0.0
[37] Rblpapi_0.3.14
loaded via a namespace (and not attached):
[1] magrittr_2.0.3 snakecase_0.11.1 compiler_4.3.3 systemfonts_1.0.6
[5] vctrs_0.6.5 httpcode_0.3.0 pkgconfig_2.0.3 crayon_1.5.2
[9] fastmap_1.1.1 ellipsis_0.3.2 labeling_0.4.3 utf8_1.2.4
[13] promises_1.2.1 tzdb_0.4.0 ps_1.7.6 ragg_1.3.0
[17] xfun_0.51 cachem_1.0.8 jsonlite_1.8.8 highr_0.10
[21] later_1.3.2 uuid_1.2-0 parallel_4.3.3 R6_2.5.1
[25] bslib_0.6.1 stringi_1.8.3 jquerylib_0.1.4 cellranger_1.1.0
[29] bookdown_0.40 httpuv_1.6.14 timechange_0.3.0 tidyselect_1.2.1
[33] rstudioapi_0.15.0 yaml_2.3.8 websocket_1.4.2 codetools_0.2-19
[37] processx_3.8.4 curl_5.2.1 shiny_1.8.0 withr_3.0.0
[41] askpass_1.2.0 evaluate_0.23 zip_2.3.1 pillar_1.9.0
[45] generics_0.1.3 servr_0.32 hms_1.1.3 munsell_0.5.0
[49] scales_1.3.0 xtable_1.8-4 gdtools_0.3.7 tools_4.3.3
[53] gfonts_0.2.0 grid_4.3.3 colorspace_2.1-0 cli_3.6.2
[57] textshaping_0.3.7 fontBitstreamVera_0.1.1 fansi_1.0.6 viridisLite_0.4.2
[61] svglite_2.1.3 gtable_0.3.4 selectr_0.4-2 sass_0.4.9
[65] digest_0.6.35 fontquiver_0.2.1 crul_1.4.0 farver_2.1.1
[69] lifecycle_1.0.4
We will need a reproducible example to help. This error message means that the custom.css file is not found while serving the HTML file to print.