Home

Bytescout.PDF for .NET



Bytescout.PDF library for .NET - setting line join style for lines in PDF document

Download Free Trial Buy Now More Information
For HTML2PDF and XML2PDF solution check our PDFDoc Scout ActiveX library instead

How to set line join style for lines in PDF document

This example demonstrates how to set line join style for lines in PDF document made with Bytescout.PDF library

Different line join styles for lines in PDF

Download example source code: bytescoutpdf_set_line_join.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 = 20.0f;

// Set Line Width
drawing.SetLineWidth(lineWidth);

// Add standard font
uint font = document.AddFontStandard(StandardFontType.TimesRoman, FontEncodingType.WinAnsi);

// Set Active Font
drawing.SetActiveFont(font, 20, false, false);

// Init y position
double yPos = 100.0f;

// Draw all line join types
foreach (LineJoinType joinType in Enum.GetValues(typeof(LineJoinType)))
{
// Set lines cap style
drawing.SetLineJoin(joinType);

// Draw from point with coordinate (100, 100)...
drawing.MoveTo(200.0f, yPos);
// ... to point with coordinate (200, 100)
drawing.LineTo(250.0f, yPos - 50.0f);
// ... to point with coordinate (200, 100)
drawing.LineTo(300.0f, yPos);

// Draw Text
drawing.PlaceText(600.0f, yPos - 25.0f, 0, joinType.ToString());

// Increase y coordinate
yPos += 200.0f;
}

// Stroke lines
drawing.Stroke();

// Closing drawing on the page
drawing.Close();

// Save document
document.Save("SetLineJoin.pdf");


// open generated PDF document in default PDF viewer installed in Windows
Process.Start("SetLineJoin.pdf");
}
}
}

Download example source code: bytescoutpdf_set_line_join.zip (10 KB)

Download Free Trial Buy Now More Information
For HTML2PDF and XML2PDF solution check our PDFDoc Scout ActiveX library instead

"Hello, World!" quick start step-by-step tutorials:

Advanced Examples:
Products  |  Download  |  Purchase  |  Support  |  Contacts  |  Testimonials  |  News |  

ByteScout, 2003-2008. All other company and product names may be trademarks of their respective companies. Privacy Statement