Custom Files are for adding your own pages with content. If you want to add a route to output your PDF, read https://discourse.hkvstore.com/t/using-route-action-server-event-v2021/3393/1 you must use Custom File, you should put your code in Page_Load or Page_Render server event.You should also use fully qualified name for dompdf, see Using namespaces: Basics.