Tuesday 28 May 2019

How to add a reference of abcpdf library in a project using Visual Studio 2017 IDE?

Hi Readers,

In this article, We will get to know how to add a reference of abcpdf library in a project using visual studio 2017 IDE.

Step 1. First, create a new project as for this example I am creating a C# Console Application

Step 2: Right click on Reference folder, Browse the library from installed location, Select it

Step 3: Click on OK and it adds into Reference folder.

Step 4: In Code, add the following references

using WebSupergoo.ABCpdf11;
using WebSupergoo.ABCpdf11.Objects;
using WebSupergoo.ABCpdf11.Atoms;
using WebSupergoo.ABCpdf11.Operations;

As in the above namespaces, Objects namespace is mostly used one to manipulate the PDF

Sample Code:
using System.IO;
using WebSupergoo.ABCpdf11;
 
namespace Demos_on_abcpdf
{
    class Program
    {
        static void Main(string[] args)
        {
            string theBasePath = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName;
            string outputFolder = theBasePath + @"\Output\";
            // Create a basic PDF             Doc mainDoc = new Doc(); // This Doc class is coming from WebSupergoo.ABCpdf11 namespace.             mainDoc.AddText("Hello!!! My First PDF Demo using abcpdf library");             mainDoc.Save(outputFolder + "PDFWithSimpleText.pdf");         }     } }


Output:

All these sample codes are available in this Github repository: https://github.com/nuthanm/abcpdf-demos

Happy Coding:)

No comments:

Post a Comment