ConverterContext
Contents
[
Hide
]ConverterContext class
Document converter context
public class ConverterContext : ProcessorContext
Constructors
Name | Description |
---|---|
ConverterContext() | The default constructor. |
Properties
Name | Description |
---|---|
FontSettings { get; set; } | Font settings used by the processor. |
LayoutOptions { get; } | Document layout options used by the processor. |
WarningCallback { get; set; } | Warning callback used by the processor. |
Examples
Shows how to convert documents with a single line of code using context.
string doc = MyDir + "Big document.docx";
Converter.Create(new ConverterContext())
.From(doc)
.To(ArtifactsDir + "LowCode.ConvertContext.1.pdf")
.Execute();
Converter.Create(new ConverterContext())
.From(doc)
.To(ArtifactsDir + "LowCode.ConvertContext.2.pdf", SaveFormat.Rtf)
.Execute();
OoxmlSaveOptions saveOptions = new OoxmlSaveOptions { Password = "Aspose.Words" };
LoadOptions loadOptions = new LoadOptions() { IgnoreOleData = true };
Converter.Create(new ConverterContext())
.From(doc, loadOptions)
.To(ArtifactsDir + "LowCode.ConvertContext.3.docx", saveOptions)
.Execute();
Converter.Create(new ConverterContext())
.From(doc)
.To(ArtifactsDir + "LowCode.ConvertContext.4.png", new ImageSaveOptions(SaveFormat.Png))
.Execute();
Shows how to convert documents from a stream with a single line of code using context.
string doc = MyDir + "Document.docx";
using (FileStream streamIn = new FileStream(MyDir + "Big document.docx", FileMode.Open, FileAccess.Read))
{
using (FileStream streamOut = new FileStream(ArtifactsDir + "LowCode.ConvertContextStream.1.docx", FileMode.Create, FileAccess.ReadWrite))
Converter.Create(new ConverterContext())
.From(streamIn)
.To(streamOut, SaveFormat.Rtf)
.Execute();
OoxmlSaveOptions saveOptions = new OoxmlSaveOptions { Password = "Aspose.Words" };
LoadOptions loadOptions = new LoadOptions() { IgnoreOleData = true };
using (FileStream streamOut = new FileStream(ArtifactsDir + "LowCode.ConvertContextStream.2.docx", FileMode.Create, FileAccess.ReadWrite))
Converter.Create(new ConverterContext())
.From(streamIn, loadOptions)
.To(streamOut, saveOptions)
.Execute();
List<Stream> pages = new List<Stream>();
Converter.Create(new ConverterContext())
.From(doc)
.To(pages, new ImageSaveOptions(SaveFormat.Png))
.Execute();
}
See Also
- class ProcessorContext
- namespace Aspose.Words.LowCode
- assembly Aspose.Words