public void xml_convertTest() { var target = new VatUE2(); // TODO: Initialize to an appropriate value string xml = File.ReadAllText(@"Samples\sample1.xml"); // TODO: Initialize to an appropriate value short output_type = 0; // TODO: Initialize to an appropriate value PdfDocument document = PdfReader.Open(@"Samples\sample1_output.pdf"); var stream = new MemoryStream(); document.Save(stream, false); byte[] outputExpected = stream.ToArray(); stream.Close(); var output = new byte[1]; var error = new Exception(); // TODO: Initialize to an appropriate value var errorExpected = new Exception(); // TODO: Initialize to an appropriate value short expected = 0; // TODO: Initialize to an appropriate value short actual; actual = target.xml_convert(xml, output_type, ref output, ref error); //var d = PdfReader.Open(new MemoryStream(output, 0, output.Length)); //const string filename = @"Samples\sample1_output.pdf"; //document.Save(filename); Assert.AreEqual(expected, actual); }
private void Application_Startup(object sender, StartupEventArgs e) { if (e.Args.Length == 2) { var vatUe2 = new VatUE2(); var output = new byte[1]; var ex = new Exception(); var result = vatUe2.xml_convert(File.ReadAllText(e.Args[0]), 1, ref output, ref ex); if (result == 0) { PdfDocument document = PdfReader.Open(new MemoryStream(output, 0, output.Length)); document.Save(e.Args[1]); } else { Console.Error.WriteLine(PdfSharpControls.Properties.Resources.CommandLineException, ex.Message); } Current.Shutdown(); } else if (e.Args.Length > 0) { Console.Error.WriteLine(PdfSharpControls.Properties.Resources.CommandLineUsage); } }
private static string GeneratePdfFile(string filename) { var c = new VatUE2(); var output = new byte[1]; var ex = new Exception(); var result = c.xml_convert(File.ReadAllText(filename), 1, ref output, ref ex); if (result == 0) { PdfDocument document = PdfReader.Open(new MemoryStream(output, 0, output.Length)); document.Save(_tempPdfFilePath); return _tempPdfFilePath; } throw ex; }