We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose Error for pdfApi.PutMergeDocuments

When I try to merge PDF documents, I get the following error even though nothing in the code references Azure Storage:

error:Error calling PutMergeDocuments: {“Code”:“errorWindowsAzureStorage”,“HttpStatusCode”:404,“Description”:“Operation Failed. Windows Azure Storage Error.”,“Message”:“Windows Azure Storage exception: The remote server returned an error: (404) Not Found.”,“Data”:{},“InnerException”:null,“StackTrace”:" at Dynabic.Storage.Managers.WindowsAzureManager.RunWindowsAzureCode[T](Func1 action)\r\n at Aspose.Pdf.Cloud.Controllers.Infrastructure.FileManagerWrapper.GetDocumentStream(String path, String fileType) in C:\\ms\\src\\Aspose.PDF.Cloud\\Controllers\\Infrastructure\\FileManagerWrapper.cs:line 119\r\n at Aspose.Pdf.Cloud.Business.DocumentCreation.DocumentCreationManagerLegacy.Merge(IFileManagerWrapper fileManager, String requestRoot, IList1 files, String outputFile, HttpContext httpContext) in C:\ms\src\Aspose.PDF.Cloud\Business\DocumentCreation\DocumentCreationManagerLegacy.cs:line 129\r\n at Aspose.Pdf.Cloud.Business.PdfDocumentManager.Merge(IFileManagerWrapper fileManager, String requestRoot, IList`1 files, String outputFile, HttpContext httpContext) in C:\ms\src\Aspose.PDF.Cloud\Business\PdfDocumentManager.cs:line 294\r\n at Aspose.Pdf.Cloud.Controllers.MergeController.PutMergeDocuments(String name, MergeDocuments mergeDocuments, String storage, String folder) in C:\ms\src\Aspose.PDF.Cloud\Controllers\MergeController.cs:line 52",“HelpLink”:null,“Source”:“Dynabic.Storage”,“HResult”:-2146233088}
at Aspose.Pdf.Cloud.Sdk.Api.PdfApi.PutMergeDocumentsWithHttpInfo(String name, MergeDocuments mergeDocuments, String storage, String folder)
at Aspose.Pdf.Cloud.Sdk.Api.PdfApi.PutMergeDocuments(String name, MergeDocuments mergeDocuments, String storage, String folder)
at Aspose.Program.Main(String[] args) in /Users/paulgilchrist/Source/aspose/Program.cs:line 67

Here is the code:

            // Upload source files to aspose cloud storage
            pdfDocuments.ForEach(document => {
                // Remove file path
                document = document.Replace(convertedPath,"");
                Console.WriteLine($"PDF merge of file {document}");
                pdfApi.UploadFile(document,File.OpenRead(convertedPath + document),storage);
            });
            // Invoke Aspose.PDF Cloud SDK API to merge pdf files
            var documentResponse = pdfApi.PutMergeDocuments(outputDocumentName,mergeDocuments,storage);  //  Sometimes returns Azure Storage 404 error but why?  
            if(documentResponse != null && documentResponse.Status.Equals("OK")) {
                var bookUrl = documentResponse.Document.Links[0].Href.ToString();
                var bookStream = pdfApi.DownloadFile(bookUrl);
                using(Stream outStream = File.OpenWrite(outputPath + outputDocumentName)) {
                    bookStream.CopyTo(outStream);
                }
                Console.WriteLine("Merge Multiple PDF Files, Done!");
            }

The error occurs on the line pdfApi.PutMergeDocuments

This topic has been moved to the related forum: https://forum.aspose.cloud/t/aspose-error-for-pdfapi-putmergedocuments/8966