Table of Contents

Class PdfXfaImage

Namespace
Syncfusion.Pdf.Xfa
Assembly
Syncfusion.Pdf.Portable.dll

Represents image field in the XFA form.

public class PdfXfaImage : PdfXfaField
Inheritance
PdfXfaImage
Inherited Members

Examples

//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add a new XFA page.
PdfXfaPage xfaPage = document.Pages.Add();
//Create a new PDF XFA form
PdfXfaForm mainForm = new PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width);
//Create a image and add the properties.
PdfXfaImage image = new PdfXfaImage("image1", "image.jpg");
//Add the image to the XFA form.
mainForm.Fields.Add(image);
//Add the XFA form to the document.
document.XfaForm = mainForm;
//Save the document.
document.Save("output.pdf", PdfXfaType.Dynamic);
//close the document
document.Close();
'Create a new PDF XFA document.
Dim document As New PdfXfaDocument()
'Add a new XFA page.
Dim xfaPage As PdfXfaPage = document.Pages.Add()
'Create a new PDF XFA form
Dim mainForm As New PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width)
'Create a image and add the properties.
Dim image As New PdfXfaImage("image1", "image.jpg")
'Add the image to the XFA form.
mainForm.Fields.Add(image)
'Add the XFA form to the document.
document.XfaForm = mainForm
'Save the document.
document.Save("output.pdf",PdfXfaType.Dynamic)
'close the document
document.Close()

Constructors

PdfXfaImage(string, Stream)

Initializes a new instance of the PdfXfaImage class.

public PdfXfaImage(string name, Stream stream)

Parameters

name string

Image name.

stream Stream

Image stream

Examples

//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add a new XFA page.
PdfXfaPage xfaPage = document.Pages.Add();
//Create a new PDF XFA form
PdfXfaForm mainForm = new PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width);
Stream imageStream = new MemoryStream(File.ReadAllBytes("image.jpg"));
//Create a image and add the properties.
PdfXfaImage image = new PdfXfaImage("image1", imageStream);
//Set image size.
image.Size = new SizeF(100, 100);
//Add the image to the XFA form.
mainForm.Fields.Add(image);
//Add the XFA form to the document.
document.XfaForm = mainForm;
//Save the document.
document.Save("output.pdf", PdfXfaType.Dynamic);
//close the document
document.Close();
'Create a new PDF XFA document.
Dim document As New PdfXfaDocument()
'Add a new XFA page.
Dim xfaPage As PdfXfaPage = document.Pages.Add()
'Create a new PDF XFA form
Dim mainForm As New PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width)
Dim imageStream As Stream = New MemoryStream(File.ReadAllBytes("image.jpg"))
'Create a image and add the properties.
Dim image As New PdfXfaImage("image1", imageStream)
'Set image size.
image.Size = New SizeF(100, 100)
'Add the image to the XFA form.
mainForm.Fields.Add(image)
'Add the XFA form to the document.
document.XfaForm = mainForm
'Save the document.
document.Save("output.pdf", PdfXfaType.Dynamic)
'close the document
document.Close()

PdfXfaImage(string, Stream, SizeF)

Initializes a new instance of the PdfXfaImage class.

public PdfXfaImage(string name, Stream stream, SizeF size)

Parameters

name string

Image name.

stream Stream

Image stream.

size SizeF

Size of the image.

Examples

//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add a new XFA page.
PdfXfaPage xfaPage = document.Pages.Add();
//Create a new PDF XFA form
PdfXfaForm mainForm = new PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width);
Stream imageStream = new MemoryStream(File.ReadAllBytes("image.jpg"));
//Create a image and add the properties.
PdfXfaImage image = new PdfXfaImage("image1", imageStream, new SizeF(100,100));        
//Add the image to the XFA form.
mainForm.Fields.Add(image);
//Add the XFA form to the document.
document.XfaForm = mainForm;
//Save the document.
document.Save("output.pdf", PdfXfaType.Dynamic);
//close the document
document.Close();
'Create a new PDF XFA document.
Dim document As New PdfXfaDocument()
'Add a new XFA page.
Dim xfaPage As PdfXfaPage = document.Pages.Add()
'Create a new PDF XFA form
Dim mainForm As New PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width)
Dim imageStream As Stream = New MemoryStream(File.ReadAllBytes("image.jpg"))
'Create a image and add the properties.
Dim image As New PdfXfaImage("image1", imageStream, New SizeF(100,100))   
'Add the image to the XFA form.
mainForm.Fields.Add(image)
'Add the XFA form to the document.
document.XfaForm = mainForm
'Save the document.
document.Save("output.pdf", PdfXfaType.Dynamic)
'close the document
document.Close()

