Enum PdfTransitionStyle
Enumeration of possible transition styles when moving to the page from another during a presentation
Namespace: Syncfusion.Pdf
Assembly: Syncfusion.Pdf.Base.dll
Syntax
public enum PdfTransitionStyle
Examples
//Create a new document.
PdfDocument document = new PdfDocument();
//Declare new Pdf Page.
PdfPage page;
//Declare new PdfSection.
PdfSection section;
//Create few sections with one page in each.
for (int i = 0; i != 4; i++)
{
// Add new PdfSection.
section = document.Sections.Add();
// Create page label.
PdfPageLabel label = new PdfPageLabel();
label.Prefix = "Sec" + i + "-";
section.PageLabel = label;
// Add new page to section.
page = section.Pages.Add();
section.Pages[0].Graphics.SetTransparency(0.35f);
// Set page display duration.
section.PageSettings.Transition.PageDuration = 1;
// Set transition effect duration.
section.PageSettings.Transition.Duration = 1;
// Set transition style.
section.PageSettings.Transition.Style = PdfTransitionStyle.Box;
}
//Set page size.
document.PageSettings.Size = PdfPageSize.A6;
//Set viewer prefernce.
document.ViewerPreferences.HideToolbar = true;
//Set page mode.
document.ViewerPreferences.PageMode = PdfPageMode.FullScreen;
//Set page orientation.
document.PageSettings.Orientation = PdfPageOrientation.Landscape;
//Create a brush.
PdfSolidBrush brush = new PdfSolidBrush(System.Drawing.Color.Black);
brush.Color = new PdfColor(System.Drawing.Color.LightGreen);
//Create a Rectangle.
PdfRectangle rect = new PdfRectangle(0, 0, 1000f, 1000f);
rect.Brush = brush;
//Create a pen.
PdfPen pen = new PdfPen(System.Drawing.Color.Black);
pen.Width = 6f;
//Get the first page in first section.
page = document.Sections[0].Pages[0];
//Draw the rectangle.
rect.Draw(page.Graphics);
//Draw a line.
page.Graphics.DrawLine(pen, 0, 100, 300, 100);
// Add margins.
document.PageSettings.SetMargins(0f);
//Get the first page in second section.
page = document.Sections[1].Pages[0];
//Set page rotation angle.
document.Sections[1].PageSettings.Rotate = PdfPageRotateAngle.RotateAngle90;
rect.Draw(page.Graphics);
//Draw a line.
page.Graphics.DrawLine(pen, 0, 100, 300, 100);
//Change the angle f the section. This should rotate the previous page.
document.Sections[2].PageSettings.Rotate = PdfPageRotateAngle.RotateAngle180;
//Get section with specified index.
page = document.Sections[2].Pages[0];
rect.Draw(page.Graphics);
page.Graphics.DrawLine(pen, 0, 100, 300, 100);
section = document.Sections[3];
section.PageSettings.Orientation = PdfPageOrientation.Portrait;
page = section.Pages[0];
rect.Draw(page.Graphics);
page.Graphics.DrawLine(pen, 0, 100, 300, 100);
//Set the font
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 16f);
PdfSolidBrush fieldBrush = new PdfSolidBrush(System.Drawing.Color.Black);
//Create page number field
PdfPageNumberField pageNumber = new PdfPageNumberField(font, fieldBrush);
//Create page count field
PdfPageCountField count = new PdfPageCountField(font, fieldBrush);
//Draw page template
PdfPageTemplateElement templateElement = new PdfPageTemplateElement(400, 400);
templateElement.Graphics.DrawString("Page :\tof", font, PdfBrushes.Black, new PointF(260, 200));
//Draw current page number
pageNumber.Draw(templateElement.Graphics, new PointF(306, 200));
//Draw number of pages
count.Draw(templateElement.Graphics, new PointF(345, 200));
document.Template.Stamps.Add(templateElement);
templateElement.Background = true;
//Save the document.
document.Save("output.pdf");
//Close the document.
document.Close(true);
'Create a new document.
Dim document As PdfDocument = New PdfDocument()
'Declare new Pdf Page.
Dim page As PdfPage
'Declare new PdfSection.
Dim section As PdfSection
'Create few sections with one page in each.
For i As Integer = 0 To 3
' Add new PdfSection.
section = document.Sections.Add()
' Create page label.
Dim label As New PdfPageLabel()
label.Prefix = "Sec" + i + "-"
section.PageLabel = label
' Add new page to section.
page = section.Pages.Add()
section.Pages(0).Graphics.SetTransparency(0.35F)
' Set page display duration.
section.PageSettings.Transition.PageDuration = 1
' Set transition effect duration.
section.PageSettings.Transition.Duration = 1
' Set transition style.
section.PageSettings.Transition.Style = PdfTransitionStyle.Box
i += 1
Next
document.PageSettings.Size = PdfPageSize.A6
document.ViewerPreferences.HideToolbar = True
document.ViewerPreferences.PageMode = PdfPageMode.FullScreen
document.PageSettings.Orientation = PdfPageOrientation.Landscape
Dim brush As PdfSolidBrush = New PdfSolidBrush(System.Drawing.Color.Black)
brush.Color = New PdfColor(System.Drawing.Color.LightGreen)
Dim rect As PdfRectangle = New PdfRectangle(0, 0, 1000.0F, 1000.0F)
rect.Brush = brush
Dim pen As PdfPen = New PdfPen(System.Drawing.Color.Black)
pen.Width = 6.0F
page = document.Sections(0).Pages(0)
rect.Draw(page.Graphics)
page.Graphics.DrawLine(pen, 0, 100, 300, 100)
document.PageSettings.SetMargins(0F)
page = document.Sections(1).Pages(0)
document.Sections(1).PageSettings.Rotate = PdfPageRotateAngle.RotateAngle90
rect.Draw(page.Graphics)
page.Graphics.DrawLine(pen, 0, 100, 300, 100)
document.Sections(2).PageSettings.Rotate = PdfPageRotateAngle.RotateAngle180
page = document.Sections(2).Pages(0)
rect.Draw(page.Graphics)
page.Graphics.DrawLine(pen, 0, 100, 300, 100)
section = document.Sections(3)
section.PageSettings.Orientation = PdfPageOrientation.Portrait
page = section.Pages(0)
rect.Draw(page.Graphics)
page.Graphics.DrawLine(pen, 0, 100, 300, 100)
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 16.0F)
Dim fieldBrush As PdfSolidBrush = New PdfSolidBrush(System.Drawing.Color.Black)
Dim pageNumber As PdfPageNumberField = New PdfPageNumberField(font, fieldBrush)
Dim count As PdfPageCountField = New PdfPageCountField(font, fieldBrush)
Dim templateElement As PdfPageTemplateElement = New PdfPageTemplateElement(400, 400)
templateElement.Graphics.DrawString("Page :" + vbTab + "of", font, PdfBrushes.Black, New PointF(260, 200))
pageNumber.Draw(templateElement.Graphics, New PointF(306, 200))
count.Draw(templateElement.Graphics, New PointF(345, 200))
document.Template.Stamps.Add(templateElement)
templateElement.Background = True
document.Save("output.pdf")
document.Close(True)
Fields
Name | Description |
---|---|
Blinds | Multiple lines, evenly spaced across the screen, synchronously sweep in the same direction to reveal the new page. The lines may be either horizontal or vertical. Horizontal lines move downward; vertical lines move to the right. |
Box | A rectangular box sweeps inward from the edges of the page or outward from the center, revealing the new page. |
Cover | The new page slides on to the screen, covering the old page. |
Dissolve | The old page dissolves gradually to reveal the new one. |
Fade | The new page gradually becomes visible through the old one. |
Fly | Changes are flown out or in, to or from a location that is offscreen. |
Glitter | Similar to Dissolve, except that the effect sweeps across the page in a wide band moving from one side of the screen to the other. |
Push | The old page slides off the screen while the new page slides in, pushing the old page out. |
Replace | The new page simply replaces the old one with no special transition effect. |
Split | Two lines sweep across the screen, revealing the new page. The lines may be either horizontal or vertical and may move inward from the edges of the page or outward from the center. |
Uncover | The old page slides off the screen, uncovering the new page. |
Wipe | A single line sweeps across the screen from one edge to the other, revealing the new page. |