Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Created September 28, 2016 15:01
Show Gist options
  • Save bjoerntx/132767b4aabb67d84ac884603ceb4329 to your computer and use it in GitHub Desktop.
Save bjoerntx/132767b4aabb67d84ac884603ceb4329 to your computer and use it in GitHub Desktop.
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