Class PdfXfaImage
Represents image field in the XFA form.
Namespace: Syncfusion.Pdf.Xfa
Assembly: Syncfusion.Pdf.Portable.dll
Syntax
public class PdfXfaImage : PdfXfaField
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.
Declaration
public PdfXfaImage(string name, Stream stream)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Image name. |
System.IO.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.
Declaration
public PdfXfaImage(string name, Stream stream, SizeF size)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Image name. |
System.IO.Stream | stream | Image stream. |
SizeF | size | 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, Single, Single)
Initializes a new instance of the PdfXfaImage class.
Declaration
public PdfXfaImage(string name, Stream stream, float width, float height)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Image name. |
System.IO.Stream | stream | |
System.Single | width | Image width |
System.Single | height | 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
Declaration
public PdfXfaRotateAngle Rotate { get; set; }
Property Value
Type |
---|
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
Declaration
public SizeF Size { get; set; }
Property Value
Type |
---|
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()