I'm using R to generate PDFs that contain QR code images. The images have to be arranged in a 4x6 pattern like this mockup that i made in Word:
I've written a loader that i plan to write into a loop later on (i've got over 2000 images). However, i can't quite get the spacing right. This is my current result:
It's not a bad thing that the images are smaller, but the large margins on top and bottom and right are a problem. I've been trying to set par(mar = c(4,0,0,0) in the loop to see if the images would get a bottom margin, but that doesn't happen. Also, i think i need to use padding instead of margin, but i haven't found a parameter for padding.
Is there a way to do this? The code i've written so far:
# import libraries
library(qrcode)
library(imager)
# clear workspace
rm(list = ls())
filenames <- list.files(path = "./QR/2/")
im <- load.image(paste0("./QR/2/",filenames[1]))
im <- list()
for(i in 1:24){
im[[i]] <- load.image(paste0("./QR/2/",filenames[i]))
}
pdf("./QR/2/stickervellen/1.pdf", paper = "a4")
par(mfrow = c(6,4), mar=c(0,0,0,0))
for(i in 1:24){
par(mar = c(4,0,0,0))
plot(im[[i]], axes = F)
}
dev.off()
the images i'm using can be found here: https://easyupload.io/v4gmbf