How to Create a Dynamic Labor Contract with ComPDFKit

By ComPDFKit | 2023 May 10

Labor contracts are adjusted as the company continues growing. In the case of telecommuting and cross-regional offices becoming more and more common, the electronification of labor contracts is becoming more and more important. ComPDFKit can fully meet the company's needs, so let's take a look at how to use ComPDFKit to create dynamic labor contracts!

What Are Dynamic Labor Contracts


An employment contract describes the agreement between an employee and an employer, including details such as job duties, duration, location of work, amount of remuneration, and method of payment? After both parties agree to the labor terms, they will sign and make their own backups.


A dynamic labor contract can undergo more frequent changes than a standard, more static contract because it is designed to meet a specific project or need. The department that oversees the contract (human resources, company management, or employees) should be able to modify it as circumstances or projects change. 


Here’s the old paper based flow:

         - Find the contract, maybe changed a little.

         - Print it out.

         - Pen in the relevant details

         - Send the paper package to the freelancer.

         - They sign it, they send it back.

         - You sign it and voila.


With the features we are going to mention below while using ComPDFKit, the whole flow can be digital and more efficient.

About ComPDFKit


ComPDFKit is a professional PDF software development kit for developers. Seamlessly enable high-performance PDF viewing, annotating, editing, signing, and more in your apps or any mobile, desktop, web, or server framework. 


Here are the features you can achieve with ComPDFKit.


         - You can search and select the PDF text, quickly jump to where you want, and even edit the text such as adding, deleting, changing the color, etc.

         - You can compare the difference between two similar contracts

         - You can sign an employment contract

         - You can secure PDFs with encryption/decryption

         - You can merge pages from existing PDF files, add them again, and create a new PDF


With ComPDFKIt, checking, printing, signing, stamping, and archiving can all be done online: the employer and the employee can check the electronic version of the PDF and sign it if it is correct, and then synchronize it to each other. Both parties can perform cloud backup without worrying about contract preservation.


If there is a situation such as a personnel transfer, the previous contract needs to be voided. Thus, sensitive information can also be redacted to prevent the risk of information leakage. Redaction means the data had been deleted for good, no tech methods can restore the data.



Set up the App and configure the SDK


Fire up Visual Studio 2017, choose File -> New -> Project..., and then select Visual C# -> Console App (.Net Framework), choose .Net Framework 4.6.1 as the programming framework. Place the project to the location as desired. Then, click OK.


Set up the App and Configure the SDK


Copy the ComPDFKit.Desk.dll and ComPDFKit.Viewer.dll DLL files and x64 or x86 folder depending on your build configurations in the lib folder to the project dynamic_labor_contract_example folder.


Add ComPDFKit PDF SDK dynamic library to References. In order to use ComPDFKit PDF SDK APIs in the project, you must first add a reference to it.


In Solution Explorer, right-click the dynamic_labor_contract_example project and click Add -> Reference


Solution Explorer


In the Add Reference dialog, click Browse tab, navigate to the dynamic_labor_contract_example folder, select ComPDFKit.Desk.dll and ComPDFKit.Viewer.dll dynamic library, and then click OK


Add Reference dialog


Add ComPDFKit.dll to the project. Include the x64 or x86 folder into the project. Please make sure to set the property Copy to Output Directory of ComPDFKit.dll to Copy if newer. Otherwise, you should copy it to the same folder with the executable file manually before running the project.


Add ComPDFKit.dll


It is important that you set the license key before using any ComPDFKit PDF SDK classes.


set the license key


        private static bool VerifyLicense()
            bool result = CPDFSDKVerifier.LoadNativeLibrary();
            if (!result)
                return false;

            string devKey = "Write your devKey here";
            string devSecret = "Write your devSecret here";

            LicenseErrorCode verifyResult = CPDFSDKVerifier.LicenseVerify(devKey, devSecret);
            if (verifyResult != LicenseErrorCode.LICENSE_ERR_SUCCESS)
                return false;

            return true;



Create a PDF Form


ComPDFKit PDF SDK supports all form types specified by the PDF specification (such as text boxes, checkboxes, radio buttons, drop-down lists, pushbuttons, and signatures)


Now let us enjoy the way to create a text box type form in PDF document using the ComPDFKit PDF SDK.


         private static bool AddInteractiveForms()
            //Load a document by file path, then select its first page
            CPDFDocument document = CPDFDocument.InitWithFilePath(inputFilePath);
            CPDFPage page = document.PageAtIndex(0);

            //Create a form field so that you can change its content as you wish.
            CPDFTextWidget formfield = page.CreateWidget(C_WIDGET_TYPE.WIDGET_TEXTFIELD) as CPDFTextWidge;

            //Prepare some color data in RGB format
            byte[] red = { 255, 0, 0 };
            byte[] white = { 255, 255, 255 };
            byte[] blue = { 0, 0, 255 };

            //Create a rect, it will have red border and white backgrond, 
            formfield.SetRect(new ComPDFKit.Import.CRect(100, 100, 500, 300));

            //Set font color as blue, CTextAttribute is a data struct for memorize font' s information, included font name, font size and font color.
            //The good news is that we have provided CFontNameHelper to save you from a mess of parameter settings.
            //As you see, the font size is 20, the font color is blue
            CTextAttribute textAttribute = new CTextAttribute();
            textAttribute.FontName = CFontNameHelper.ObtainFontName(CFontNameHelper.FontType.Helvetica, false, false);
            textAttribute.FontSize = 20;
            textAttribute.FontColor = blue;

            //This function sets up single or multiple rows.
            //If true, these text will be top-aligned vertically, otherwise they will be center-aligned vertically.

            //Set the defaule filled text, and save it.
            //you've done this!
            formfield.SetText("Default Text");
            document.WriteToFilePath(outputFilePath + "form.pdf");
            return true;


Create a PDF Form


form types





With ComPDFKit, you have a time-saving method to make changes to your PDF contracts. 


The ComPDFKit PDF SDK not only simplifies forms but allows developers to incorporate powerful PDF technology into their applications such as viewing, searching for text, bookmarking, or annotating PDF documents.

For more info on what ComPDFKit offers, check this Feature List.