ABCpdf .NET Component
The ABCpdf component from WebSuperGoo enables easy creation and manipulation of PDF files from any .NET language. I recently had an urgent project come up that made ABCpdf a perfect fit.
One of our clients request that the reports they used to receive by mail be sent electronically instead. This client had hundreds of locations and we had been hand collating four reports for each location and stuffing each collation into an envelope. Now I had to quickly find a way to do this programatically instead. I didn’t have time to re-write my report module to produce a set of reports for each location, I had to figure out how to create this collation by processing each PDF individually.
First, I modified my existing reports to include a unique Location ID on each page in the format of #!#xxxx#%# where xxxx was the Location ID. I used #!# and #%# to make it easy to locate the position of the ID value on the PDF page.
Of the four reports, one could be considered a “Control” report in that it printed one page for each Location every time. The other reports either had one or more pages per location or zero or more page. For instance, the Control report has one page for each Location and each page as an ID on it (0001, 0002, 0003, 0004). The second report also has at least one page, but sometimes more than one (0001, 0002, 0002, 0003, 0004, 0004, 0004). The third report sometimes doesn’t have any pages for a location and sometimes has more than one page (0001, 0003, 0003, 0004). The same for the fourth report.
Next, I wrote a simple VB.NET program that allowed the user to specify the four report PDFs and then process them. The code walked through each page of the Control report, used the ABCpdf GetText method to extract all the text from the page, then parsed the text to find the Location ID, and added that page to a new PDF file. Next, the code looked at each of the additional reports, used the same text parsing, and added any matching pages to the new PDF file. When finished, the new PDF was written to a new unique file name. Then the next page was processed until the end of the Control PDF was reached.
This entire project was completed in less than a day. There is no way I would have been able to get it done so quickly if it hadn’t been for ABCpdf!
If you’d like to see the code, please leave me a comment and I’ll create a new post walking through the entire project.



