---
# System prepended metadata

title: Aspose

---

# Aspose

## Convert Image -> Text

```csharp
// Initialize an instance of OcrEngine
OcrEngine ocrEngine = new OcrEngine();

// Set the Image property by loading the image from file path location or an instance of MemoryStream 
ocrEngine.Image = ImageStream.FromFile(dataDir + "Sampleocr.bmp");

// Process the image
if (ocrEngine.Process())
{
    // Display the recognized text
    Console.WriteLine(ocrEngine.Text);
}
```

## Convert PDF -> Text

```csharp
// Open document
Document pdfDocument = new Document(dataDir + "ExtractTextAll.pdf");

// Create TextAbsorber object to extract text
TextAbsorber textAbsorber = new TextAbsorber();
// Accept the absorber for all the pages
pdfDocument.Pages.Accept(textAbsorber);
// Get the extracted text
string extractedText = textAbsorber.Text;
```

## Convert Word -> Text

```csharp
Stream stream = new FileStream(MyDir + "Bookmark.docx", FileMode.Open);
PlainTextDocument plaintext = new PlainTextDocument(stream);
Console.WriteLine(plaintext.Text;
```

## Hent vedhæftede filer fra e-mail

```csharp
// For complete examples and data files, please go to https://github.com/aspose-email/Aspose.Email-for-.NET
// The path to the File directory.
string dataDir = RunExamples.GetDataDir_Email();

// Create an instance of MailMessage and load an email file
MailMessage mailMsg = MailMessage.Load(dataDir + "Message.msg", new MsgLoadOptions());

foreach (Attachment attachment in mailMsg.Attachments)
{
    // To display the the attachment file name
    attachment.Save(dataDir + "MessageEmbedded_out.msg");

    Console.WriteLine(attachment.Name);
}
```