示例#1
0
        private static void sendFaxSample(ApiService apiClient)
        {
            // create a new fax document.
            apiFaxDocument apiFaxDocument = new apiFaxDocument();

            apiFaxDocument.FileData = "VGhpcyBpcyBhIGZheA==";
            apiFaxDocument.FileName = "test.txt";

            // create an array of api fax documents.
            apiFaxDocument[] apiFaxDocuments;
            apiFaxDocuments = new apiFaxDocument[1] {
                apiFaxDocument
            };

            // create a new fax message.
            apiFaxMessage apiFaxMessage1 = new apiFaxMessage();

            apiFaxMessage1.MessageRef = "test-1-1-1";
            apiFaxMessage1.SendTo     = "6011111111";
            apiFaxMessage1.SendFrom   = "Test fax";
            apiFaxMessage1.Resolution = faxResolution.normal;
            apiFaxMessage1.Documents  = apiFaxDocuments;
            apiFaxMessage1.CLI        = "1234";

            // create another fax message.
            apiFaxMessage apiFaxMessage2 = new apiFaxMessage();

            apiFaxMessage2.MessageRef = "test-1-1-2";
            apiFaxMessage2.SendTo     = "6011111111";
            apiFaxMessage2.SendFrom   = "Test fax";
            apiFaxMessage2.Resolution = faxResolution.normal;
            apiFaxMessage2.Documents  = apiFaxDocuments;
            apiFaxMessage2.CLI        = "123";

            // create an array of api fax messages.
            apiFaxMessage[] apiFaxMessages = new apiFaxMessage[2] {
                apiFaxMessage1, apiFaxMessage2
            };

            //create a new instance of sendFax request.
            sendFaxRequest sendFaxRequest = new sendFaxRequest();

            sendFaxRequest.FaxMessages = apiFaxMessages;

            // call the sendFax method.
            sendFaxResponse sendFaxResponse = apiClient.SendFax(sendFaxRequest);

            // extracting responses
            foreach (apiFaxMessageStatus faxMessage in sendFaxResponse.FaxMessages)
            {
                Console.WriteLine("response: " + "faxMessageRef: " + faxMessage.messageRef + ", status: " + faxMessage.status);
            }

            Console.ReadLine();
        }
示例#2
0
        private static void sendFaxSample_stampMergeData_textStamp(ApiService apiClient)
        {
            // create stampMergeField.
            apiFaxDocumentStampMergeFieldKey key = new apiFaxDocumentStampMergeFieldKey();

            key.xCoord          = 0;
            key.yCoord          = 0;
            key.xCoordSpecified = true;
            key.yCoordSpecified = true;

            apiFaxDocumentStampMergeFieldTextValue textValue = new apiFaxDocumentStampMergeFieldTextValue();

            textValue.fontName = "Times-Roman";
            textValue.Value    = "MyText";

            apiFaxDocumentStampMergeField textStamp = new apiFaxDocumentStampMergeField();

            textStamp.TextValue = textValue;
            textStamp.Key       = key;

            apiFaxDocumentStampMergeField[] stampMergeFields = new apiFaxDocumentStampMergeField[1] {
                textStamp
            };

            // create a new fax document.
            apiFaxDocument apiFaxDocument = new apiFaxDocument();

            apiFaxDocument.FileData       = sample_TiffFileData();
            apiFaxDocument.FileName       = "test.tiff";
            apiFaxDocument.StampMergeData = stampMergeFields;

            // create an array of api fax documents.
            apiFaxDocument[] apiFaxDocuments;
            apiFaxDocuments = new apiFaxDocument[1] {
                apiFaxDocument
            };

            // create a new fax message.
            apiFaxMessage apiFaxMessage1 = new apiFaxMessage();

            apiFaxMessage1.MessageRef = "test-1-1-1";
            apiFaxMessage1.SendTo     = "6011111111";
            apiFaxMessage1.SendFrom   = "Test fax";
            apiFaxMessage1.Resolution = faxResolution.normal;

            // create an array of api fax messages.
            apiFaxMessage[] apiFaxMessages = new apiFaxMessage[1] {
                apiFaxMessage1
            };

            // create a new instance of sendFax request.
            sendFaxRequest sendFaxRequest = new sendFaxRequest();

            sendFaxRequest.FaxMessages = apiFaxMessages;
            sendFaxRequest.Documents   = apiFaxDocuments;

            Console.WriteLine("Sending faxmessage... This may take a while...");

            // call the sendFax method.
            sendFaxResponse sendFaxResponse = apiClient.SendFax(sendFaxRequest);

            // extracting responses
            foreach (apiFaxMessageStatus faxMessage in sendFaxResponse.FaxMessages)
            {
                Console.WriteLine("response: " + "faxMessageRef: " + faxMessage.messageRef + ", status: " + faxMessage.status);
            }

            Console.ReadLine();
        }
