I have a problem with hyperlinks for pdf output. Character entities are not correctly taken into account in the pdf output. I tried a solution I found on the site : https://stackoverfalow.com/questions/66348913/ggtextgeom-textbox-how-to-display-links-as-raw-text It works for the "/" character but it doesn't work with "-" which I replace with "-". If I click on the address in the pdf, it is incorrect.
I also have a problem with @ which is not taken into account by textbox_grob.
Does anyone have a solution ?
library(tidyverse)
library(grid)
library(gridtext)
library(gridExtra)
# Example with
link <- paste0(
"Link :\n",
"https://my-example.com/dont-work"
)
link_grob <- gridtext::textbox_grob(link,
x = unit(0, "npc"),
hjust = 0,
vjust = 1,
gp = gpar(fontsize = 5,
col = "black"))
grDevices::pdf("Test.pdf",
width = 8.27,
height = 11.7)
gridExtra::grid.arrange(link_grob)
dev.off()
#> png
#> 2
mail <- paste0(
"E-mail: [email protected]"
)
mail_grob <- gridtext::textbox_grob(mail,
x = unit(0, "npc"),
hjust = 0,
vjust = 1,
gp = gpar(fontsize = 5,
col = "black"))
#> Error: gridtext has encountered a tag that isn't supported yet: <a>
#> Only a very limited number of tags are currently supported.
Created on 2023-12-11 with reprex v2.0.2