Get connection was cloesed error during PDF merge at deployed WCF service

New Here ,
Apr 01, 2021 Apr 01, 2021

Copy link to clipboard

Copied

HI, 

 

I am using Adobe tools api for combining PDFs to single file. The code is very stragihgt forward. 

 

It is a .NET wcf web service. however, I got the following error. 

 

Response received from the request: The underlying connection was closed: An unexpected error occurred on a send. 

Any idea?


Thanks. 

 

 

Here is the code:

  Credentials credentials = Credentials.ServiceAccountCredentialsBuilder()

                               .FromFile(adobelicen + "/pdftools-api-credentials.json")

                               .Build();

                    ExecutionContext executionContext = ExecutionContext.Create(credentials);

                    CombineFilesOperation combineFilesOperation = CombineFilesOperation.CreateNew();

 

                    String[] files = source.Split(',');

 

 

                    FileRef firstFileToCombine = FileRef.CreateFromLocalFile(files[0]);

                    PageRanges pageRangesForFirstFile = GetPageRangeForPDF();

 

                    // Add the first file as input to the operation, along with its page range.

                    combineFilesOperation.AddInput(firstFileToCombine);

                    //combineFilesOperation.AddInput(firstFileToCombine, pageRangesForFirstFile);

 

                    // Create a second FileRef instance using a local file.

                    FileRef secondFileToCombine = FileRef.CreateFromLocalFile(files[1]);

                    PageRanges pageRangesForSecondFile = GetPageRangeForPDF();

 

                    combineFilesOperation.AddInput(secondFileToCombine);

 

                    /*FileRef thridFileToCombine = FileRef.CreateFromLocalFile(@"aerial.pdf");

                    combineFilesOperation.AddInput(thridFileToCombine);*/

 

 

                    // Execute the operation.

                    FileRef result = combineFilesOperation.Execute(executionContext);

 

                    // Save the result to the specified location.

                    result.SaveAs(output);

 

 

 

Views

28

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
no replies

Have something to add?

Join the conversation