Adding barcode image to pdf

Q: I’m trying to add an Barcode Image to my pdf. I have the following

            using (PDFDoc pdfdoc = new PDFDoc(pdffile))
                using (ElementBuilder bld = new ElementBuilder
()) // Used to build new Element objects
                    using (ElementWriter writer = new ElementWriter
()) // Used to write Elements to the page
                        Page page = pdfdoc.GetPage(pdfdoc.GetPageCount

                        Image img = Image.Create(pdfdoc, bmp);
                        Element element = bld.CreateImage(img);


The line writer.WritePlacedElement(element); throws an Unknown
Exception. Could you pleace help me out?
A: You need to tell PDFNet to which page you are writing. This is
done using writer.Begin(page) method.