我收到了一项任务,看看我是否可以制作强大的应用程序来生成一些 PDF 文件供最终用户查看。经过对这个主题的研究后,我发现这并不容易实现:)为了使 power app 生成并下载/显示生成的 pdf,我执行了以下步骤:
由于电源应用程序的限制(或者我只是找不到方法),我无法从电源应用程序内部的响应中获取pdf。之后,我更改了 Azure 函数以创建新的 blob 条目,但我知道在 Azure 函数内获取该新条目的 URL 时遇到问题,以便将其返回到电源应用程序,然后使用电源应用程序内部的下载功能
我的Azure功能代码如下
using System;
using System.Net;
using System.Net.Http.Headers;
using System.Runtime.InteropServices;
using Aspose.Words;
public static async Task<HttpResponseMessage> Run(HttpRequestMessage req, TraceWriter log, Stream outputBlob)
{
log.Info($"C# HTTP trigger function processed a request. RequestUri={req.RequestUri}");
var dataDir = @"D:/home";
var docFile = $"{dataDir}/word-templates/WordAutomationTest.docx";
var uid = Guid.NewGuid().ToString().Replace("-", "");
var pdfFile = $"{dataDir}/pdf-export/WordAutomationTest_{uid}.pdf";
var doc = new Document(docFile); …
Run Code Online (Sandbox Code Playgroud)