Showing posts with label Google Map. Show all posts
Showing posts with label Google Map. Show all posts

Wednesday, June 8, 2011

Get Address image from Google Map and Add it into iTextSharp Document PDF

//iTextSharp.text.Image LocationImage = iTextSharp.text.Image.GetInstance("http://maps.google.com/maps/api/staticmap?center=" + objInspMgt.PropertyInspectedAddress + "&zoom=14&size=612x612&maptype=roadmap&markers=color:blue|label:S|40.702147,-74.015794&markers=color:green|label:G|40.711614,-74.012318&markers=color:red|color:red|label:C|41.726247,-97.002853&sensor=false");

//Map style roadMap
iTextSharp.text.Image LocationImage = iTextSharp.text.Image.GetInstance("http://maps.google.com/maps/api/staticmap?size=412x530&maptype=roadmap&markers=size:mid|color:red|"+objInspMgt.PropertyInspectedAddress+"&sensor=false");

//Map style terrain
//iTextSharp.text.Image LocationImage = iTextSharp.text.Image.GetInstance("http://maps.google.com/maps/api/staticmap?size=412x530&maptype=terrain&markers=size:mid|color:red|" + objInspMgt.PropertyInspectedAddress + "&sensor=false");

//Map style satellite
//iTextSharp.text.Image LocationImage = iTextSharp.text.Image.GetInstance("http://maps.google.com/maps/api/staticmap?size=412x530&maptype=satellite&markers=size:mid|color:red|"+objInspMgt.PropertyInspectedAddress+"&sensor=false");

//Map style hybrid
//iTextSharp.text.Image LocationImage = iTextSharp.text.Image.GetInstance("http://maps.google.com/maps/api/staticmap?size=412x530&maptype=hybrid&markers=size:mid|color:red|" + objInspMgt.PropertyInspectedAddress + "&sensor=false");


LocationImage.ScaleToFit(650, 650);
LocationImage.Alignment = iTextSharp.text.Image.UNDERLYING;
LocationImage.SetAbsolutePosition(0, 0);
locationcell = new PdfPCell(LocationImage);
locationcell.PaddingBottom = 10;
locationcell.PaddingTop = 10;
locationcell.HorizontalAlignment = 1; //0=Left, 1=Centre, 2=Right
locationcell.Colspan = 3;
locationcell.Border = 0;

Locationtable.AddCell(locationcell);
Document.Add(Locationtable);