Created
September 28, 2016 15:01
-
-
Save bjoerntx/132767b4aabb67d84ac884603ceb4329 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void Merge() | |
{ | |
// create a Dictionary with all form values | |
Dictionary<string,string> formValues = | |
new Dictionary<string,string>(); | |
foreach (string key in Request.Form) | |
{ | |
formValues.Add(key, Request[key]); | |
} | |
// create a new ReportingCloud object | |
ReportingCloud rc = new ReportingCloud("username", "password"); | |
// create a MergeBody object with the form values | |
MergeBody mb = new MergeBody() | |
{ | |
MergeData = formValues | |
}; | |
// call the MergeDocument method | |
List<byte[]> documents = rc.MergeDocument(mb, "letter.tx"); | |
// return the PDF to the browser | |
Response.ContentType = "application/pdf"; | |
Response.BinaryWrite(documents[0]); | |
Response.Flush(); | |
Response.End(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment