SignatureApiController → PreviewOption is not working.
GroupDocs.Signature supports .NET Core. Please share following details and we’ll look into this matter:
- GroupDocs.Signature API version that you are using
- Sample code/application
Can you please share sample code for .NET core?
I did not find in git repository.
It’d be great if you could share a sample application with us. Also specify the API version that you are using.
@sulk
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): SIGNATURENET-4883
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
The problem is caused by using lambda expression instead of preview saving method. During performing of GeneratePreview
method firstly we call delegate to save result to stream, and secondly we call stream release delegate to dispose it by default. Disposed stream couldn’t be used anymore.
So, for your case it is better to provide empty release method to avoid stream disposing.
Please, use example like this:
private static MemoryStream RenderPageToMemoryStream(GroupDocs.Signature.Signature signature, int pageNumberToRender)
{
// Initialize a MemoryStream to store the rendered page
MemoryStream result = new MemoryStream();
// Configure preview options for rendering a specific page to PNG format
PreviewOptions previewOptions = new PreviewOptions(pageNumber => result, ReleasePageStream)
{
PreviewFormat = PreviewOptions.PreviewFormats.PNG,
PageNumbers = new[] { pageNumberToRender },
};
// Generate a preview of the specified page
signature.GeneratePreview(previewOptions);
// Return the rendered page as a MemoryStream
return result;
}
private static void ReleasePageStream(int pageNumber, Stream pageStream)
{
// Your code implementation for releasing page stream
// This method can contain logic for releasing resources or handling the page stream
// Not implemented in this example
}