std::string_view with %.*s as a string formatter work well enough if you're set on using printf.
I found it was easiest to sometimes allocate a temporary, if the input wasn't known to be NUL-terminated.
printf("%.*s", static_cast<int>(sv.size()), sv.data())
?