问题描述:

I have three signature fields in my PDF. I am taking values from a ComboBox in my Windows Forms apps for this.

The ComboBox has:

 Signature 1

Signature 2

Signature 3

For the signature fields, I have a property:

 field.fullname;

field.baseobject;

Which gives me the full name of the field, e.g.

 Signature 1

...

I want to compare these two on the Click of the Save button; that is, if signature field 1 is selected, the data should be added to the signature field1 only, and so on.

How do I do this?

I tried using field.BasedataObject, and I found the following

<24 0 R> - 1st field

<26 0 R> - 2nd field

<1010 0 R> - 3rd field

网友答案:

It looks like a simple solution would be to create a class for Signature (using your necessary properties) then create an array of signatures. Use that array of Signatures to populate your combobox in the first place (maintaining integrity of your system) then use the id from selected value of the combobox to compare to the array index. Something like this:

public class Signature{
    string property1;
    string property2;

    public Signature(string propertyVal1, string propertyVal2)
    {
        property1 = propertyVal1;
        property2 = propertyVal2;
    }

}

    Signature[] mySignatures = new Signature[3];

    public Form1()
    {
        InitializeComponent();
        mySignatures[0] = new Signature("hello", "world");
        mySignatures[1] = new Signature("hello", "world");
        mySignatures[2] = new Signature("hello", "world");
        for (int i = 0; i < mySignatures.Length; i++)
        {
            comboBox1.Items.Add(mySignatures[i]);
        }

    }
网友答案:

Why don't you have a struct for Signature?

struct Signature
{
Signature1,
Field1,
Field2
};

You can compare these struct variables then.

网友答案:

You can create a class with 3 properties as following class Signature { string Signature1, string fullname, object baseobject } may have get and set too

this will help you combine all the value and can have helping method in this class too

网友答案:

It's very hard to understand what you did and what you want to do, but looks like you just need to use the SelectedValue of the comboBox and compare/get the right object with that "id".

In your example it looks like the 24, 26 and 1010. The output you got there is probably the Object.ToString().

Don't forget combos have a selected value (you should store the key) and the selected text. Forget the text and go for the key the use field.BasedataObject.Key

网友答案:

How you are referring to pdf? is it saved in your database? or you are referring to it externally?

if its saved in your database you can access it using binary Serialization. if externally,Adobe pro has has a link button that connects pdf files to your web service using URL(you need to do jscript pdf coding on pdf)

You might also want to see PDFOne app that access pdf fields in an easy way.

Thanks

相关阅读:
Top