We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to use PDF control in NodeJS environment

Platform: WinForms |
Control: PDF
Tags: pdf

Using PDF control in NodeJS environment

PDF control can be used in NodeJS environment by using EdgeJS. Please follow the steps below to achieve this.

1)Create a new folder(CSharpToNodeJS).

2)Open command prompt and install EdgeJS using npm.

npm install edge


3)Create a new CS file as like below

using System.Threading.Tasks;
using System.Drawing;
using Syncfusion.Pdf;
using Syncfusion.Pdf.Graphics;
namespace Source
    public class Startup
        public async Task<object> Invoke(object outputPath)
            //Create new PDF document
            PdfDocument doc = new PdfDocument();
            //Add new page to the PDF document
            PdfPage page = doc.Pages.Add();
            //Draw a string to the page
            page.Graphics.DrawString("Hello World from .Net",
                new PdfStandardFont(PdfFontFamily.TimesRoman, 10),
                new PointF(100, 100));
            //Save and close the document
            doc.Save(outputPath as string);
            return "PDF generated successfully..!";


4)Create new JS file as like below.

var edge = require('edge');
var CreatePDF = edge.func('Source.dll');
CreatePDF("Output.pdf", function (error, result) {
    if (error) throw error;


5)Place the below required assemblies in the project folder(CSharpToNodeJS)

  1. Syncfusion.Compression.Base.dll
  2. Syncfusion.Pdf.Base.dll

        Copy the required assemblies

6)Open the command prompt and build the cs file with the necessary reference by using the below command.

"C:\Windows\Microsoft.NET\Framework\vx.x.xx\csc.exe" /r:Syncfusion.Compression.Base.dll,Syncfusion.Pdf.Base.dll,System.Drawing.dll /target:library /debug Source.cs


7)Once the command succeed Source.dll will be generated as like below. generated source.dll

8)Run the below code in command prompt to run the C# code with NodeJS.

node Sample.js

        Get the output PDF document

Please find the attached sample for reference.



2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile