Skip to content

Commit c0d257d

Browse files
Merge pull request #1757 from syncfusion-content/864918_UG
864918: Update proper save method.
2 parents d25d783 + 055453f commit c0d257d

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

File-Formats/PDF/Working-with-PDF-Templates.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,6 @@ PdfTemplate template = loadedPage.CreateTemplate();
214214

215215
//Create a new PDF document.
216216
PdfDocument document = new PdfDocument();
217-
//Set the document margin.
218-
document.PageSettings.SetMargins(2);
219217
//Add the page.
220218
PdfPage page = document.Pages.Add();
221219
//Create the graphics.
@@ -225,8 +223,9 @@ graphics.DrawPdfTemplate(template, Syncfusion.Drawing.PointF.Empty, new Syncfusi
225223

226224
//Save the document into stream.
227225
MemoryStream stream = new MemoryStream();
228-
loadedDocument.Save(stream);
226+
document.Save(stream);
229227
//Close the document.
228+
document.Close(true);
230229
loadedDocument.Close(true);
231230

232231
{% endhighlight %}
@@ -242,8 +241,6 @@ PdfTemplate template = loadedPage.CreateTemplate();
242241

243242
//Create a new PDF document.
244243
PdfDocument document = new PdfDocument();
245-
//Set the document margin.
246-
document.PageSettings.SetMargins(2);
247244
//Add the page.
248245
PdfPage page = document.Pages.Add();
249246
//Create the graphics.
@@ -270,8 +267,6 @@ Dim template As PdfTemplate = loadedPage.CreateTemplate()
270267

271268
'Create a new PDF document
272269
Dim document As New PdfDocument()
273-
'Set the document margin
274-
document.PageSettings.SetMargins(2)
275270
'Add the page
276271
Dim page As PdfPage = document.Pages.Add()
277272
'Create the graphics

0 commit comments

Comments
 (0)