Is the .txt file in a FileDocument or a String?
If it’s in a FileDocument, you can read the contents of the file and return it as a String using the StringFromFile Java Action in the Community Commons module from the Marketplace.
https://docs.mendix.com/appstore/modules/community-commons-function-library/#33-files
Once you have the content as a String, you can use Mendix’s built in Document Template functionality to generate a PDF. There is a good tutorial on how to do this in the Mendix documentation.
https://docs.mendix.com/refguide7/how-to-create-your-own-documents/
Hope this helps.
Hii Aneesh ,
you can use print screen to pdf component , it take a layout or div to print in pdf format you can also print whole screen in pdf.\
Mendix Marketplace - Print Screen to PDF