示例#3
0
        private static void sendFaxSample_stampMergeData_TextAndImageStamp(ApiService apiClient)
        {
            //create stampMergeField
            apiFaxDocumentStampMergeFieldKey key1 = new apiFaxDocumentStampMergeFieldKey();

            key1.xCoord          = 283;
            key1.yCoord          = 120;
            key1.xCoordSpecified = true;
            key1.yCoordSpecified = true;

            apiFaxDocumentStampMergeFieldImageValue imageValue = new apiFaxDocumentStampMergeFieldImageValue();

            imageValue.FileName        = "stamp.png";
            imageValue.FileData        = sample_StampData();
            imageValue.height          = 189;
            imageValue.heightSpecified = true;
            imageValue.width           = 388;
            imageValue.widthSpecified  = true;

            apiFaxDocumentStampMergeField imageStamp = new apiFaxDocumentStampMergeField();

            imageStamp.ImageValue = imageValue;
            imageStamp.Key        = key1;

            //create stampMergeField.
            apiFaxDocumentStampMergeFieldKey key2 = new apiFaxDocumentStampMergeFieldKey();

            key2.xCoord          = 1287;
            key2.yCoord          = 421;
            key2.xCoordSpecified = true;
            key2.yCoordSpecified = true;

            apiFaxDocumentStampMergeFieldTextValue textValue = new apiFaxDocumentStampMergeFieldTextValue();

            textValue.fontName = "Times-Roman";
            textValue.Value    = "Hello";

            apiFaxDocumentStampMergeField textStamp = new apiFaxDocumentStampMergeField();

            textStamp.TextValue = textValue;
            textStamp.Key       = key2;

            apiFaxDocumentStampMergeField[] stampMergeFields = new apiFaxDocumentStampMergeField[2] {
                imageStamp, textStamp
            };

            // create a new fax document.
            apiFaxDocument apiFaxDocument = new apiFaxDocument();

            apiFaxDocument.FileData       = sample_TiffFileData();
            apiFaxDocument.FileName       = "test.tiff";
            apiFaxDocument.StampMergeData = stampMergeFields;

            // create an array of api fax documents.
            apiFaxDocument[] apiFaxDocuments;
            apiFaxDocuments = new apiFaxDocument[1] {
                apiFaxDocument
            };

            //create a new fax message.
            apiFaxMessage apiFaxMessage1 = new apiFaxMessage();

            apiFaxMessage1.MessageRef = "test-1-1-1";
            apiFaxMessage1.SendTo     = "6011111111";
            apiFaxMessage1.SendFrom   = "Test fax";
            apiFaxMessage1.Resolution = faxResolution.normal;

            // create an array of api fax messages.
            apiFaxMessage[] apiFaxMessages = new apiFaxMessage[1] {
                apiFaxMessage1
            };

            //create a new instance of sendFax request.
            sendFaxRequest sendFaxRequest = new sendFaxRequest();

            sendFaxRequest.FaxMessages = apiFaxMessages;
            sendFaxRequest.Documents   = apiFaxDocuments;

            Console.WriteLine("Sending faxmessage... This may take a while...");

            // call the sendFax method.
            sendFaxResponse sendFaxResponse = apiClient.SendFax(sendFaxRequest);

            // extracting responses
            foreach (apiFaxMessageStatus faxMessage in sendFaxResponse.FaxMessages)
            {
                Console.WriteLine("response: " + "faxMessageRef: " + faxMessage.messageRef + ", status: " + faxMessage.status);
            }
        }
示例#4
0
        private static void sendFaxSample_docMergeData(ApiService apiClient)
        {
            //create docMergeFields
            apiFaxDocumentDocMergeField docMergeField1 = new apiFaxDocumentDocMergeField();

            docMergeField1.Key   = "field1";
            docMergeField1.Value = "lazy dog";

            apiFaxDocumentDocMergeField docMergeField2 = new apiFaxDocumentDocMergeField();

            docMergeField2.Key   = "field2";
            docMergeField2.Value = "fat pig";

            apiFaxDocumentDocMergeField docMergeField3 = new apiFaxDocumentDocMergeField();

            docMergeField3.Key   = "field3";
            docMergeField3.Value = "fat pig";

            apiFaxDocumentDocMergeField[] docMergeData = new apiFaxDocumentDocMergeField[3] {
                docMergeField1, docMergeField2, docMergeField3
            };

            // create a new fax document.
            apiFaxDocument apiFaxDocument = new apiFaxDocument();

            apiFaxDocument.FileData     = sample_DocxFileData();
            apiFaxDocument.FileName     = "test.docx";
            apiFaxDocument.DocMergeData = docMergeData;

            // create an array of api fax documents.
            apiFaxDocument[] apiFaxDocuments;
            apiFaxDocuments = new apiFaxDocument[1] {
                apiFaxDocument
            };

            //create a new fax message.
            apiFaxMessage apiFaxMessage1 = new apiFaxMessage();

            apiFaxMessage1.MessageRef = "test-1-1-1";
            apiFaxMessage1.SendTo     = "6011111111";
            apiFaxMessage1.SendFrom   = "Test fax";
            apiFaxMessage1.Resolution = faxResolution.normal;

            // create an array of api fax messages.
            apiFaxMessage[] apiFaxMessages = new apiFaxMessage[1] {
                apiFaxMessage1
            };

            //create a new instance of sendFax request.
            sendFaxRequest sendFaxRequest = new sendFaxRequest();

            sendFaxRequest.FaxMessages = apiFaxMessages;
            sendFaxRequest.Documents   = apiFaxDocuments;

            // call the sendFax method.
            sendFaxResponse sendFaxResponse = apiClient.SendFax(sendFaxRequest);

            // extracting responses
            foreach (apiFaxMessageStatus faxMessage in sendFaxResponse.FaxMessages)
            {
                Console.WriteLine("response: " + "faxMessageRef: " + faxMessage.messageRef + ", status: " + faxMessage.status);
            }

            Console.ReadLine();
        }