Good day,
how is it possible to create the pdf thumbnail images in background without blocking the whole application?
I am generating a list of thumbnails of the 1st page of many PDFS, which results in the application UI beeing blocked.
This is what I am doing:
public ImageSource ConvertPdfToImageThumbnail(string filePath) { var tf = new ThumbnailFactory(); using Stream stream = File.Open(filePath, FileMode.Open); var formatProvider = new PdfFormatProvider(); RadFixedDocument document = formatProvider.Import(stream); if (document.Pages.Count > 0) { ImageSource result = tf.CreateThumbnail(document.Pages[0], document.Pages[0].Size); return result; } return null; }
The function is not doing anything on the UI, just loading a PDF and creating the ImageSource.
When called from a different Thread, the line
"ImageSource result = tf.CreateThumbnail(document.Pages[0], document.Pages[0].Size);"
is throwing this error: "the calling thread must be STA ..."
How can this task be done without blocking the UI?
Thank you for your support!
