1
.NET / Previews or Thumbnails
« Last post by cmwade77 on Today at 02:40:45 PM »I am trying to extract a preview or thumbnail from drawings without opening them, I have code that does well if the thumbnail is saved (i.e. it shows up in Windows Explorer), but if it isn't saved, it doesn't show up.
Yet, it sheet set manager, a preview can be shown just fine for the same drawing, so there has to be something that I am missing here. Here is my code as it stands:
Any ideas would be greatly appreciated.
Yet, it sheet set manager, a preview can be shown just fine for the same drawing, so there has to be something that I am missing here. Here is my code as it stands:
Code - C#: [Select]
- public static Bitmap? Thumbnail(this string drawingFilePath)
- {
- try
- {
- {
- db.ReadDwgFile(drawingFilePath, FileOpenMode.OpenForReadAndAllShare, true, null);
- Bitmap? thumbnail = db.ThumbnailBitmap;
- if (thumbnail == null)
- {
- return PlaceholderThumbnail();
- }
- return thumbnail;
- }
- }
- catch (System.Exception ex)
- {
- Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage($"\nError extracting thumbnail: {ex.Message}");
- return null;
- }
- }
Any ideas would be greatly appreciated.