C# code to read pdf file path


#1

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


#2

I got answer…


#3

@MahalingPatil Share it


#4

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

Try using ZetPDF.com
It worked for me!

Best regards

Fred Green


#6

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.