C# code to read pdf file path

Hi all,

I have created custom activity which reads bar code from pdf ,i have installed the package too but i am facing problem in execution part my debugger is not hitting into my custom activity which i had done,I think i am facing problem while reading pdf please help me out.

Thanks in advance

I got answer…

@MahalingPatil Share it

using iTextSharp.text.pdf;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PQScan.BarcodeScanner;
using Bytescout.BarCodeReader;
using System.Drawing;
using System.IO;
using System.Activities;
using System.ComponentModel;
using System.Threading.Tasks;

namespace Testing1
{
public class Readingbarcode : CodeActivity
{
[Category(“Input”)]
[RequiredArgument]
public InArgument FilePath { get; set; }

    [Category("Output")]
    public OutArgument<string> strResult { get; set; }

    protected override void Execute(CodeActivityContext context)
    {
        //PdfDocument pdf = new PdfDocument();
        string filPath = FilePath.Get(context);
        PdfReader pdfReader = new PdfReader(filPath);
        // int numberOfPages = pdfReader.NumberOfPages;

        Reader barcodeReader = new Reader();
        barcodeReader.BarcodeTypesToFind.Code39 = true;
        barcodeReader.Orientation = OrientationType.VerticalFromBottomToTop;
        FoundBarcode[] barcodes = barcodeReader.ReadFrom(filPath);
        int numberofBarcodes = barcodes.Count();
        List<string> barCodes = new List<string>();
        foreach (FoundBarcode barcode in barcodes)
        {
            int number = 1;
            number += barcode.Page;
            string holdBarcode = barcode.Value.Split('(')[0].ToString() + "," + number.ToString() + "\n";
            barCodes.Add(holdBarcode);  
        }
        string data = string.Join("", barCodes.ToArray());
        strResult.Set(context, data);

    }

}

}

5 Likes

Hello Patil.I am new to this UI path and looking for some sort of support for my project.Would you be interested in giving support.If yes,please reply back to me on vijay140288@gmail.com.Appreciate your help.Thanks in advance.

@MahalingPatil

I am new to UI path, please guide me-

Can I installed the package and use the barcode read activity in uipath?

Yes you need to install the package.

Regards,
Mahaling Patil

Hi @MahalingPatil ,

Please mention the specific package name.

Thanks & Regards,
Jayesh Thorat.

Hi,

I install a package from available packages named “IronBarcode - The C# Barcode & QR Library”

But there is no new activities are added in UI Path.

Please give suggestions. @ClaytonM @palindrome @vvaidya @MahalingPatil @vangara0209

You have just included nuget library . It is not a custom activity … you ll need to write the c# code and use the library to get the bar code…

Hi…
Can you please tell me the package name…

@Jayesh_678 you need to write the c# code and use the library to get the bar code.

hi,MahalingPatil,is it possible to let UIpath to read the barcode on a jpg not PDF?thanks.

1 Like

Hi @MahalingPatil can u pls share Xaml File

Regards,
Balasubramanian

Hi @Ericyan

Welcome to UiPath Community !

You can get some bar-code activities in UiPath Go !

Regards
Balamurugan.S