Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,11 @@ using (FileStream fileStreamInput = new FileStream("Template.pptx", FileMode.Ope
{
//Use a sets of default FallbackFont collection to IPresentation.
pptxDoc.FontSettings.FallbackFonts.InitializeDefault();
//Create the MemoryStream to save the converted PDF.
using (MemoryStream pdfStream = new MemoryStream())
//Convert the PowerPoint document to PDF document.
using (PdfDocument pdfDocument = PresentationToPdfConverter.Convert(pptxDoc))
{
//Convert the PowerPoint document to PDF document.
using (PdfDocument pdfDocument = PresentationToPdfConverter.Convert(pptxDoc))
{
//Save the converted PDF document to MemoryStream.
pdfDocument.Save(pdfStream);
pdfStream.Position = 0;
}
//Create the output PDF file stream.
using (FileStream fileStreamOutput = File.Create("Output.pdf"))
{
//Copy the converted PDF stream into created output PDF stream.
pdfStream.CopyTo(fileStreamOutput);
}
//Save the converted PDF document.
pdfDocument.Save("Output.pdf");
}
}
}
Expand Down Expand Up @@ -123,22 +112,11 @@ using (FileStream fileStreamInput = new FileStream("Template.pptx", FileMode.Ope
pptxDoc.FontSettings.FallbackFonts.Add(ScriptType.Thai, "Tahoma, Microsoft Sans Serif");
//Adds fallback font for "Korean" script type.
pptxDoc.FontSettings.FallbackFonts.Add(ScriptType.Korean, "Malgun Gothic, Batang");
//Create the MemoryStream to save the converted PDF.
using (MemoryStream pdfStream = new MemoryStream())
//Convert the PowerPoint document to PDF document.
using (PdfDocument pdfDocument = PresentationToPdfConverter.Convert(pptxDoc))
{
//Convert the PowerPoint document to PDF document.
using (PdfDocument pdfDocument = PresentationToPdfConverter.Convert(pptxDoc))
{
//Save the converted PDF document to MemoryStream.
pdfDocument.Save(pdfStream);
pdfStream.Position = 0;
}
//Create the output PDF file stream.
using (FileStream fileStreamOutput = File.Create("Output.pdf"))
{
//Copy the converted PDF stream into created output PDF stream.
pdfStream.CopyTo(fileStreamOutput);
}
//Save the converted PDF document.
pdfDocument.Save("Output.pdf");
}
}
}
Expand Down Expand Up @@ -238,22 +216,11 @@ using (FileStream fileStreamInput = new FileStream("Template.pptx", FileMode.Ope
pptxDoc.FontSettings.FallbackFonts.Add(new FallbackFont(0x3040, 0x309F, "MS Mincho"));
// Korean.
pptxDoc.FontSettings.FallbackFonts.Add(new FallbackFont(0xAC00, 0xD7A3, "Malgun Gothic"));
//Create the MemoryStream to save the converted PDF.
using (MemoryStream pdfStream = new MemoryStream())
//Convert the PowerPoint document to PDF document.
using (PdfDocument pdfDocument = PresentationToPdfConverter.Convert(pptxDoc))
{
//Convert the PowerPoint document to PDF document.
using (PdfDocument pdfDocument = PresentationToPdfConverter.Convert(pptxDoc))
{
//Save the converted PDF document to MemoryStream.
pdfDocument.Save(pdfStream);
pdfStream.Position = 0;
}
//Create the output PDF file stream.
using (FileStream fileStreamOutput = File.Create("Output.pdf"))
{
//Copy the converted PDF stream into created output PDF stream.
pdfStream.CopyTo(fileStreamOutput);
}
//Save the converted PDF document.
pdfDocument.Save("Output.pdf");
}
}
}
Expand Down Expand Up @@ -346,22 +313,11 @@ using (FileStream fileStreamInput = new FileStream("Template.pptx", FileMode.Ope
if (fallbackFont.ScriptType == ScriptType.Hebrew)
fallbackFont.FontNames = "David";
}
//Create the MemoryStream to save the converted PDF.
using (MemoryStream pdfStream = new MemoryStream())
//Convert the PowerPoint document to PDF document.
using (PdfDocument pdfDocument = PresentationToPdfConverter.Convert(pptxDoc))
{
//Convert the PowerPoint document to PDF document.
using (PdfDocument pdfDocument = PresentationToPdfConverter.Convert(pptxDoc))
{
//Save the converted PDF document to MemoryStream.
pdfDocument.Save(pdfStream);
pdfStream.Position = 0;
}
//Create the output PDF file stream.
using (FileStream fileStreamOutput = File.Create("Output.pdf"))
{
//Copy the converted PDF stream into created output PDF stream.
pdfStream.CopyTo(fileStreamOutput);
}
//Save the converted PDF document.
pdfDocument.Save("Output.pdf");
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,8 @@ using (FileStream fileStream = new FileStream("Sample.pptx", FileMode.Create))
pptxDoc.FontSettings.SubstituteFont += SubstituteFont;
//Convert the PowerPoint presentation to PDF file
PdfDocument pdfDocument = PresentationToPdfConverter.Convert(pptxDoc);
//Create new instance of file stream
FileStream pdfStream = new FileStream("Output.pdf", FileMode.Create);
//Save the generated PDF to file stream
pdfDocument.Save(pdfStream);
//Release all resources
pdfStream.Dispose();
//Save the PDF file.
pdfDocument.Save("Output.pdf");
pdfDocument.Close(true);
}
}
Expand Down Expand Up @@ -135,12 +131,9 @@ using (FileStream fileStream = new FileStream("Sample.pptx", FileMode.Create))
pptxDoc.FontSettings.SubstituteFont += SubstituteFont;
//Convert the PowerPoint presentation to PDF file
PdfDocument pdfDocument = PresentationToPdfConverter.Convert(pptxDoc);
//Create new instance of file stream
FileStream pdfStream = new FileStream("Output.pdf", FileMode.Create);
//Save the generated PDF to file stream
pdfDocument.Save(pdfStream);
//Release all resources
pdfStream.Dispose();
//Save the PDF file.
pdfDocument.Save("Output.pdf");
// Close the PDF Document
pdfDocument.Close(true);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,7 @@ using (FileStream fileStreamInput = new FileStream("Template.pptx", FileMode.Ope
using (PdfDocument pdfDocument = PresentationToPdfConverter.Convert(pptxDoc))
{
//Save the PDF file to file system.
using (FileStream outputStream = new FileStream("PPTXToPDF.pdf", FileMode.Create, FileAccess.ReadWrite))
{
pdfDocument.Save(outputStream);
}
pdfDocument.Save("PPTXToPDF.pdf");
}
}
}
Expand Down Expand Up @@ -160,11 +157,7 @@ using (FileStream pptStream = new FileStream("Template.pptx", FileMode.Open, Fil
if (!PresentationToPdfConverter.IsCanceled)
{
//Saves the PDF file
using (FileStream outputStream = new FileStream("Output.pdf", FileMode.OpenOrCreate, FileAccess.ReadWrite))
{
pdfDocument.Save(outputStream);
outputStream.Position = 0;
}
pdfDocument.Save("Output.pdf");
}
else
{
Expand Down Expand Up @@ -481,12 +474,8 @@ using (FileStream fileStreamInput = new FileStream("Sample.pptx", FileMode.Open,
//Convert the PowerPoint document to a PDF document.
using (PdfDocument pdfDocument = PresentationToPdfConverter.Convert(pptxDoc, pdfConverterSettings))
{
//Save the converted PDF document to the fileStream.
using (FileStream fileStreamOutput = File.Create("Sample.pdf"))
{
pdfDocument.Save(fileStreamOutput);
fileStreamOutput.Position = 0;
}
//Save the converted PDF document.
pdfDocument.Save("Sample.pdf");
}
}
}
Expand Down Expand Up @@ -555,10 +544,7 @@ using (FileStream fileStream = new FileStream(Path.GetFullPath(@"Data/Template.p
using (PdfDocument pdfDocument = PresentationToPdfConverter.Convert(pptxDoc))
{
//Save the PDF file to file system.
using (FileStream outputStream = new FileStream(Path.GetFullPath(@"Output/PPTXToPDF.pdf"), FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite))
{
pdfDocument.Save(outputStream);
}
pdfDocument.Save("Output.pdf");
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,7 @@ using (FileStream fileStreamInput = new FileStream("Template.pptx", FileMode.Ope
using (PdfDocument pdfDocument = PresentationToPdfConverter.Convert(pptxDoc))
{
//Save the PDF file to file system.
using (FileStream outputStream = new FileStream("PPTXToPDF.pdf", FileMode.Create, FileAccess.ReadWrite))
{
pdfDocument.Save(outputStream);
}
pdfDocument.Save("PPTXToPDF.pdf");
}
}
}
Expand Down Expand Up @@ -160,11 +157,7 @@ using (FileStream pptStream = new FileStream("Template.pptx", FileMode.Open, Fil
if (!PresentationToPdfConverter.IsCanceled)
{
//Saves the PDF file
using (FileStream outputStream = new FileStream("Output.pdf", FileMode.OpenOrCreate, FileAccess.ReadWrite))
{
pdfDocument.Save(outputStream);
outputStream.Position = 0;
}
pdfDocument.Save("Output.pdf");
}
else
{
Expand Down Expand Up @@ -482,11 +475,7 @@ using (FileStream fileStreamInput = new FileStream("Sample.pptx", FileMode.Open,
using (PdfDocument pdfDocument = PresentationToPdfConverter.Convert(pptxDoc, pdfConverterSettings))
{
//Save the converted PDF document to the fileStream.
using (FileStream fileStreamOutput = File.Create("Sample.pdf"))
{
pdfDocument.Save(fileStreamOutput);
fileStreamOutput.Position = 0;
}
pdfDocument.Save("Sample.pdf");
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,8 @@ using (IPresentation pptxDoc = Presentation.Open(fileStreamPath))
chartArea.Fill.BackColor = Syncfusion.Drawing.Color.FromArgb(205, 217, 234);
chartArea.Fill.ForeColor = Syncfusion.Drawing.Color.White;

using (FileStream outputStream = new FileStream("Result.pptx", FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite))
{
//Save the PowerPoint Presentation.
pptxDoc.Save(outputStream);
}
//Save the PowerPoint Presentation.
pptxDoc.Save("Result.pptx");
}

{% endhighlight %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -496,11 +496,8 @@ using (IPresentation pptxDoc = Presentation.Open(fileStreamPath))
//Showing minor gridlines.
chart.PrimaryValueAxis.HasMinorGridLines = false;

using (FileStream outputStream = new FileStream("Result.pptx", FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite))
{
//Save the PowerPoint Presentation.
pptxDoc.Save(outputStream);
}
//Save the PowerPoint Presentation.
pptxDoc.Save("Result.pptx");
}

{% endhighlight %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,9 @@ using (IPresentation pptxDoc = Presentation.Open(fileStreamPath))
// Set the position of data labels for the first series.
chart.Series[i].DataPoints.DefaultDataPoint.DataLabels.Position = OfficeDataLabelPosition.Center;
}
using (FileStream outputStream = new FileStream("Result.pptx", FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite))
{
//Save the PowerPoint Presentation.
pptxDoc.Save(outputStream);
}

//Save the PowerPoint Presentation.
pptxDoc.Save("Result.pptx");
}

{% endhighlight %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,11 +353,8 @@ The complete code snippet illustrating the above options is shown below.
//Legend without overlapping the chart.
chart.Legend.IncludeInLayout = true;

using (FileStream outputStream = new FileStream("Result.pptx", FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite))
{
//Save the PowerPoint Presentation.
pptxDoc.Save(outputStream);
}
//Save the PowerPoint Presentation.
pptxDoc.Save("Result.pptx");
}

{% endhighlight %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,8 @@ using (IPresentation pptxDoc = Presentation.Open(fileStreamPath))
chartPlotArea.Fill.BackColor = Syncfusion.Drawing.Color.FromArgb(205, 217, 234);
chartPlotArea.Fill.ForeColor = Syncfusion.Drawing.Color.White;

using (FileStream outputStream = new FileStream("Result.pptx", FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite))
{
//Save the PowerPoint Presentation.
pptxDoc.Save(outputStream);
}
//Save the PowerPoint Presentation.
pptxDoc.Save("Result.pptx");
}

{% endhighlight %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,8 @@ The complete code snippet illustrating the above options is shown below.
//Sets position of legend.
chart.Legend.Position = OfficeLegendPosition.Bottom;

using (FileStream outputStream = new FileStream("Result.pptx", FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite))
{
//Save the PowerPoint Presentation.
pptxDoc.Save(outputStream);
}
//Save the PowerPoint Presentation.
pptxDoc.Save("Result.pptx");
}

{% endhighlight %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,9 @@ The complete code snippet illustrating the above options is shown below.
//Enable legend.
chart.HasLegend = true;
chart.Legend.Position = OfficeLegendPosition.Right;

using (FileStream outputStream = new FileStream("Result.pptx", FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite))
{
//Save the PowerPoint Presentation.
pptxDoc.Save(outputStream);
}

//Save the PowerPoint Presentation.
pptxDoc.Save("Result.pptx");
}

{% endhighlight %}
Expand Down
Loading