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);
Have something to add?