简体   繁体   English

在 Slate 应用程序中显示存储在 Palantir Foundry 数据集中的 PDF 文件

[英]Displaying a PDF file stored in a Dataset on Palantir Foundry in Slate Application

I am trying to display PDF files in Slate on Palantir Foundry.我正在尝试在 Palantir Foundry 的 Slate 中显示 PDF 文件。 I managed to display PDF files that are stored in a folder on Foundry without a schema, but not PDFs that are in a Dataset.我设法显示存储在 Foundry 文件夹中的 PDF 文件,但没有模式,但不是数据集中的 PDF。

Is there a way to display PDF files that are stored in a dataset or alternatively how can I store PDF files that I extracted from an email file using Code Repository into a folder on Foundry.有没有办法显示存储在数据集中的 PDF 文件,或者如何将使用代码存储库从电子邮件文件中提取的 PDF 文件存储到 Foundry 的文件夹中。

Edit: Since displaying PDF files stored in a dataset seems to be difficult.编辑:由于显示存储在数据集中的 PDF 文件似乎很困难。 Can someone help me with the API call to store PDFs in a folder?有人可以帮助我通过 API 调用将 PDF 存储在文件夹中吗?

You can do it in two steps:您可以分两步完成:

  1. Obtain the precise address of the PDF you are trying to display.获取您尝试显示的 PDF 的准确地址。
  2. Use image widget in Slate where you specify the source as the address from #1.在 Slate 中使用image小部件,您将源指定为 #1 中的地址。

You can get 1 by looking at the address of any single file (dataset view -> details -> files).您可以通过查看任何单个文件的地址(数据集视图 -> 详细信息 -> 文件)来获得 1。 It will usually be in the shape of (...)/foundry-data-proxy/api/web/dataproxy/datasets/<dataset_rid>/transactions/<transaction_rid>/filename它通常是(...)/foundry-data-proxy/api/web/dataproxy/datasets/<dataset_rid>/transactions/<transaction_rid>/filename

I found a solution for saving files in a Palantir Foundry folder:我找到了将文件保存在 Palantir Foundry 文件夹中的解决方案:

def upload_file(token: str, target_filename: str, parent_folder_rid: str, content_type: str, raw_data) -> None:

header = {'content-type': "application/json",
          'authorization': f"Bearer {token}"}

target = urllib.parse.quote(tgt_filename, safe='')
response = requests.post(f"{blobster}salt?filename={target}&parent={parent_folder_rid}",
                         headers=header,
                         verify=True,
                         data=raw_data)
return response.json()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 通过 slate 的指南针搜索请求 - Palantir Foundry - Compass Search request through slate - Palantir Foundry 如何在 Palantir Foundry 中上传未经身份验证的数据集 - How to upload dataset without authentication in Palantir foundry 是否可以对 Palantir Foundry 中的数据集应用手动保留? - Is it possible to apply manual retention on a dataset in Palantir Foundry? 在 Palantir Foundry 中,我能否找到导致数据集中架构错误的 CSV 文件? - In Palantir Foundry, can I find which CSV file is causing schema errors in a dataset? 我们如何通过 palantir 代工厂中的 slate 集成外部 rest api 调用? - How can we integrate an external rest api call via slate in palantir foundry? 是否可以在 Palantir-Foundry 的 Slate 中定义另一个车把内的车把? - Is it possible to define a handlebars inside another handlebars in Slate within Palantir-Foundry? Palantir 铸造厂使用导入的数据集执行 nlp 操作,使用 pyspark - Palantir foundry using imported dataset to perfomr nlp operation using pyspark Palantir Foundry - 文件和文件夹名称列表 - Palantir Foundry - File and Folder names list 在 Palantir Foundry 的代码存储库中使用 PDF2Image - Using PDF2Image in Code Repository on Palantir Foundry 如何通过 API 调用获取 Palantir Foundry 中数据集的完整元数据? - How to get complete metadata of dataset in Palantir Foundry through API call?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM