private static void faxDocumentPreviewSample_stampMergeData(ApiService apiClient) { //create a stampMergeField. apiFaxDocumentStampMergeFieldKey key = new apiFaxDocumentStampMergeFieldKey(); key.xCoord = 0; key.yCoord = 0; key.xCoordSpecified = true; key.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 = key; //add the imageStamp into an array of stampMergeFields. apiFaxDocumentStampMergeField[] stampMergeFields = new apiFaxDocumentStampMergeField[1] { imageStamp }; //create a new instance of faxDocumentPreview request. faxDocumentPreviewRequest previewRequest = new faxDocumentPreviewRequest(); previewRequest.StampMergeData = stampMergeFields; previewRequest.DocumentRef = "xxx-xxx"; //call the faxDocumentPreview method. faxDocumentPreviewResponse previewResponse = apiClient.FaxDocumentPreview(previewRequest); // extracting responses Console.WriteLine("response: " + "number of pages: \n" + previewResponse.NumberOfPages); Console.WriteLine("preview in base64 format: \n \n" + previewResponse.TiffPreview); Console.ReadLine(); }
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); } }
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(); }