Latest source merged from Syncfusion
This commit is contained in:
Родитель
032d9653d4
Коммит
26c300377c
|
@ -46,23 +46,26 @@ using Syncfusion.Pdf;
|
||||||
{% tabs %}
|
{% tabs %}
|
||||||
{% highlight C# %}
|
{% highlight C# %}
|
||||||
//Open the file as Stream
|
//Open the file as Stream
|
||||||
FileStream docStream = new FileStream("Template.docx", FileMode.Open, FileAccess.Read);
|
using (FileStream docStream = new FileStream(@"Adventure.docx", FileMode.Open, FileAccess.Read))
|
||||||
//Load file stream into Word document
|
{
|
||||||
WordDocument wordDocument = new WordDocument(docStream, Syncfusion.DocIO.FormatType.Automatic);
|
//Loads file stream into Word document
|
||||||
docStream.Dispose();
|
using (WordDocument wordDocument = new WordDocument(docStream, Syncfusion.DocIO.FormatType.Automatic))
|
||||||
//Instantiation of DocIORenderer for Word to PDF conversion
|
{
|
||||||
DocIORenderer render = new DocIORenderer();
|
//Instantiation of DocIORenderer for Word to PDF conversion
|
||||||
//Convert Word document into PDF document
|
using (DocIORenderer render = new DocIORenderer())
|
||||||
PdfDocument pdfDocument = render.ConvertToPDF(wordDocument);
|
{
|
||||||
//Release all resources used by the Word document and DocIO Renderer objects
|
//Converts Word document into PDF document
|
||||||
render.Dispose();
|
using (PdfDocument pdfDocument = render.ConvertToPDF(wordDocument))
|
||||||
wordDocument.Dispose();
|
{
|
||||||
//Saves the PDF file
|
//Saves the PDF file
|
||||||
FileStream outputStream = new FileStream("Output.pdf", FileMode.OpenOrCreate, FileAccess.ReadWrite);
|
using (FileStream outputStream = new FileStream("Output.pdf", FileMode.OpenOrCreate, FileAccess.ReadWrite))
|
||||||
pdfDocument.Save(outputStream);
|
{
|
||||||
//Close the instance of PDF document object
|
pdfDocument.Save(outputStream);
|
||||||
pdfDocument.Close();
|
}
|
||||||
outputStream.Dispose();
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
{% endtabs %}
|
{% endtabs %}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче