コード例 #1
0
 #Create list with entered data
 enteredData = {
     "email": email,
     "country": country,
     "name": name,
     "street": street,
     "city": city
 }
 #Create new Datasource object
 dataSource = Datasource
 array = []
 #Create DataSourceField object and filing it with entered data
 for key, data in enteredData.iteritems():
     value = [data]
     field = DatasourceField()
     field.name = key
     field.type = "text"
     field.values = value
     array.append(field)
 #Set DataSourceField object to the fields parameter of the DataSource object
 dataSource.fields = array
 try:
     #Add DataSource to GroupDocs
     addDataSource = mergeApi.AddDataSource(clientId, dataSource)
     #Check status
     if addDataSource.status == "Ok":
         try:
             #Merge DataSource with documnet and convert it to PDF
             job = mergeApi.MergeDatasource(
                 clientId,
                 guid,
コード例 #2
0
    try:
        enteredData = {
            "sex": sex,
            "age": age,
            "sunrise": sunrise,
            "name": name
        }
        #Create Datasource object
        dataSource = Datasource
        #Create empty list
        fieldsList = []
        #Create DatasourceField object and set data to it
        for fieldName, fieldContent in enteredData.iteritems():
            value = [fieldContent]
            dataFieled = DatasourceField()
            dataFieled.name = fieldName
            dataFieled.type = "text"
            dataFieled.values = value
            fieldsList.append(dataFieled)
        #Set Datasource fileds
        dataSource.fields = fieldsList

        try:
            #Add new Datasource to GroupDocs
            add = merg.AddDataSource(clientId, dataSource)

            try:
                #Merge new Datasource to document and convert document to pdf
                merge = merg.MergeDatasource(clientId,
                                             fileGuId,
                                             add.result.datasource_id,
コード例 #3
0
    storage.basePath = basePath
    signature.basePath = basePath
    docApi.basePath = basePath
    mergeApi.basePath = basePath
    asyncApi.basePath = basePath
    guid = templateGuid
    #Create list with entered data
    enteredData = {"email": email, "country": country, "name": name, "street": street, "city": city}
    #Create new Datasource object
    dataSource = Datasource
    array = []
    #Create DataSourceField object and filing it with entered data
    for key, data in enteredData.iteritems():
        value = [data]
        field = DatasourceField()
        field.name = key
        field.type = "text"
        field.values = value
        array.append(field)
        #Set DataSourceField object to the fields parameter of the DataSource object
    dataSource.fields = array
    try:
        #Add DataSource to GroupDocs
        addDataSource = mergeApi.AddDataSource(clientId, dataSource)
        #Check status
        if addDataSource.status != "Ok":
            raise Exception(addDataSource.error_message)
        #Merge DataSource with document and convert it to PDF
        job = mergeApi.MergeDatasource(clientId, guid, addDataSource.result.datasource_id, targetType="pdf")

        if job.status != "Ok":
コード例 #4
0
                 value = [fieldContent]
             elif field.type == "Checkbox":
                 type = "boolean"
                 fieldContent = True
                 value = [fieldContent]
             elif field.type == "Listbox":
                 type = "Integer"
                 value = [str(fieldContent)]
             elif field.type == "Combobox":
                 type = "Integer"
                 value = [str(fieldContent)]
             else:
                 type = "text"
                 value = [str(fieldContent)]
             dataField = DatasourceField()
             dataField.name = fieldName
             dataField.type = type
             dataField.values = value
             fieldsList.append(dataField)
 #Set Datasource fields
 dataSource.fields = fieldsList
 #Add new Datasource to GroupDocs
 add = merge.AddDataSource(clientId, dataSource)
 #Merge new Datasource to document and convert document to pdf
 merge = merge.MergeDatasource(clientId, fileGuid, add.result.datasource_id, targetType="pdf")
 jobInfo = None
 #Check job status
 for i in range(5):
     time.sleep(5)
     #Get job info
     jobInfo = async.GetJobDocuments(clientId, merge.result.job_id)
コード例 #5
0
    if fileId != "":
        fileGuId = fileId

    try:
        #Get all fields from template
        fields = doc.GetTemplateFields(clientId, fileGuId)
        #Create Datasource object
        dataSource = Datasource
        #Create empty list
        fieldsList = []
        #Create list of values
        values = ["value1", "value2"]
        #Create DatasourceField object and set data to it
        for field in fields.result.fields:
            dataFieled = DatasourceField()
            dataFieled.name = field.name
            dataFieled.type = "text"
            dataFieled.values = values
            fieldsList.append(dataFieled)
        #Set Datasource fileds
        dataSource.fields = fieldsList

        try:
            #Add new Datasource to GroupDocs
            add = merg.AddDataSource(clientId, dataSource)

            try:
                #Merge new Datasource to document and convert document to pdf
                merge = merg.MergeDatasource(clientId, fileGuId, add.result.datasource_id, targetType = "pdf")

                i = 0