- Home
- Testimonials
- Purchase
- Developer Tools
- Desktop Utilities
- Download
- Support
- Blog
- Company
How to draw curved lines (curves) in PDF document using Bytescout.PDF library for .NET
Drawing a curve in PDF document
This example demonstrates how to draw curved lines in PDF using Bytescout.PDF library

Download example source code: bytescoutpdf_curves.zip (10 KB)
using System;
using System.Collections.Generic;
using System.Text;
using Bytescout.PDF;
using System.Diagnostics;
namespace HelloWorld
{
class Program
{
static void Main(string[] args)
{
// Create main PDF Doc Engine
PDFDocEngine engine = new PDFDocEngine("", "");
// Add new document
Document document = engine.AddDocument();
// Append new page to the document
Page page = document.AddPage(PageSizeType.A3, PageOrientationType.LandScape);
// Create new drawing
Drawing drawing = page.AddDrawing();
// Line width
const double lineWidth = 5.0f;
// Set Line Width
drawing.SetLineWidth(lineWidth);
// Move to start position
drawing.MoveTo(100, 100);
// X coordinate of 1st point
double point1X = 200.0f;
// Y coordinate of 1st point
double point1Y = 200.0f;
// X coordinate of 2nd point
double point2X = 300.0f;
// Y coordinate of 2nd point
double point2Y = 50.0f;
// X coordinate of 3rd point
double point3X = 400.0f;
// Y coordinate of 3rd point
double point3Y = 100.0f;
// Draw curve interpolated between 3 points
drawing.CurveTo(point1X, point1Y, point2X, point2Y, point3X, point3Y);
//Stroke curve
drawing.Stroke();
// Closing drawing on the page
drawing.Close();
// Save document
document.Save("Curves.pdf");
// open generated PDF document in default PDF viewer installed in Windows
Process.Start("Curves.pdf");
}
}
}
Download example source code: bytescoutpdf_curves.zip (10 KB)
Filed in:
PDF SDK for .NET
Tutorials:


