Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void printAllDataReceiveToolStripMenuItem_Click(object sender, EventArgs e)
- {
- // Load the FO style sheet.
- XslCompiledTransform xslt = new XslCompiledTransform();
- xslt.Load("bookFo.xsl");
- // Execute the transform and output the results to a file.
- xslt.Transform("books.xml", "books.fo");
- }
- private void GeneratePDF(string foFile, string pdfFile)
- {
- FileInputStream streamFO = new FileInputStream(foFile);
- InputSource src = new InputSource(streamFO);
- FileOutputStream streamOut = new FileOutputStream(pdfFile);
- Driver driver = new Driver(src, streamOut);
- driver.setRenderer(1);
- driver.run();
- streamOut.close();
- }
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using System.Timers;
- using System.Net.Sockets;
- using System.Threading;
- using System.Net;
- //add data to xml
- using System.Xml;
- using System.Xml.Linq;
- //convert to pdf
- using System.Xml.Xsl;
- using System.Xml.XPath;
- using System.IO;
- using org.apache.fop;
- using org.apache.fop.apps;
- using org.apache.fop.tools;
- using org.xml.sax;
- using java.io;
- Microsoft.Office.Interop.Word.Application word = new Microsoft.Office.Interop.Word.Application();
- wordDocument = word.Documents.Open(savedFileName, ReadOnly: true);
- wordDocument.ExportAsFixedFormat(attahcmentPath + "/pdf" + attachment.BetAttachmentCode + ".pdf", Microsoft.Office.Interop.Word.WdExportFormat.wdExportFormatPDF);
- word.Quit(false);
Add Comment
Please, Sign In to add comment