Load Pdf & Draw Ontop; In A WPF Environment? RRS feed

  • Question

  • I want to load in a pdf (single-page) & draw basic lines ontop of that pdf for the purpose of extracting point geometry (x & y co-ordinates). 

    I've just stumbled across ImageMagic. Anyone able to advise? 

    Monday, June 1, 2020 8:28 PM

All replies

  • We do not provide support for third party libraries in the C# forum. So you'll need to just look around. ImageMagic is one option but a lot of people find iTextSharp more popular. You can even google for using ItextSharp to draw shapes on PDFs to help you. Unfortunately we cannot provide assistance for non-C# questions here.

    Michael Taylor http://www.michaeltaylorp3.net

    Monday, June 1, 2020 8:47 PM
  • The company I work for has a professional .NET library that supports loading PDF and drawing shapes (annotations) on top of the loaded image. These shapes include, among other things, basic lines and ruler objects that can be calibrated for different types of measurement.
    You can find more information about the LEADTOOLS Document Imaging Toolkit on this page:
    There’s a fully-functional free evaluation you can try to let you decide whether the library is suitable for you. You can download it from this page:
    Once installed, you can find the source code for the WPF annotations demo here:
    [LEADTOOLS folder]\Shortcuts\Annotation\.NET Framework Class Libraries\WPF Annotations
    The free evaluation also comes with free technical support through email and chat.
    Thursday, June 4, 2020 6:57 PM
  • The following code snippet shows how to draw shapes including lines, circles, rectangles etc to PDF, it is based on a nuget package - Spire.PDF .

    using System.Drawing;
    using Spire.Pdf;
    using Spire.Pdf.Graphics;
    namespace DrawLines
        class Program
            static void Main(string[] args)
                PdfDocument pdf = new PdfDocument();;
                PdfPageBase page = pdf.Pages[0];
                PdfPath path = new PdfPath();
                path.AddLine(new PointF(40, 50), new PointF(100, 50));            
                PdfPen pen = new PdfPen(Color.DeepSkyBlue, 0.02f);
                page.Canvas.DrawPath(pen, path);
    Besides, there is a free version of Spire.PDF which has a 10 pages limitation per pdf, but it's enough for your requirement (single page pdf).

    Tuesday, June 9, 2020 2:34 AM