public static void GetAnnotations(string pdf_filename)
        {
            Logging.Info("+Getting legacy annotations from {0}", pdf_filename);

            using (AugmentedPdfLoadedDocument pdf_doc = new AugmentedPdfLoadedDocument(pdf_filename))
            {
                foreach (PdfLoadedPage pdf_page in pdf_doc.Pages)
                {
                    foreach (PdfAnnotation pdf_annotation in pdf_page.Annotations)
                    {
                        {
                            PdfLoadedPopupAnnotation popup_annotation = pdf_annotation as PdfLoadedPopupAnnotation;
                            if (null != popup_annotation)
                            {
                                Logging.Debug("Popup is {0}", popup_annotation.ToString());
                                Logging.Debug("  - text     = {0}", popup_annotation.Text);
                                Logging.Debug("  - icon     = {0}", popup_annotation.Icon);
                                Logging.Debug("  - size     = {0}", popup_annotation.Size);
                                Logging.Debug("  - location = {0}", popup_annotation.Location);
                                Logging.Debug("  - open     = {0}", popup_annotation.Open);
                                Logging.Debug("  - bounds   = {0}", popup_annotation.Bounds);
                                Logging.Debug("  - color    = {0}", popup_annotation.Color);
                                continue;
                            }
                        }

                        {
                            PdfLoadedTextMarkupAnnotation markup_annotation = pdf_annotation as PdfLoadedTextMarkupAnnotation;
                            if (null != markup_annotation)
                            {
                                Logging.Debug("Markup is {0}", markup_annotation.ToString());
                                Logging.Debug("  - size     = {0}", markup_annotation.Size);
                                Logging.Debug("  - location = {0}", markup_annotation.Location);
                                Logging.Debug("  - type     = {0}", markup_annotation.TextMarkupAnnotationType);
                                Logging.Debug("  - color    = {0}", markup_annotation.TextMarkupColor);
                                continue;
                            }
                        }

                        // We don't know what it is
                        {
                            Logging.Info("Unknown annotation {0}", pdf_annotation);
                            Logging.Debug("  - text     = {0}", pdf_annotation.Text);
                            Logging.Debug("  - rect     = {0}", pdf_annotation.Bounds);
                            Logging.Debug("  - location = {0}", pdf_annotation.Location);
                            Logging.Debug("  - flags    = {0}", pdf_annotation.AnnotationFlags);
                            continue;
                        }
                    }
                }
            }


            Logging.Info("-Getting legacy annotations from {0}", pdf_filename);
        }
        private static PDFAnnotation ConvertLegacyAnnotationToPDFAnnotation(PDFDocument pdf_document, int page, PdfLoadedPage raw_pdf_page, PdfAnnotation raw_pdf_annotation)
        {
            // Try a popup
            {
                PdfLoadedPopupAnnotation raw_popup_annotation = raw_pdf_annotation as PdfLoadedPopupAnnotation;
                if (null != raw_popup_annotation)
                {
                    Logging.Debug("  - page       = {0}", raw_pdf_page.Size);
                    Logging.Debug("  - annotation = {0}", raw_popup_annotation.Bounds);
                    Logging.Debug("  - text       = {0}", raw_popup_annotation.Text);

                    // Work out the relative coordinates
                    double BUFFER_HORIZ = 0.05;
                    double BUFFER_VERT  = 0.1;
                    double left         = BUFFER_HORIZ;
                    double width        = 1 - 2 * BUFFER_HORIZ;
                    double top          = 1.0 - (raw_popup_annotation.Bounds.Top / raw_pdf_page.Size.Height) - BUFFER_VERT / 2 + (raw_popup_annotation.Bounds.Height / raw_pdf_page.Size.Height) / 2;
                    double height       = BUFFER_VERT;

                    //Bound it
                    top = Math.Max(0, top);

                    string text = raw_popup_annotation.Icon + ": " + raw_popup_annotation.Text;

                    // Create the annotation
                    PDFAnnotation pdf_annotation = new PDFAnnotation(pdf_document.PDFRenderer.DocumentFingerprint, page + 1, PDFAnnotationEditorControl.LastAnnotationColor, null);
                    pdf_annotation.Legacy = true;
                    pdf_annotation.Left   = left;
                    pdf_annotation.Top    = top;
                    pdf_annotation.Width  = width;
                    pdf_annotation.Height = height;
                    pdf_annotation.Text   = text;
                    return(pdf_annotation);
                }
            }

            // Try a highlight
            {
                PdfLoadedTextMarkupAnnotation raw_markup_annotation = raw_pdf_annotation as PdfLoadedTextMarkupAnnotation;
                if (null != raw_markup_annotation)
                {
                    Logging.Debug("  - page       = {0}", raw_pdf_page.Size);
                    Logging.Debug("  - annotation = {0}", raw_markup_annotation.Bounds);

                    // Work out the relative coordinates
                    double left   = raw_markup_annotation.Bounds.Left / raw_pdf_page.Size.Width;
                    double width  = raw_markup_annotation.Bounds.Width / raw_pdf_page.Size.Width;
                    double top    = 1 - (raw_markup_annotation.Bounds.Top / raw_pdf_page.Size.Height);
                    double height = raw_markup_annotation.Bounds.Height / raw_pdf_page.Size.Height;

                    string text = raw_markup_annotation.TextMarkupAnnotationType.ToString();

                    // Create the annotation
                    PDFAnnotation pdf_annotation = new PDFAnnotation(pdf_document.PDFRenderer.DocumentFingerprint, page + 1, PDFAnnotationEditorControl.LastAnnotationColor, null);
                    pdf_annotation.Legacy = true;
                    pdf_annotation.Left   = left;
                    pdf_annotation.Top    = top;
                    pdf_annotation.Width  = width;
                    pdf_annotation.Height = height;
                    pdf_annotation.Text   = text;
                    return(pdf_annotation);
                }
            }

            // We don't understand this annotation
            {
                return(null);
            }
        }