英文:
How can I export a VTK screenshot to a PDF or a vectorized image?
问题
有没有办法将其保存为PDF或SVG文件?
英文:
I wrote a python script to render a VTK object and save its figure as PNG using the vtkPNGWriter()
functions. Is there a way to save it as a PDF or a svg file?
答案1
得分: 0
你可以使用 vtk.vtkPDFExporter()
将渲染数据导出为 PDF。
英文:
You can use vtk.vtkPDFExporter()
to get rendered data as pdf.
答案2
得分: 0
可以使用vtk.vtkGL2PSExporter()
函数将渲染窗口导出为PDF图像。以下是一个可用的代码片段:
pdfExporter = vtk.vtkGL2PSExporter()
pdfExporter.SetRenderWindow(render_window)
outputFilename = "文件名"
pdfExporter.SetFileFormatToPDF() #保存为PDF
pdfExporter.SetFilePrefix(outputFilename)
pdfExporter.Write()
英文:
It is possible to export a PDF image of the render window using the function vtk.vtkGL2PSExporter()
.
Here a working snippet of code:
pdfExporter = vtk.vtkGL2PSExporter()
pdfExporter.SetRenderWindow(render_window)
outputFilename = "file_name"
pdfExporter.SetFileFormatToPDF() #save as pdf
pdfExporter.SetFilePrefix(outputFilename)
pdfExporter.Write()
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论