The Activate method is used to simulate the double-click action on a specific object. Depending on the object type and the state of the document; the double-click activates the object in a different way.
Public Function Activate() As Boolean
public bool Activate()
Returns Value True if the call succeeded and False otherwise.
The exception Amyuni.PDFCreator.IacException.LicenseKeyError might be generated if the provided license is not valid or wrong.
Member of Amyuni.PDFCreator.IacObject.
Public Sub Sample()
' Constants for Activation codes
Const strLicenseTo As String = "Amyuni PDF Creator .NET Evaluation"
Const strActivationCode As String = "07EFCDAB0100010025C3B7B351579FF94C49112EAF7368612744C7237C2F6A215A53E83A9ECCFFE54C52063CB05338BDE555773D7B1B"
' Initialize library
' This should be done once
acPDFCreatorLib.Initialize()
' set license key This is needed only with licensed version
acPDFCreatorLib.SetLicenseKey(strLicenseTo, strActivationCode)
' Create a new PDF document
Dim doc As New Amyuni.PDFCreator.IacDocument()
' Create page object
Dim page As Amyuni.PDFCreator.IacPage
' Define first page of PDF document
page = doc.GetPage(1)
' Switch to design mode before adding objects to the document
doc.ReportState = Amyuni.PDFCreator.IacReportState.acReportStateDesign
' Create an editable field object
Dim obj As Amyuni.PDFCreator.IacObject = PdfCreator1.Document.CurrentPage.CreateObject(Amyuni.PDFCreator.IacObjectType.acObjectTypeField, "Field1")
' Set the object' s default text and position
' make sure the object is editable
obj.Attribute("Text").Value = "Amyuni Technologies"
obj.Attribute("Editable").Value = True
obj.Attribute("Left").Value = 800
obj.Attribute("Top").Value = 5000
obj.Attribute("Right").Value = 1500
obj.Attribute("Bottom").Value = 6000
' Refresh the PDF document
doc.Refresh()
' Switch to run mode after objects to the document
doc.ReportState = Amyuni.PDFCreator.IacReportState.acReportStateRun
' Activate the object to allow the user to edit the text
obj.Activate()
' Create new stream object
Dim fileWrite As System.IO.Stream = System.IO.File.OpenWrite("C:\temp\CreatePDFDocument_resulting.pdf")
' Save stream
doc.Save(fileWrite, Amyuni.PDFCreator.IacFileSaveOption.acFileSaveView)
' Close the stream
fileWrite.Close()
' terminate library to free resources
acPDFCreatorLib.Terminate()
' destroy objects
doc.Dispose()
page.Dispose()
End Sub
public void Activate()
{
// Constants for Activation codes
const string strLicenseTo = "Amyuni PDF Creator .NET Evaluation";
const string strActivationCode = "07EFCDAB0100010025C3B7B351579FF94C49112EAF7368612744C7237C2F6A215A53E83A9ECCFFE54C52063CB05338BDE555773D7B1B";
// Initialize library
// This should be done once
acPDFCreatorLib.Initialize();
// set license key This is needed only with licensed version
acPDFCreatorLib.SetLicenseKey(strLicenseTo, strActivationCode);
// Create a new PDF document
Amyuni.PDFCreator.IacDocument doc = new Amyuni.PDFCreator.IacDocument();
// Switch to design mode before adding objects to the document
doc.ReportState = Amyuni.PDFCreator.IacReportState.acReportStateDesign;
// set the object' s default text and position
// make sure the object is editable
Amyuni.PDFCreator.IacObject obj = PdfCreator1.Document.CurrentPage.CreateObject(Amyuni.PDFCreator.IacObjectType.acObjectTypeField, "Field1");
obj.Attribute("Text").Value = "Amyuni Technologies";
obj.Attribute("Editable").Value = true;
obj.Attribute("Left").Value = 800;
obj.Attribute("Top").Value = 5000;
obj.Attribute("Right").Value = 1500;
obj.Attribute("Bottom").Value = 6000;
// Refresh the PDF document
doc.Refresh();
// Switch to run mode after objects to the document
doc.ReportState = Amyuni.PDFCreator.IacReportState.acReportStateRun;
// Activate the object to allow the user to edit the text
obj.Activate();
// Create new stream object
System.IO.FileStream fileWrite = new System.IO.FileStream(@"C:\temp\CreatePDFDocument_resulting.pdf",
System.IO.FileMode.Create,
System.IO.FileAccess.Write,
System.IO.FileShare.Read);
// Save stream
doc.Save(fileWrite, Amyuni.PDFCreator.IacFileSaveOption.acFileSaveView);
// Close the stream
fileWrite.Close();
// terminate library to free resources
acPDFCreatorLib.Terminate();
// destroy objects
doc.Dispose();
page.Dispose();
}