Hello,
how can I add custom properties on pdf-page "custom" programmatically?
I found nothing in the documentation nor on internet.
Greetings,
Georg
add custom document properties
Re: add custom document properties
Hi,
The link below points to our online documentation. Here you can find more information about adding custom attributes.
https://www.amyuni.com/WebHelp/Amyuni_P ... Method.htm
Example:
The link below points to our online documentation. Here you can find more information about adding custom attributes.
https://www.amyuni.com/WebHelp/Amyuni_P ... Method.htm
Example:
Code: Select all
'Create a text
With page.CreateObject(Amyuni.PDFCreator.IacObjectType.acObjectTypeText, "Text1")
.AttributeByName("Left").Value = 1000
.AttributeByName("Top").Value = 0
.AttributeByName("Right").Value = 3250
.AttributeByName("Bottom").Value = 500
.AttributeByName("BackColor").Value = 192
.AttributeByName("Hyperlink").Value = "http://www.amyuni.com"
.AttributeByName("Text").Value = "Amyuni Technologies"
'Create a new attribute named Custom and set its value
.AddAttribute("Custom", Amyuni.PDFCreator.IacAttributeType.String)
.Attribute("Custom").Value = "Custom Value"
'retrieve the value for testing
MsgBox(.Attribute("Custom").Value.ToString)
End With
Get PDF Suite, the expert .NET developer toolkit for PDF conversion, creation and editing - www.amyuni.com/pdfsuite
Re: add custom document properties
Hi Jose,
it definitively doesn't work! "Tuev Rheinland Service GmbH" appears but no custom property named "Tuev"! What is wrong with the code!?
Product\Version: PDF Creator .NET PRO Developer\5.5.0.7
Greetings,
Georg
var pdfDocument = new IacDocument();
var password = string.Empty;
if (pdfDocument.Open(fileRead, password))
{
fileRead.Close();
var fileWrite = new FileStream(file, FileMode.Create, FileAccess.Write, FileShare.Read);
var page = pdfDocument.GetPage(1);
pdfDocument.ReportState = IacReportState.acReportStateDesign;
//Create a text
using (IacObject text = page.CreateObject(IacObjectType.acObjectTypeText, "acObjectTypeText"))
{
text.AttributeByName("Left").Value = 1000;
text.AttributeByName("Top").Value = 0;
text.AttributeByName("Right").Value = 3250;
text.AttributeByName("Bottom").Value = 500;
text.AttributeByName("BackColor").Value = 192;
text.AttributeByName("Text").Value = "Tuev Rheinland Service GmbH";
//Create a new attribute named Custom and set its value
text.AddAttribute("Tuev", IacAttributeType.String);
text.Attribute("Tuev").Value = "Tuev Value";
}
if (pdfDocument.Save(fileWrite, iacFileSaveOption))
it definitively doesn't work! "Tuev Rheinland Service GmbH" appears but no custom property named "Tuev"! What is wrong with the code!?
Product\Version: PDF Creator .NET PRO Developer\5.5.0.7
Greetings,
Georg
var pdfDocument = new IacDocument();
var password = string.Empty;
if (pdfDocument.Open(fileRead, password))
{
fileRead.Close();
var fileWrite = new FileStream(file, FileMode.Create, FileAccess.Write, FileShare.Read);
var page = pdfDocument.GetPage(1);
pdfDocument.ReportState = IacReportState.acReportStateDesign;
//Create a text
using (IacObject text = page.CreateObject(IacObjectType.acObjectTypeText, "acObjectTypeText"))
{
text.AttributeByName("Left").Value = 1000;
text.AttributeByName("Top").Value = 0;
text.AttributeByName("Right").Value = 3250;
text.AttributeByName("Bottom").Value = 500;
text.AttributeByName("BackColor").Value = 192;
text.AttributeByName("Text").Value = "Tuev Rheinland Service GmbH";
//Create a new attribute named Custom and set its value
text.AddAttribute("Tuev", IacAttributeType.String);
text.Attribute("Tuev").Value = "Tuev Value";
}
if (pdfDocument.Save(fileWrite, iacFileSaveOption))
Re: add custom document properties
Hi,
Not sure why you are encountering this issue but the code below adds the custom attribute.
Can you send your PDF document and your resulting PDF document to support@amyuni.com? I will re-test your issue using that document
Not sure why you are encountering this issue but the code below adds the custom attribute.
Can you send your PDF document and your resulting PDF document to support@amyuni.com? I will re-test your issue using that document
Code: Select all
using (IacObject text = page.CreateObject(IacObjectType.acObjectTypeText, "acObjectTypeText"))
{
text.AttributeByName("Left").Value = 1000;
text.AttributeByName("Top").Value = 0;
text.AttributeByName("Right").Value = 3250;
text.AttributeByName("Bottom").Value = 500;
text.AttributeByName("BackColor").Value = 192;
text.AttributeByName("Text").Value = "Tuev Rheinland Service GmbH";
//Create a new attribute named Custom and set its value
text.AddAttribute("Tuev", IacAttributeType.String);
text.Attribute("Tuev").Value = "Tuev Value";
MessageBox.Show(text.Attribute("Tuev").Value.ToString());
}
pdfDocument.Save(fileWrite, Amyuni.PDFCreator.IacFileSaveOption.acFileSaveAll);
Get PDF Suite, the expert .NET developer toolkit for PDF conversion, creation and editing - www.amyuni.com/pdfsuite