These events are fired when a key is pressed.
sender
The wrapper of the ActiveX Control.
key
Contains the virtual key code for the key that is pressed or released.
lParam
Contains the same value that is sent by the WM_KEYDOWN or WM_KEYUP windows messages.
Return 0 to stop default handling, 1 to allow it.
The parameters do not provide information about which other keys are pressed, like SHIFT, CTRL, ALT, MENU, or WINDOWS keys. The state of these other keys can only be retrieved by the event handlers using the API GetKeyState() in C++ or by similar C# or VB calls.
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 a text
With page.CreateObject(Amyuni.PDFCreator.IacObjectType.acObjectTypeText, "acObjectTypeText")
.Attribute("Left").Value = 1000
.Attribute("Top").Value = 0
.Attribute("Right").Value = 3250
.Attribute("Bottom").Value = 500
.Attribute("BackColor").Value = 192
.Attribute("Hyperlink").Value = "http:// www.amyuni.com"
.Attribute("Text").Value = "Amyuni Technologies"
End With
' Refresh the PDF document
doc.Refresh()
' Switch to run mode after objects to the document
doc.ReportState = Amyuni.PDFCreator.IacReportState.acReportStateRun
' 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 Function PDFCreator1_FireKeyDown(sender As Object, e As Amyuni.PDFCreator.IacKeyboardEventArgs) As Integer Handles PdfCreator1.FireKeyDown
MsgBox("KeyDown Event")
End Function
public void Sample()
{
// Define the event
this.PdfCreator1.FireKeyDown += new Amyuni.PDFCreator.OnFireKeyDownDelegate(this.pdfCreator1_FireKeyDown);
// 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();
// Create page object
Amyuni.PDFCreator.IacPage page;
// 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 a text
using (Amyuni.PDFCreator.IacObject oText = page.CreateObject(Amyuni.PDFCreator.IacObjectType.acObjectTypeText, "acObjectTypeText"))
{
oText.Attribute("Left").Value = 1000;
oText.Attribute("Top").Value = 0;
oText.Attribute("Right").Value = 3250;
oText.Attribute("Bottom").Value = 500;
oText.Attribute("BackColor").Value = 192;
oText.Attribute("Hyperlink").Value = "http:// www.amyuni.com";
oText.Attribute("Text").Value = "Amyuni Technologies";
}
// Refresh the PDF document
doc.Refresh();
// Switch to run mode after objects to the document
doc.ReportState = Amyuni.PDFCreator.IacReportState.acReportStateRun;
// 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();
}
public int pdfCreator1_FireKeyDown(object sender, Amyuni.PDFCreator.IacKeyboardEventArgs e)
{
MessageBox.Show("KeyDown Event");
return default(int);
}