Example Report是否可以将HTMLTextArea可视化文件导出为PDF而不会在较新版本的Spotfire上被截断?如果是,是否可以获取示例代码?
答案 0 :(得分:0)
我现在正在使用10.2,是的,可以使用IronPython将HTMLTextArea导出为PDF。
这是我使用的代码,主要来自TIBCOCommunity Spotfire Wiki:
# Import namespaces
from Spotfire.Dxp.Framework.ApplicationModel import ApplicationThread
from Spotfire.Dxp.Application.Export import PdfExportSettings, ExportScope, PageOrientation, PaperSize, ExportScope
# Declaring the function which will run async
def g(app,fileName,pdfexpsettings):
def f():
app.Document.Export(pdfexpsettings,fileName)
return f
# Set the file name
fileName = "C:\\temp\\testfile.pdf"
pdfexpsettings = PdfExportSettings()
pdfexpsettings.Scope = ExportScope.ActiveVisualization
pdfexpsettings.PageOrientation = PageOrientation.Landscape
pdfexpsettings.IncludePageTitles = False
pdfexpsettings.IncludeVisualizationTitles = False
pdfexpsettings.IncludeVisualizationDescriptions = False
pdfexpsettings.PaperSize = PaperSize.A4
pdfexpsettings.PageOrientation = PageOrientation.Landscape
# Executing the function on the application thread, and Save the document back to the Library
Application.GetService[ApplicationThread]().InvokeAsynchronously(g(Application, fileName,pdfexpsettings))
# Note:
# The function g is necessary because the script's scope is cleared after execution,
# and therefore Application (or anything else defined in this scope) will not be available
# when the code invokes on the application thread.