public FileResult downloadmany(string Csharp, string Pascal, string Python, string Cpp)//([FromBody]List<Lang> l) { List <Lang> l = new List <Lang>(); l.Add(new Lang { name = "C#", text = Csharp }); l.Add(new Lang { name = "Pascal", text = Pascal }); l.Add(new Lang { name = "Python", text = Python }); l.Add(new Lang { name = "C++", text = Cpp }); ExportPdf pdf = new ExportPdf(); string folder = Server.MapPath("~/Downloads/"); //string folder = @"C:\pdfBatchPassport\"; string path = pdf.CreatePDFList(folder, l); byte[] mas = System.IO.File.ReadAllBytes(path); string file_type = "application/pdf"; string file_name = "convertorcode.pdf"; return(File(mas, file_type, file_name)); }
public void TestExportPdf() { var id = CreateTestDocument(filePath); var fileStream = ExportPdf.DriveExportPdf(id); var content = Encoding.UTF8.GetString(fileStream.ToArray()); Assert.AreNotEqual(0, content.Length); Assert.AreEqual("%PDF", content.Substring(0, 4)); }
public FileResult downloadone(string pname, string ptext)//([FromBody]List<Lang> l) { Lang l = new Lang { name = pname, text = ptext }; ExportPdf pdf = new ExportPdf(); string folder = Server.MapPath("~/Downloads/"); //string folder = @"C:\pdfBatchPassport\"; string path = pdf.CreatePDFLang(folder, l); byte[] mas = System.IO.File.ReadAllBytes(path); string file_type = "application/pdf"; string file_name = "code.pdf"; return(File(mas, file_type, file_name)); }
public void ScriptureReplaceBookNametoBookCodeTest() { _projInfo.ProjectInputType = "Scripture"; const string file = "ScripturePreview"; ExportProcess(file); string outputXhtmlFile = Common.PathCombine(_outputPath, file + ".xhtml"); File.Copy(_projInfo.DefaultXhtmlFileWithPath, outputXhtmlFile, true); ExportPdf pdfObj = new ExportPdf(); pdfObj.ReplaceBookNametoBookCode(outputXhtmlFile); FileCompare(file, ".xhtml"); }
public void ExportDictionaryTest() { string inputSourceDirectory = FileInput(""); string outputDirectory = FileOutput(""); if (Directory.Exists(outputDirectory)) { Directory.Delete(outputDirectory, true); } FolderTree.Copy(inputSourceDirectory, outputDirectory); Param.SetLoadType = "Dictionary"; Param.LoadSettings(); _projInfo.ProjectPath = outputDirectory; _projInfo.ProjectInputType = "Dictionary"; _projInfo.DefaultXhtmlFileWithPath = Common.PathCombine(outputDirectory, "ExportDictionarymain.xhtml"); _projInfo.DefaultCssFileWithPath = Common.PathCombine(outputDirectory, "ExportDictionarymain.css"); var target = new ExportPdf(); const bool expectedResult = true; bool actual = target.Export(_projInfo); Assert.AreEqual(expectedResult, actual); }
private void BT_export_Click(object sender, RoutedEventArgs e) { ExportPdf.ManipulatePdf(sale); }