Skip to main content
Participant
July 25, 2023
Question

unable to delete the source file after using this method FileRef.CreateFromLocalFile(filePath)

  • July 25, 2023
  • 1 reply
  • 234 views

I try to convert Html to Pdf using Adobe.PDFServicesSDK, the Pdf is got generated but, when I try to delete the html file its showing like it's opened in another process.
FileRef source = FileRef.CreateFromLocalFile(filePath);
the above method is not disposing. and how to delete the filePath.

below I added the code I got from the Adob github page.
please help me to resolve this issue. 

 

 

Credentials credentials = Credentials.ServicePrincipalCredentialsBuilder()
.WithClientId("#")
.WithClientSecret("#)
.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);
String outputFilePath = CreateOutputFilePath();

result.SaveAs(outputFilePath);
return outputFilePath;





This topic has been closed for replies.

1 reply

Bernd Alheit
Community Expert
Community Expert
July 25, 2023

Try the forum for this services.