Expand my Community achievements bar.

html to pdf

Avatar

Level 1

I am trying to use the adobe html to pdf library and try to create a pdf file from html page using dot net core.

 

the issue I am facing while using the  library I am able to generate the pdf but the html file still in open state.

Credentials credentials = Credentials.ServicePrincipalCredentialsBuilder()
.WithClientId(clientId)
.WithClientSecret(clientSecret)
.Build();

//Create an ExecutionContext using credentials and create a new operation instance.
Adobe.PDFServicesSDK.ExecutionContext executionContext = Adobe.PDFServicesSDK.ExecutionContext.Create(credentials);
CreatePDFOperation htmlToPDFOperation = CreatePDFOperation.CreateNew();


// Set operation input from a source file.
FileRef source = FileRef.CreateFromLocalFile(filePath);

htmlToPDFOperation.SetInput(source);

// Provide any custom configuration options for the operation.
SetCustomOptions(htmlToPDFOperation);

// Execute the operation.
FileRef result = htmlToPDFOperation.Execute(executionContext);

string webRootPath = _webHostEnvironment.WebRootPath;
string folderPath = Path.Combine(webRootPath, "PDFFiles");
if (!Directory.Exists(folderPath))
{
Directory.CreateDirectory(folderPath);
}
string output = Path.Combine(folderPath, pdfName);

result.SaveAs(output);


how to end the process after pdf creation in adobe libraries

0 Replies