I just started google to find out my NFOP article on Tech Head Brothers, and
guess what I found that again someone copied content from my site without asking
me and without any reference to the original author, in that case me.
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 ///
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 }
As I am using a lot XML, XML Schema and XSLT, e.g. for the content published
on Tech Head Brothers, it is
natural to use FOP and it’s .NET port
NFOP by Jason Pettys. Jason published a new
version of NFOP
based on the FOP version 0.20.5 that is working better than the first port. I
encourage you to download this version to give it a try.
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:
If you read my two last posts:
Continue readingThis evening I continued my journey with the C# Generics.
I refactored what I described in my post “DataAccessLayer.FindAll(PublishedBy(Author))
“ to be able to use the Design
Pattern Interpreter.
**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.
One of the first development rule is to write human readable
code. Why ? To avoid to have to write comments ;-) Because it
will be read as a spoken language and it
separate important code from distracting one.
This evening (hum morning ;) I decided to give a try to the conversion
wizard integrated in Visual Studio 2005 that let you import older 1.1
projects.
I choosed to import my whole website: Tech Head Brothers. You might
see next the conversion report:
While trying out the new features of the latest Visual Studio 2005 I came
across a really cool one, debugging in the aspx :