using System;
using System.Text;
using System.Xml;
using System.Drawing;
using System.Windows.Forms;
//using C1.C1Pdf;
namespace fmtxml
{
	/// 
	/// Summary description for XmlToPdf.
	/// 
	public class SvgToPdf
	{
		private float ConvertToPoints=72f;
		private XmlDocument xmlDoc;
		private string FileName;
		private string FilePath;
		//private C1.C1Pdf.C1PdfDocument _c1pdf;
		
		private string [] FontChoice = 
		   {"Times New Roman",
			"VESymb XXXXXX",
			"VolianDraw XXXXXX",
			"Prestige Elite Tall",
			"Courier New",
			"Arial",
			"Letter Gothic",
			"Times New Roman",
			"Letter Gothic Tall",
			"Letter Gothic Tall",
			"Gothic Ultra",
			"VolianScript"
		};
		private float LeftMargin;				//todo: define in page info
		private float VerticalOffset;			//todo: define in page info
		private bool Portrait;					//todo: define in page info
		public SvgToPdf(string path, string fname)
		{
			LeftMargin=0.5f * ConvertToPoints;	// KBR: TODO
			VerticalOffset=0.5f * ConvertToPoints;	// KBR: TODO
			Portrait = true; // KBR: TODO
			FileName = fname;
			FilePath = path;
			xmlDoc = new XmlDocument();
			XmlTextReader reader = new XmlTextReader(FilePath+"\\"+FileName);
			xmlDoc.Load(reader);
			reader.Close();
			try
			{
				GeneratePDFForFile();
			}
			catch (Exception e)
			{
				MessageBox.Show("Error processing: " + fname, e.Message);
			}
		}
		private void GeneratePDFForFile()
		{
			//_c1pdf = new C1.C1Pdf.C1PdfDocument();
			//string rootname = FileName.Substring(0,FileName.Length-4);
			//// create a pdf file with a page for each macro (i.e. macro element in xml tree), 
			//// put it into the pdf file.
			//XmlNode topnode = xmlDoc.LastChild;
			//XmlNodeList ndlist = topnode.SelectNodes("/g");
			//for (int i=0;i