I’m not sure if “Metadata” is the proper thread to post my question, sorry and please move it to place where it must be if it’s not already.
I already purchased GroupDocs Total. For the first step, I want to have a thumbnail image of document. If it is a PDF or Doc(x), I need the first page to be in thumbnail. If it is a jpg, bmp, png etc I need a small-size low-resolution version of it.
Thank you for giving a try to the new GroupDocs API's.
GroupDocs.Conversion API for .NET have features to achieve this, It converts any file to desired output format, please have a look at this sample code.
// Convert and save converted image file.
// Returns paths to the converted image file.
var saveOptions = new ImageSaveOptions
ConvertFileType = ImageSaveOptions.ImageFileType.Jpg,
OutputType = OutputType.String,
Dpi = 600,
NumPagesToConvert = 1,
PageNumber = 1,
Width = 120,
Height = 120
var convertedDocumentPath = conversionHandler.Convert<IList>("DOCXsample.docx", saveOptions);
Please find below some resources to quickly get started with GroupDocs.Conversion API.
- GroupDocs.Conversion Downloads: http://groupdocs.com/Community/getting-started/dot-net/document-conversion-library.aspx
- GroupDocs.Conversion Docs: http://groupdocs.com/docs/display/conversionnet/Programmers+Guide
- GroupDocs.Conversion Examples: https://github.com/groupdocsConversion/GroupDocs_Conversion_NET
- GroupDocs.Conversion Videos: https://www.youtube.com/channel/UCNHpIBspxU4tXrOmpsYUXKQ
If you will need any help or you will have any other questions please feel free to ask.
Thank you for the solution. It is awesome.
However, I wanted to store the output in memory not in a file. So I created class InMem implementing IOutputDataHandler and passed an instance of it to an instance of ConversionHandler:
class InMem : IOutputDataHandler
// Problem: stream is disposed
But as shown, the received stream is disposed. Can I do anything?
Oops! Sorry, there was a better way:
Setting OutputType to OutputType.Stream in ImageSaveOptions.
If you will need any help or you will have any other questions please feel free to ask.<o:p></o:p>