It's mentioned to include com.pinterest.ktlint:ktlint-core dependency but it does not exists. Might be good to update the documentation.
Yes, it is possible to use KtLint to directly format the code generated with KotlinPoet. To do so, you must include the dependencies com.pinterest.ktlint:ktlint-core and com.pinterest.ktlint:ktlint-ruleset-standard in your Gradle/Maven project.
On this doc regarding question :
Can I use KtLint to directly format the code I'm generating with KotlinPoet?
https://pinterest.github.io/ktlint/latest/faq/#can-i-use-ktlint-to-directly-format-the-code-im-generating-with-kotlinpoetIt's mentioned to include
com.pinterest.ktlint:ktlint-core
dependency but it does not exists. Might be good to update the documentation.