Guest User

Untitled

a guest
Jan 18th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. private void printAllDataReceiveToolStripMenuItem_Click(object sender, EventArgs e)
  2. {
  3. // Load the FO style sheet.
  4. XslCompiledTransform xslt = new XslCompiledTransform();
  5. xslt.Load("bookFo.xsl");
  6.  
  7. // Execute the transform and output the results to a file.
  8. xslt.Transform("books.xml", "books.fo");
  9. }
  10. private void GeneratePDF(string foFile, string pdfFile)
  11. {
  12. FileInputStream streamFO = new FileInputStream(foFile);
  13. InputSource src = new InputSource(streamFO);
  14. FileOutputStream streamOut = new FileOutputStream(pdfFile);
  15. Driver driver = new Driver(src, streamOut);
  16. driver.setRenderer(1);
  17. driver.run();
  18. streamOut.close();
  19. }
  20.  
  21. using System;
  22. using System.Collections.Generic;
  23. using System.ComponentModel;
  24. using System.Data;
  25. using System.Drawing;
  26. using System.Linq;
  27. using System.Text;
  28. using System.Windows.Forms;
  29. using System.Timers;
  30. using System.Net.Sockets;
  31. using System.Threading;
  32. using System.Net;
  33.  
  34. //add data to xml
  35. using System.Xml;
  36. using System.Xml.Linq;
  37. //convert to pdf
  38. using System.Xml.Xsl;
  39. using System.Xml.XPath;
  40.  
  41.  
  42. using System.IO;
  43.  
  44. using org.apache.fop;
  45. using org.apache.fop.apps;
  46. using org.apache.fop.tools;
  47. using org.xml.sax;
  48. using java.io;
  49.  
  50. Microsoft.Office.Interop.Word.Application word = new Microsoft.Office.Interop.Word.Application();
  51.  
  52. wordDocument = word.Documents.Open(savedFileName, ReadOnly: true);
  53. wordDocument.ExportAsFixedFormat(attahcmentPath + "/pdf" + attachment.BetAttachmentCode + ".pdf", Microsoft.Office.Interop.Word.WdExportFormat.wdExportFormatPDF);
  54.  
  55. word.Quit(false);
Add Comment
Please, Sign In to add comment