Можно ли экспортировать в PDF HTMLTextArea с использованием Ironpython на более новых версиях Spotfire - PullRequest
0 голосов
/ 12 июня 2019

Пример отчета Можно ли экспортировать в PDF визуализацию HTMLTextArea без усечения в более новых версиях Spotfire?Если да, возможно ли получить образец кода?

1 Ответ

0 голосов
/ 12 июня 2019

Я использую 10.2 прямо сейчас, и да, возможно экспортировать HTMLTextArea в PDF с IronPython.

вот код, который я использовал, в основном из 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.
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...