Monthly Archives: December 2011

Count LOC in a VS solution

Option #1: Quick-and-dirty Powershell (count non-empty lines) C:\> (dir -include *.cs,*.xaml -recurse | select-string .).Count Option #2: cloc (perl command-line tool) ——————————————————————————- Language files blank comment code ——————————————————————————- XML 6 21 0 30818 C# 18 110 148 518 MSBuild scripts … Continue reading

Posted in Etc | Leave a comment

Get text from PDF file with iTextSharp

string ReadPdfFile(string filename) { var pdfText = new StringBuilder(); var reader = new PdfReader(filename); var pages = reader.NumberOfPages; for (int page = 1; page <= pages; page++) { var tes = new SimpleTextExtractionStrategy(); var pgText = PdfTextExtractor.GetTextFromPage(reader, page, tes); pdfText.Append(pgText); … Continue reading

Posted in .NET | Tagged , | Leave a comment