Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PDF error: Couldn't find a font for 'Helvetica' #38

Open
bakaburg1 opened this issue Jul 10, 2018 · 8 comments
Open

PDF error: Couldn't find a font for 'Helvetica' #38

bakaburg1 opened this issue Jul 10, 2018 · 8 comments

Comments

@bakaburg1
Copy link

Hello, I'm trying to convert a Pdf created via knitr to PNG.

When using pdf_convert I get this error: "PDF error: Couldn't find a font for 'Helvetica'".

Helvetica is undoubtedly installed on my machine, so I don't understand where this message comes from.

Thanks

@jeroen
Copy link
Member

jeroen commented Jul 10, 2018

Please include an example pdf, and the R code that you use and sessionInfo().

@bakaburg1
Copy link
Author

R code and output:

> pdf_convert("ReportTemplate.pdf", format = "png", dpi = 300)
Converting page 1 to ReportTemplate_1.png...PDF error: Couldn't find a font for 'Helvetica'
PDF error: Couldn't find a font for 'Helvetica'
PDF error: Couldn't find a font for 'Helvetica'
PDF error: Couldn't find a font for 'Helvetica'
PDF error: Couldn't find a font for 'Helvetica'
PDF error: Couldn't find a font for 'Helvetica'
PDF error: Couldn't find a font for 'Helvetica'
PDF error: Couldn't find a font for 'Helvetica'
PDF error: Couldn't find a font for 'Helvetica'
PDF error: Couldn't find a font for 'Helvetica'
PDF error: Couldn't find a font for 'Helvetica'
PDF error: Couldn't find a font for 'Helvetica'
PDF error: Couldn't find a font for 'Helvetica'
PDF error: Couldn't find a font for 'Helvetica'
PDF error: Couldn't find a font for 'Helvetica'
PDF error: Couldn't find a font for 'Helvetica'
PDF error: Couldn't find a font for 'Helvetica'
PDF error: Couldn't find a font for 'Helvetica'
PDF error: Couldn't find a font for 'Helvetica'
PDF error: Couldn't find a font for 'Helvetica'
PDF error: Couldn't find a font for 'Helvetica'
PDF error: Couldn't find a font for 'Helvetica'
PDF error: Couldn't find a font for 'Helvetica'
PDF error: Couldn't find a font for 'Helvetica'
PDF error: Couldn't find a font for 'Helvetica'
PDF error: Couldn't find a font for 'Helvetica'
PDF error: Couldn't find a font for 'Helvetica'
PDF error: Couldn't find a font for 'Helvetica'
PDF error: Couldn't find a font for 'Helvetica'
PDF error: Couldn't find a font for 'Helvetica'
PDF error: Couldn't find a font for 'Helvetica'
PDF error: Couldn't find a font for 'Helvetica'
PDF error: Couldn't find a font for 'Helvetica'
PDF error: Couldn't find a font for 'Helvetica'
PDF error: Couldn't find a font for 'Helvetica-Bold'
PDF error: Couldn't find a font for 'Helvetica-Bold'
PDF error: Couldn't find a font for 'Helvetica-Bold'
PDF error: Couldn't find a font for 'Helvetica-Bold'
 done!
[1] "ReportTemplate_1.png"

PDF source
ReportTemplate.pdf

PNG output
reporttemplate_1

Session info

> sessionInfo()
R version 3.4.0 (2017-04-21)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS  10.13.5

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib

locale:
[1] it_IT.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] pdftools_1.8     convertGraph_0.1 lubridate_1.7.2  scales_0.5.0     ggplot2_2.2.1    dplyr_0.7.5      knitr_1.17       rmarkdown_1.6   
 [9] foreach_1.4.4    readxl_1.0.0     stringr_1.3.0   

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.17     bindr_0.1.1      magrittr_1.5     munsell_0.4.3    tidyselect_0.2.4 colorspace_1.3-2 R6_2.2.2         rlang_0.2.1     
 [9] plyr_1.8.4       tools_3.4.0      grid_3.4.0       gtable_0.2.0     htmltools_0.3.6  iterators_1.0.9  yaml_2.1.14      lazyeval_0.2.1  
[17] rprojroot_1.2    digest_0.6.12    assertthat_0.2.0 tibble_1.4.2     bindrcpp_0.2.2   purrr_0.2.4      codetools_0.2-15 glue_1.2.0      
[25] evaluate_0.10.1  stringi_1.1.6    compiler_3.4.0   pillar_1.1.0     cellranger_1.1.0 backports_1.1.1  pkgconfig_2.0.1 

@jeroen
Copy link
Member

jeroen commented Jul 11, 2018

Hmm I can't reproduce this problem on my mac (R 3.5.1 on macOS High Sierra), it seems to render just fine. Your version of R is pretty old though. Can you try installing the latest versions of R and xquartz?

@bakaburg1
Copy link
Author

Uhm, I updated R and Quartz and still nothing. But now missing font warnings were preceded by a "Fontconfig error: Cannot load default config file" warning. Maybe it's the main problem

@RafaRafa
Copy link

I had the same issue, updated "fontconfig" following this: Kozea/WeasyPrint#402

But this did not clear up "PDF error: Couldn't find a font for 'X'"

@saregriffith
Copy link

has anyone figure this one out - currently, have this error and haven't been able to sort it out. have updated everything, etc etc but unable to fix

@matthiaskaeding
Copy link

matthiaskaeding commented Jan 14, 2021

Has someone found a solution for this? Having the same issue one mabook air m1.

@Averysaurus
Copy link

Averysaurus commented Feb 28, 2021

Just encountered this error myself. Has anyone resolved this one recently?

UPDATE: the error occured with me when there is both image and text (copy-pasteable) data in a single document. If you receive these errors, check to see if that's the case. I've run many an OCR function on image-level PDF without major issues by fixing this myself in the documents.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants