The CreateObject method can be used to create a new object on the current page with a specified type and reference.
Sub CreateObject(ObjectType As ACPDFCREACTIVEX.ObjectTypeConstants, Reference As String)
void CreateObject(ACPDFCREACTIVEX.ObjectTypeConstants ObjectType, string Reference);
HRESULT CreateObject(ACPDFCREACTIVEX.ObjectTypeConstants ObjectType, BSTR Reference);
ObjectType
Object type |
Class ID |
Description |
---|---|---|
acObjectTypeLine |
1 |
Straight line. |
acObjectTypeFrame |
2 |
Rectangular frame. |
acObjectTypeRoundFrame |
3 |
Round Frame. |
acObjectTypeEllipse |
4 |
Ellipse object. |
acObjectTypeText |
5 |
Static text. |
acObjectTypeField |
6 |
Editable field. |
acObjectTypePicture |
7 |
Picture object. |
acObjectTypePolygon |
8 |
Polygon object. |
acObjectTypeFreehand |
9 |
Freehand object. |
acObjectTypeSection |
15 |
Section object. |
acObjectTypeTable |
16 |
Table object. |
acObjectTypeExcel |
17 |
Microsoft Excel® object. |
acObjectTypeWord |
18 |
Microsoft Word® object. |
acObjectTypeGraph |
19 |
Microsoft Chart® object. |
acObjectTypeOLE |
20 |
Generic OLE object. |
acObjectTypeCheckBox |
21 |
CheckBox, RadioButton and PushButton objects. |
acObjectTypeStickyNote |
22 |
Annotation. |
acObjectTypeHighlight |
23 |
Highlighter. |
acObjectTypeSelection |
24 |
ComboBox, ListBox. |
acObjectTypeGroup |
29 |
Group object. |
acObjectTypeDocument |
30 |
Document object |
acObjectTypePage |
31 |
Page Object |
acObjectTypeRow |
32 |
Row from table |
acObjectTypeCell |
33 |
Cell from table |
acObjectTypeFont |
34 |
Font object. |
acObjectTypePageNumbers |
35 |
PageNumbers object. |
acObjectTypeArrow |
36 |
Arrow object |
acObjectTypeDefaultAttributes |
37 |
Default Attribute object. |
acObjectTypeSignature |
39 |
Signature object. |
acObjectTypeAnnotation |
40 |
Annotation object. |
acObjectTypeLayer |
41 |
Layer object. |
acObjectTypeAttachment |
43 |
Attachment object. |
acObjectTypeBarcode |
45 |
Barcode object. |
Reference
Reference name of the object.
Sub Sample()
' Constants for Activation codes
Const strLicenseTo As String = "Amyuni PDF Creator Evaluation"
Const strActivationCode As String = "07EFCDAB010001004282943F2AF19A88F332D9E781E40460727DF8A42847A1BDE06DB61C71E94E2D90424BF8762385335F9D6884E9FC"
' Initializing PDFCreativeX Object
Dim pdf As ACPDFCREACTIVEX.PDFCreactiveX = New ACPDFCREACTIVEX.PDFCreactiveX()
' Set license key
pdf.SetLicenseKey(strLicenseTo, strActivationCode)
' Set CurrentPage
pdf.CurrentPage = 1
' Create a Text in the current Page
pdf.CreateObject(ACPDFCREACTIVEX.ObjectTypeConstants.acObjectTypeText, "Text1")
' Define Object
Dim oText As ACPDFCREACTIVEX.IacObject = pdf.GetObjectByName("Text1")
oText("Left") = 1000
oText("Right") = 5000
oText("Top") = 0
oText("Bottom") = 4000
oText("BorderColor") = &HFF00FF
oText("BorderWidth") = ACPDFCREACTIVEX.acBorderWidth.acBorderWidthDouble
oText("Text") = "Amyuni Technologies"
' Create a Barcode in the current Page
pdf.CreateObject(ACPDFCREACTIVEX.ObjectTypeConstants.acObjectTypeBarcode, "Barcode1")
Dim oBarCode As ACPDFCREACTIVEX.IacObject = pdf.GetObjectByName("Barcode1")
oBarCode("Left") = 100
oBarCode("Right") = 3100
oBarCode("Top") = 1000
oBarCode("Bottom") = 2100
oBarCode("BarcodeType") = 1 ' PDF417 barcodes are the only type supported
oBarCode("VerticalScale") = 3.0 ' Amount by which To scale the barcode vertically, Default
oBarCode("Text") = "Copyright 2015 Amyuni Technologies"
' Save PDF
pdf.Save("c:\temp\CreatePDFDocument_resulting.pdf", ACPDFCREACTIVEX.FileSaveOptionConstants.acFileSaveView)
oText = Nothing
oBarCode = Nothing
End Sub
static void Sample()
{
// Constants for Activation codes
const string strLicenseTo = "Amyuni PDF Creator Evaluation";
const string strActivationCode = "07EFCDAB010001004282943F2AF19A88F332D9E781E40460727DF8A42847A1BDE06DB61C71E94E2D90424BF8762385335F9D6884E9FC";
// Initializing PDFCreativeX Object
ACPDFCREACTIVEX.PDFCreactiveX pdf = new ACPDFCREACTIVEX.PDFCreactiveX();
// Set license key
pdf.SetLicenseKey(strLicenseTo, strActivationCode);
// Set CurrentPage
pdf.CurrentPage = 1;
// Create a Text in the current Page
pdf.CreateObject(ACPDFCREACTIVEX.ObjectTypeConstants.acObjectTypeText, "Text1");
ACPDFCREACTIVEX.IacObject oText = pdf.GetObjectByName("Text1".ToString());
oText["Left"] = 1000;
oText["Right"] = 5000;
oText["Top"] = 0;
oText["Bottom"] = 4000;
oText["BorderColor"] = 0xFF00FF;
oText["BorderWidth"] = ACPDFCREACTIVEX.acBorderWidth.acBorderWidthDouble;
oText["Text"] = "Amyuni Technologies";
// Create a Barcode in the current Page
pdf.CreateObject(ACPDFCREACTIVEX.ObjectTypeConstants.acObjectTypeBarcode, "Barcode1");
ACPDFCREACTIVEX.IacObject oBarCode = pdf.GetObjectByName("Barcode1".ToString());
oBarCode["Left"] = 100;
oBarCode["Right"] = 3100;
oBarCode["Top"] = 1000;
oBarCode["Bottom"] = 2100;
oBarCode["BarcodeType"] = 1; // PDF417 barcodes are the only type supported
oBarCode["VerticalScale"] = 3.0; // Amount by which to scale the barcode vertically, default
oBarCode["Text"] = "Copyright 2015 Amyuni Technologies";
// Save PDF
pdf.Save(@"c:\temp\CreatePDFDocument_resulting.pdf", ACPDFCREACTIVEX.FileSaveOptionConstants.acFileSaveView);
oText = null;
oBarCode = null;
}
#import "c:\users\amyuni\pdfcreactivex.dll" no_namespace
using namespace std;
int main()
{
// Constants for Activation codes
bstr_t strLicenseTo = "Amyuni PDF Creator Evaluation";
bstr_t strActivationCode = "07EFCDAB010001004282943F2AF19A88F332D9E781E40460727DF8A42847A1BDE06DB61C71E94E2D90424BF8762385335F9D6884E9FC";
// Initialize the COM subsystem
CoInitialize(0);
// IPDFCreactiveXPtr is a smart pointer type defined in pdfcreactivex.tlh,
// the type library header file generated by the #import instruction above
IPDFCreactiveXPtr pdf;
// Create the PDFCreactiveX instance
pdf.CreateInstance(__uuidof(PDFCreactiveX));
// set license key
pdf->SetLicenseKey(_bstr_t(strLicenseTo), _bstr_t(strActivationCode));
// Set CurrentPage
pdf->CurrentPage = 1;
// Set-up variables for attributes
_variant_t varAttribute;
varAttribute.vt = VT_I4; // integers
// Create a text in the current Page
pdf->CreateObject(acObjectTypeText, "Text1");
IacObjectPtr oText = pdf->GetObjectByName("Text1");
oText->Attribute["Left"] = 1000;
oText->Attribute["Right"] = 5000;
oText->Attribute["Top"] = 0;
oText->Attribute["Bottom"] = 4000;
varAttribute.lVal = 0xFF00FF;
oText->Attribute["BorderColor"] = varAttribute;
varAttribute.lVal = acBorderWidthDouble;
oText->Attribute["BorderWidth"] = varAttribute;
oText->Attribute["Text"] = "Amyuni Technologies";
// Create a Barcode in the current Page
pdf->CreateObject(acObjectTypeBarcode, "Barcode1");
IacObjectPtr oBarcode = pdf->GetObjectByName("Barcode1");
oBarcode->Attribute["Left"] = 100;
oBarcode->Attribute["Right"] = 3100;
oBarcode->Attribute["Top"] = 1000;
oBarcode->Attribute["Bottom"] = 2100;
varAttribute.lVal = 1;
oBarcode->Attribute["BarcodeType"] = varAttribute; // PDF417 barcodes are the only type supported
oBarcode->Attribute["VerticalScale"] = 3.0; // Amount by which to scale the barcode vertically, default
oBarcode->Attribute["Text"] = "Copyright 2015 Amyuni Technologies";
// Save PDF
pdf->Save("c:\\temp\\CreatePDFDocument_resulting.pdf", acFileSaveView);
// destroy objects
pdf = NULL;
oText = NULL;
oBarcode = NULL;
return 0;
}
' ObjectTypeConstants
Const acObjectTypeArrow = 36
Const acObjectTypeBarcode = 45
Const acObjectTypeCell = 33
Const acObjectTypeCheckBox = 21
Const acObjectTypeEllipse = 4
Const acObjectTypeExcel = 17
Const acObjectTypeField = 6
Const acObjectTypeGraph = 19
Const acObjectTypeHighlight = 23
Const acObjectTypeLine = 1
Const acObjectTypePicture = 7
Const acObjectTypePolygon = 8
Const acObjectTypeRoundFrame = 3
Const acObjectTypeRow = 32
Const acObjectTypeSelection = 24
Const acObjectTypeSignature = 39
Const acObjectTypeStickyNote = 22
Const acObjectTypeTable = 16
Const acObjectTypeText = 5
' acBorderWidth
Const acBorderWidthNone = 0
Const acBorderWidthSimple = 1
Const acBorderWidthDouble = 2
Const acBorderWidthTriple = 3
Const acBorderWidthQuadruple = 4
' FileSaveOptionConstants
Const acFileSaveAll = 0
Const acFileSaveDefault = -1
Const acFileSaveView = 1
Const acFileSaveDesign = 2
Const acFileSavePDFA_7 = 3
Const acFileSavePDFA = 4
Const acFileSavePDF14 = 5
' Constants for Activation codes
Const strLicenseTo = "Amyuni PDF Creator Evaluation"
Const strActivationCode = "07EFCDAB010001004282943F2AF19A88F332D9E781E40460727DF8A42847A1BDE06DB61C71E94E2D90424BF8762385335F9D6884E9FC"
' Initializing PDFCreativeX Object
Dim pdf
Set pdf = CreateObject("PDFCreactiveX.PDFCreactiveX.6.5")
' Set license key
pdf.SetLicenseKey strLicenseTo, strActivationCode
' Set CurrentPage
pdf.CurrentPage = 1
' Create a Text in the current Page
pdf.CreateObject acObjectTypeText, "Text1"
Dim oText
Set oText = pdf.GetObjectByName("Text1")
oText("Left") = 1000
oText("Right") = 5000
oText("Top") = 0
oText("Bottom") = 4000
oText("BorderColor") = &HFF00FF
oText("BorderWidth") = acBorderWidthDouble
oText("Text") = "Amyuni Technologies"
' Create a Barcode in the current Page
pdf.CreateObject acObjectTypeBarcode, "Barcode1"
Dim oBarCode
Set oBarCode= pdf.GetObjectByName("Barcode1")
oBarCode("Left") = 100
oBarCode("Right") = 3100
oBarCode("Top") = 1000
oBarCode("Bottom") = 2100
oBarCode("BarcodeType") = 1 ' PDF417 barcodes are the only type supported
oBarCode("VerticalScale") = 3.0 ' Amount by which To scale the barcode vertically, Default
oBarCode("Text") = "Copyright 2015 Amyuni Technologies"
' Save PDF
pdf.Save "c:\temp\CreatePDFDocument_resulting.pdf", acFileSaveView
' destroy Objects
Set pdf = Nothing
Set oText = Nothing
Set oBarCode = Nothing