C# 如何使用aspose.cloud服务将PDF文件转换为docx?
我正在尝试使用C# 如何使用aspose.cloud服务将PDF文件转换为docx?,c#,azure,pdf,aspose,pdf-conversion,C#,Azure,Pdf,Aspose,Pdf Conversion,我正在尝试使用Aspose.Cloud将.pdf文件转换为.docx 它可以很容易地将word或text等其他格式转换为PDF,但我在将.PDF文件转换为任何其他格式时遇到困难 我还尝试了Aspose.Pdf服务,但这只允许您转换到物理路径(D/myfile.Pdf)。我希望能够在存储本身(azure blob)中实现这一点,即从一个容器(pdfcontainer)中选择一个文件--转换为docx--存储到doccontainer 我尝试了PDFService类公开的ConvertDocumen
Aspose.Cloud
将.pdf
文件转换为.docx
它可以很容易地将word或text等其他格式转换为PDF,但我在将.PDF文件转换为任何其他格式时遇到困难
我还尝试了Aspose.Pdf
服务,但这只允许您转换到物理路径(D/myfile.Pdf
)。我希望能够在存储本身(azure blob)中实现这一点,即从一个容器(pdfcontainer)中选择一个文件--转换为docx--存储到doccontainer
我尝试了PDFService
类公开的ConvertDocument
和ConvertToSomeFormat
方法。我还使用words服务
类的ConvertDocument
方法将doc、txt等其他格式的文档转换为PDF,这样可以成功地将文档转换并保存。但是ConvertToSomeFormat
不会将文件保存到指定的容器中。我在尝试检索文件时遇到“404未找到”错误
将docx/txt转换为PDF-这很有效强>
WordsService wordService = new WordsService("myAppId", "myAppKey");
wordsService.ConvertDocument(convertFromFile, WordOutputFormat.Pdf, convertFromContainer, convertToContainer + "/" + targetFilename, asposeStorageName);
PDFService pdfService = new PDFService("myAppId", "myAppKey");
pdfService.ConvertToSomeFormat(convertFromFile, PDFDocumentConvertFormat.Doc, convertToContainer, convertToContainer + "/" + targetFilename, asposeStorageName);
将PDF转换为docx-不起作用强>
WordsService wordService = new WordsService("myAppId", "myAppKey");
wordsService.ConvertDocument(convertFromFile, WordOutputFormat.Pdf, convertFromContainer, convertToContainer + "/" + targetFilename, asposeStorageName);
PDFService pdfService = new PDFService("myAppId", "myAppKey");
pdfService.ConvertToSomeFormat(convertFromFile, PDFDocumentConvertFormat.Doc, convertToContainer, convertToContainer + "/" + targetFilename, asposeStorageName);
您不应在公共论坛中共享应用程序SID或密钥。请共享您迄今为止所做的工作以及您遇到的任何错误。@GauravMantri-我已尝试过PDFService类公开的ConvertDocument和ConvertToSomeFormat方法。我还使用WordsService类的ConvertDocument方法将其他格式的文档(如doc、txt)转换为pdf,这将转换文档并成功保存。但是ConvertToSomeFormat不会将文件保存到指定的容器中。我在尝试检索文件时遇到404 not found错误。请使用这些详细信息更新您的问题,并共享代码。注释中的内容往往会丢失:)。如果您在Azure Blob存储中存储的文件上获得404,请检查容器上的ACL。应将其设置为
Blob
或Off
。如果它是Private
,则会出现404错误。它实际上不会将文件转换并保存为blob。如果我正在将docx转换为pdf,则可以正常工作,但反过来就不行了。很抱歉造成混淆。谢谢您的回复。有没有一种方法可以在REST调用中将azure存储路径指定为输出路径,以便首先直接存储文件,然后检索以供下载?我这样做是为了避免每次用户尝试下载时都必须转换文件。到目前为止,我正在返回流,然后对存储进行另一次调用以保存它,但我希望在转换调用本身中处理这个问题。这有意义吗?