Or is there any other alternatives to achieve this?
A way is with ID2D1PrintControl.
I uploaded a test sample recently, which can be improved : WinUI3_Direct2D_Print
(I used RenderTargetBitmap to print an image of some controls, but you can print/draw anything inside BeginDraw/EndDraw of m_pD2DDeviceContext)