/// <summary> /// Generates CMYK EPS /// </summary> public static void GenerateCmykEps() { var dpi = 300f; var unitFactory = new UnitFactory(dpi); using (var epsWriter = new EpsWriter("../../../../_Output/PDFAndEPSOutput.eps", unitFactory.Inch(3.5f), unitFactory.Inch(2.0f), dpi, dpi)) using (var graphics = epsWriter.GetGraphics()) using (var bitmap = new Bitmap("../../../../_Input/Chicago.jpg")) { // Pen 1pt width var pen = new Pen(new CmykColor(0, 255, 255, 0), unitFactory.Point(1.0f)); // Rectangle graphics.DrawRectangle(pen, unitFactory.Inch(0.125f), unitFactory.Inch(0.125f), unitFactory.Inch(3.5f - 0.125f * 2), unitFactory.Inch(2 - 0.125f * 2)); // Image graphics.DrawImage(bitmap, new System.Drawing.RectangleF( unitFactory.Inch(0.25f), unitFactory.Inch(0.75f), unitFactory.Inch(0.25f + 0.5f * (float)bitmap.Height / (float)bitmap.Width), unitFactory.Inch(1.25f))); // Text var font = graphics.CreateFont("Arial", 32f); var text = new PlainText("Front Side", font, new SolidBrush(RgbColor.Navy)) { Alignment = TextAlignment.Left, Position = new System.Drawing.PointF(unitFactory.Inch(1.125f), unitFactory.Inch(1.125f)) }; graphics.DrawText(text); } }
/// <summary> /// Saves raster and vector graphics to EPS format /// </summary> private static void WriteRasterAndVectorGraphicsToEps() { using (var writer = new EpsWriter("../../../../_Output/WriteRasterAndVectorGraphicsToPdf.eps", 800, 650)) using (var graphics = writer.GetGraphics()) { // Draw bitmap using (var bitmap = new Bitmap("../../../../_Input/Chicago.jpg")) { graphics.DrawImage(bitmap, 100f, 100f); } // Draw rectangle graphics.DrawRectangle(new Pen(RgbColor.Gray, 4f), 50f, 50f, 700f, 550f); // Draw text var font = graphics.CreateFont("Arial", 56f); var text = new PlainText("Confidential", font, new SolidBrush(RgbColor.OrangeRed), 400f, 340f, TextAlignment.Center); graphics.DrawText(text); } }