PdfXfaImage(string, Stream, float, float)

Initializes a new instance of the PdfXfaImage class.

public PdfXfaImage(string name, Stream stream, float width, float height)

Parameters

name string

Image name.

stream Stream
width float

Image width

height float

Image height

Examples

//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add a new XFA page.
PdfXfaPage xfaPage = document.Pages.Add();
//Create a new PDF XFA form
PdfXfaForm mainForm = new PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width);
Stream imageStream = new MemoryStream(File.ReadAllBytes("image.jpg"));
//Create a image and add the properties.
PdfXfaImage image = new PdfXfaImage("image1", imageStream, 100, 100);        
//Add the image to the XFA form.
mainForm.Fields.Add(image);
//Add the XFA form to the document.
document.XfaForm = mainForm;
//Save the document.
document.Save("output.pdf", PdfXfaType.Dynamic);
//close the document
document.Close();
'Create a new PDF XFA document.
Dim document As New PdfXfaDocument()
'Add a new XFA page.
Dim xfaPage As PdfXfaPage = document.Pages.Add()
'Create a new PDF XFA form
Dim mainForm As New PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width)
Dim imageStream As Stream = New MemoryStream(File.ReadAllBytes("image.jpg"))
'Create a image and add the properties.
Dim image As New PdfXfaImage("image1", imageStream, 100, 100)   
'Add the image to the XFA form.
mainForm.Fields.Add(image)
'Add the XFA form to the document.
document.XfaForm = mainForm
'Save the document.
document.Save("output.pdf", PdfXfaType.Dynamic)
'close the document
document.Close()

Properties

Rotate

Gets or sets the rotation angle

public PdfXfaRotateAngle Rotate { get; set; }

Property Value

PdfXfaRotateAngle

Examples

//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add a new XFA page.
PdfXfaPage xfaPage = document.Pages.Add();
//Create a new PDF XFA form
PdfXfaForm mainForm = new PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width);
//Create a image and add the properties.
PdfXfaImage image = new PdfXfaImage("image1", "image.jpg");
//Set image size.
image.Size = new SizeF(100, 100);
 //Set the rotation angle.
 image.Rotate = PdfXfaRotateAngle.RotateAngle90;
//Add the image to the XFA form.
mainForm.Fields.Add(image);
//Add the XFA form to the document.
document.XfaForm = mainForm;
//Save the document.
document.Save("output.pdf", PdfXfaType.Dynamic);
//close the document
document.Close();
'Create a new PDF XFA document.
Dim document As New PdfXfaDocument()
'Add a new XFA page.
Dim xfaPage As PdfXfaPage = document.Pages.Add()
'Create a new PDF XFA form
Dim mainForm As New PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width)
'Create a image and add the properties.
Dim image As New PdfXfaImage("image1", "image.jpg")
'Set image size.
image.Size = New SizeF(100, 100)
'Set the rotation angle.
image.Rotate = PdfXfaRotateAngle.RotateAngle90
'Add the image to the XFA form.
mainForm.Fields.Add(image)
'Add the XFA form to the document.
document.XfaForm = mainForm
'Save the document.
document.Save("output.pdf",PdfXfaType.Dynamic)
'close the document
document.Close()

Size

Gets or sets the image size

public SizeF Size { get; set; }

Property Value

SizeF

Examples

//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add a new XFA page.
PdfXfaPage xfaPage = document.Pages.Add();
//Create a new PDF XFA form
PdfXfaForm mainForm = new PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width);
//Create a image and add the properties.
PdfXfaImage image = new PdfXfaImage("image1", "image.jpg");
//Set image size.
image.Size = new SizeF(100, 100);
//Add the image to the XFA form.
mainForm.Fields.Add(image);
//Add the XFA form to the document.
document.XfaForm = mainForm;
//Save the document.
document.Save("output.pdf", PdfXfaType.Dynamic);
//close the document
document.Close();
'Create a new PDF XFA document.
Dim document As New PdfXfaDocument()
'Add a new XFA page.
Dim xfaPage As PdfXfaPage = document.Pages.Add()
'Create a new PDF XFA form
Dim mainForm As New PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width)
'Create a image and add the properties.
Dim image As New PdfXfaImage("image1", "image.jpg")
'Set image size.
image.Size = New SizeF(100, 100)
'Add the image to the XFA form.
mainForm.Fields.Add(image)
'Add the XFA form to the document.
document.XfaForm = mainForm
'Save the document.
document.Save("output.pdf",PdfXfaType.Dynamic)
'close the document
document.Close()