Export 3D views as image from files in the background?

Hi guys,

Can I export 3D views as images or PDF from Revit files opened in the background?

thanks

Have you tried View.exportAsImage?
image

Yes, but it fails :frowning:

Have you tried to print a view? I know you can print files from the background it goes much quicker.