I was asked about the new way to work with NFOP to generate the pdf without
the old Engine class. So here is what I am doing:

1 #region Using
2
3 using System.Net;
4 using System.Reflection;
5 using System.Xml;
6 using System.Xml.Xsl;
7 using java.io;
8 using log4net;
9 using org.apache.fop.apps;
10 using org.xml.sax;
11 using TechHeadBrothers.Portal.UI;
12 using StringWriter = System.IO.StringWriter;
13
14 #endregion
15
16 namespace TechHeadBrothers.TechHeadBrothers.Portal.UI
17 {
18 ///


19 /// Strategy to print PDF using FOP
20 ///

21 public class FOPPrintStrategy : PrintStrategy
22 {
23 #region Logging Definition
24
25 private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
26
27 #endregion
28
29 protected override void Print(PrintArticle page, string xmlpath, string xslpah, XsltArgumentList xsltargs)
30 {
31 string fullFoDoc = XmlContentToFoContent(page, xmlpath, xslpah);
32
33 InputSource source = new InputSource(fullFoDoc);
34 ByteArrayOutputStream output = new ByteArrayOutputStream();
35
36 try
37 {
38 Driver driver = new Driver(source, output);
39 driver.setRenderer(Driver.RENDER_PDF);
40 driver.run();
41 output.close();
42
43 int sz = output.buf.Length;
44 byte[] pdf = new byte[sz];
45 for (int i = 0; i < sz; i++)
46 pdf[i] = (byte) output.buf[i];
47
48 page.Response.ClearHeaders();
49 page.Response.Clear();
50
51 page.Response.AddHeader(“Content-Disposition”, “attachment; filename=TechHeadBrothers.pdf”);
52 page.Response.ContentType = “application/octet-stream”;
53
54 page.Response.Flush();
55 page.Response.BinaryWrite(pdf);
56 page.Response.End();
57 }
58 catch (FOPException fope)
59 {
60 if (log.IsDebugEnabled)
61 log.Debug(fope.getMessage());
62 }
63 }
64 }

Comment and share

The **latest **release of Updater Application Block, version 2.0, can be
downloaded from Microsoft
Download Center
.

Updater Application Block, version 2.0, uses other application blocks
included in *patterns & practices *Enterprise Library. The Updater
Application Block uses the Configuration Application Block and the Cryptography
Application Block. You can choose to use these in your application or just take
them as part of the implementation of the updater. Enterprise Library was
released in January 2005. To learn about and download Enterprise Library, use
the following links:

Continue reading

**Groove Virtual Office added to lineup of Microsoft Office System
products, servers and services
**Microsoft Corp. (Nasdaq: MSFT) today
announced it will acquire Groove Networks, a leading provider of collaboration
software for the ‘virtual office’. The deal unites two top technology innovators
that help geographically distributed work groups be as productive as those that
work in a single physical location. Financial terms of the acquisition were not
disclosed.

Continue reading
Author's picture

Laurent Kempé

I am an experienced Team Leader & Distinguished Solution Architect with a passion for shipping high-quality products by empowering development team and culture toward an agile mindset. I bring technical vision and strategy, leading engineering teams to move product, processes and architecture forward.


Team Leader, Distinguished Solutions Architect


Illzach, France