You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
General Issue: Investigate the topic of metadata for pdf in R #15
We want to investigate whether we can, with low cost and minimal dependencies, provide metadata support for our PDFs. All cells are saved as pdf metadata.
A hack with a title as a JSON
library(jsonlite)
# 1. Create a list of your custom metadata
my_metadata <- list(
title = "Alpha",
header1 = 42,
status = "Draft",
tags = c("R", "Plot", "JSON")
)
# 2. Convert to a JSON string - we should use base R for that - we control what we convert
json_string <- toJSON(my_metadata, auto_unbox = TRUE)
# 3. Pass the JSON string to the title argument
pdf("json_metadata_plot.png", title = json_string)
plot(1:10, main = "Data Visualization")
dev.off()
Thank you for working on that.
No pressure, even trying to help is a fantastic contribution.
FYI. We can catch up to discuss it or I can propose another interesting issue in future.
BTW. The first empty page is a known issue.
As I remeber you need to use pdf(..., onefile = TRUE) and/or print() for image.
Suggestion: I'll try to rough sketch what vignette might include. (in 1 week). Then you add/subtract to it?
Thx
Vignette Example: Check if we can add an example to a vignette demonstrating how to integrate this into a workflow (e.g., using the xmpdf R package).
Internal Solution: Consider building a lightweight, internal solution directly within gridify.
Activity
jimrothstein commentedon Feb 28, 2026
@Polkas
Have not worked with
ExifTool. Done other things in pharmaverse; this seems interesting and would like to try.jim
Polkas commentedon Feb 28, 2026
Hey @jimrothstein, it is fantastic that you want to contribute.
This is a really interesting task, and we have at least a few options for how to approach it:
Vignette Example: Check if we can add an example to a vignette demonstrating how to integrate this into a workflow (e.g., using the xmpdf R package).
Internal Solution: Consider building a lightweight, internal solution directly within gridify.
Advanced: We could also consider reporting it to the CRAN community, the lack of this specific grDevices::pdf capability and even try to contribute to base R itself. Since the R pdf() device already adds metadata like the title and author, I assume there is existing code we could easily extend.
Please assign yourself to the issue once you have decided to move forward with the contribution.
jimrothstein commentedon Feb 28, 2026
@Polkas
Hi - Let me aim for simple, first. I don't have write access and so will fork.
Working through gridify and exiftool ... all installed.
jimrothstein commentedon Mar 5, 2026
@Polkas
Still playing ... time to study packages you have already referenced.
gridify_mtcars.pdf
Polkas commentedon Mar 5, 2026
Thank you for working on that.
No pressure, even trying to help is a fantastic contribution.
FYI. We can catch up to discuss it or I can propose another interesting issue in future.
BTW. The first empty page is a known issue.
As I remeber you need to use pdf(..., onefile = TRUE) and/or print() for image.
jimrothstein commentedon Mar 30, 2026
@Polkas
Got sidetracked, but did read a bit re: grid/grobs ( nice intro: https://bookdown.org/rdpeng/RProgDA/the-grid-package.html) and poked about some of other tools.
About to work through ( r-xmpdf https://github.com/trevorld/r-xmpdf?tab=readme-ov-file#overview)
I am learning, but don't have clear picture, yet, of vignette idea you mentioned. Should I go all the way back to Adobe's XMP (https://opensource.adobe.com/dc-acrobat-sdk-docs/library/pdfmark/pdfmark_Syntax.html) ??
Suggestion: I'll try to rough sketch what vignette might include. (in 1 week). Then you add/subtract to it?
Thx
Polkas commentedon May 21, 2026
we have an active PR for it now. We decided to apply sidecar file solution. Feel free to comment on it:) By default no metadata is saved.
#19