private void DrawPicturePai( PdfDocument Document, PdfContents Contents ) { // define local image resources PdfImage Image1 = new PdfImage(Document, "D:\\visual studio 2012\\TestPDFFileWriter\\TestPDFFileWriter\\logo.png"); // image size will be limited to 1.4" by 1.4" SizeD ImageSize = Image1.ImageSize(1.4, 1.4); // save graphics state Contents.SaveGraphicsState(); // translate coordinate origin to the center of the picture Contents.Translate(3.36, 5.7); // clipping path // Contents.DrawOval(-ImageSize.Width / 2, -ImageSize.Height / 2, ImageSize.Width, ImageSize.Height, PaintOp.ClipPathEor); // draw image Contents.DrawImage(Image1, -ImageSize.Width / 2, -ImageSize.Height / 2, ImageSize.Width, ImageSize.Height); // restore graphics state Contents.RestoreGraphicsState(); return; }
public void ReportBlueprintImage() { var path = XmlParser.GetValue("ImagePath"); var page = new PdfPage(mDocument); var contents = new PdfContents(page); contents.DrawText(mTimesNormal, 12.0, 1.5, 26, TextJustify.Left, "Plan budynku, na którym zaprojektowano sieć sensorową."); PdfImage blueprintImage = new PdfImage(mDocument, path); blueprintImage.ImageSize(500,700); contents.DrawImage(blueprintImage, 1.5, 26, 500, 700); contents.CommitToPdfFile(false); }