using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace XFViewerCtrlSample
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void openFileBtn_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.DefaultExt = "fo";
            dlg.Filter = "XSL-FO Documents (*.fo)|*.fo";
            dlg.ShowDialog();
            dlg.Multiselect = false;
            if (dlg.FileNames.Length > 0)
                viewerCtrl.LoadFile(dlg.FileNames[0]);
        }

        private void loadXmlBtn_Click(object sender, EventArgs e)
        {
            String xml = "<fo:root xmlns:fo='http://www.w3.org/1999/XSL/Format'>" +
                                "<fo:layout-master-set>" +
                                "<fo:simple-page-master master-name='all-pages'>" +
                                "<fo:region-body region-name='xsl-region-body' margin='0.7in'/>" +
                                "</fo:simple-page-master>" +
                                "</fo:layout-master-set>" +
                                "<fo:page-sequence master-reference='all-pages'>" +
                                "<fo:flow flow-name='xsl-region-body'>" +
                                "<fo:block>Hello World!</fo:block>" +
                                "</fo:flow>" +
                                "</fo:page-sequence>" +
                                "</fo:root>";
            viewerCtrl.LoadXml(xml, @"C:\");
        }
    }
}