Archives

Archives / 2007 / April
  • Microsoft Expression Design exports to PDF but not to XPS

    Tags: Microsoft Expression, XPS

    Microsoft Expression Design, version 1.0 is now available for a 60 days trial download, was one product I had big hopes for during the CTP cycle, but now it's just a simple vector editor. Ok, I've said this before and this is not what this post is about...

    Export formats of Expression Design If you now use Design to create images and drawings you have the excellent option of saving or exporting your file in numerous formats other than the Expression Design format; such as GIF, JPEG, PNG, Photoshop format etc. You can even export it to a PDF file, which is great for example when you have a sketch you would like to send to your business partner or friend.

    But why are there no export to XPS?

    Of course, you can use the Microsoft XPS Document Writer to print it out to an XPS file, but I feel like the option should be in the export dialog, at least to promote the XPS format. Has Adobe been there again threatening with law suit?

  • New release of msfeedicon 2.3

    Tags: Internet Explorer, msfeedicon

    The msfeedicon 2.3 application is now available for downloading.

    msfeedicon is a free plugin for the Windows RSS platform and Internet Explorer 7 which displays notifications whenever one of the subscribed feeds contains updates. Read more about it here.

    New in this release is:

    • New icons to enhance usability - due to popular demandNow orange icons is shown when there are unread posts and grey if there are no unread posts.
    • New feature, for Windows Vista only, that disables the notifications when presentation mode is on. For example when a PowerPoint slide is running or when your screen saver is on. Notificatons will be queued up and shown when presentation mode is turned off
    • New feature to clear all queued notifications
    • Numerous fixes

    Download it here.

  • XPS and PDF and standards

    Tags: Microsoft, Software, XPS

    Save as PDF or XPS in Microsoft Office 2007 One of the features of XML Paper Specification, XPS, is the light-weight reader approach and the portable format which Adobe have had the major market share for, and still has, with the PDF format. We all like the approach with having some kind of document format that can be sent to anyone without worrying that they don't have a reader for the document.

    I like that there now are competition on this market, even though I really think that Microsoft with XPS have a long road ahead until they reach an acceptable level of XPS users, even with an XPS reader built in to Windows Vista.

    PDF is today the de facto standard for digital documents and since january this year Adobe has been working with an ISO technical comitee to submit PDF as an open formal standard (ISO 32000).

    I had no luck searching the ISO site for any reference to the ISO 32000, but I easily found the ISO/IEC DIS 29500 which is the proposed standard for Office Open Xml which contains the basic functionality for creating XPS documents.

    This topic is currently pretty hot and for your information here is a good article on the subject XPS vs PDF worth reading: With XPS as PDF killer, Microsoft opens second front on Adobe from Computerworld. The article discusses the main topics in where XPS has an advantage over XPS, such as making XPS more printer friendly by avoid the usage of for example PostScript.

  • Annoying Windows Vista bugs - re-booting is necessary

    Tags: Windows XP, Windows Vista

    I have been running Windows Vista for a few months now and I discover new bugs (and features) every other day. Vista does not seem so stable as it should be. It's no big blue screens or major application crashes but small annoying stuff like not persisting settings and stuff like that.

    I earlier wrote about changing the start menu power button, this changed setting reverts to it's original state about every third boot and then goes back to my changed state on the next boot! I have also written about that icons disappear from the notification area once in a while.

    Another issue that has been hazzling me is that on my development/work machine I have several applications running (Microsoft Offce, Virtual PC, Internet Explorer, Visual Studio) at the same time and at the end of the day I can't get the applications to work properly. Context menus does not appear when they should, buttons is missing in dialogs, windows is not appearing etc.

    Here is an example when I tried to close a Notepad document. First an empty dialog came up with no options...

    So I closed down a Skype window...

    Not much better, but now I could see what the dialog was about, so I closed Excel...

    That was better!

    I never had this problem with Windows XP and it looks like Windows Vista does not handle resources correctly or leaks them. Have you experienced something similar or do you now if there is a solution available?

    Windows Vista is designed to go into standby mode instead of rebooting, just look at the new start menu, more often than previous Windows versions. But the experience so far is that one reboot every day is necessary to get it to work properly. My XP workstation was sometimes not rebooted for a few days because I did not need to. I really hope that the Vista team is listening (yes, I have opened a few support cases but since it's random the most common answers is - sorry can't help you) and that they are working as much as they did in the end of last year before the release to create a great Service Pack 1.

  • Standardization of Office Open XML

    Tags: Microsoft Office, XPS

    Today I recieved an e-mail from the Swedish Standards Institute, SIS, containing the proposal for the Office Open XML as an ISO standard (ISO/IEC DIS 29500). Office Open XML is today an ECMA standard, TC-45, and ECMA has submitted the standard to the ISO fast-track process Office Open XML. The fast-track means that it can be an international standard by this August, read more on the fast-track process in this post by Brian Jones.

    I'm definitely going to second to the proposal.

    I think it's really positive that we might get an open ISO standard for document formats. It will not only open up a lot of opportunities for software developers - better support on multiple platforms (I'd like to see Google Docs & Spreadsheets supporting it), it will also "force" software developers (read Microsoft) to commit to the format and not change it for every other version of Microsoft Office (unless they abandon their "own" standard).

  • FrontView for Media Center on Windows Vista

    Tags: Windows Vista, Windows Media Center, Hardware

    If you have an Ahanix computer case (in my case an MCE 302-SA) with a Samsung VFD and have upgraded your HTPC system to Windows Vista you may have found out that the VFD does not work nor does the drivers available from the Ahanix web site.

    The image has nothing to do with the text and the text has nothing to do with the image, but it's there! But to your rescue there is FrontView for MCE by Media Center Magic. FrontView is an alternative to the default drivers for numerous LCD and VFD displays (CrystalFontz, Samsung, SilverStone etc) optimized for Media Center experience and with a highly customizable interface.

    You can customize the display to show almost whatever you want in different scenarios like playing TV, music or movies.The advanced version has support for RSS feeds and other custom plug-ins.

    FrontView is available in it's professional version for a 30 days trial and then you can use it in free mode.

  • Dissecting XPS, part 6 - reading XPS files programatically

    Tags: .NET, C#, XML, XPS

    The sixth part of the Dissecting XPS series is here and this time we will, finally, look at some code for reading XML Paper Specification [1], XPS, files.

    I will in the following sample not use the Microsoft.NET 3.0 Framework, which has built-in functionality for reading and writing XPS files [2]. Instead I will do it using .NET 2.0 (you can try it in .NET 1.1 if you like) and an excellent ZIP library called #ziplib [3]. This will show you more of what's really happening and it will show you how to integrate XPS into applications built using other .NET Frameworks than 3.0 or in Mono or in what ever you like. For instance, you can use Java and the Java Zip packages.

    Getting the parts

    First of all we look how to retrieve the parts from an XPS document. Retrieving a part from an XPS document is as easy as opening the XPS file using the ZIP library and reading out a file. We start with parsing the Start Part relationships from the XPS package.

       1:  using (ZipFile zipFile = new ZipFile(File.OpenRead(fileName))) {
       2:    ZipEntry startPartEntry = zipFile.GetEntry("_rels/.rels");
       3:    XmlDocument startPartXml = new XmlDocument();
       4:    startPartXml.Load(zipFile.GetInputStream(startPartEntry));
       5:  }

    Now the startPartXml object contains the start part relationships for this Open Packaging Convention [4] document, using this file we can find the FixedDocument part, Core Properties part or others using the System.Xml namespace.

    Getting the Core properties

    If we would like to extract the title of the document we just have to parse the Start Part to find the target for the Core Properties Part file and then parse it for the title:

       1:  NameTable nt = new NameTable();
       2:  XmlNamespaceManager nsmgr = new XmlNamespaceManager(nt);
       3:  nsmgr.AddNamespace("rel", "http://schemas.openxmlformats.org/package/2006/relationships");
       4:  nsmgr.AddNamespace("cp", "http://schemas.openxmlformats.org/package/2006/metadata/core-properties");
       5:  nsmgr.AddNamespace("dc", "http://purl.org/dc/elements/1.1/");
       6:   
       7:  XmlElement coreElm = startPartXml.SelectSingleNode(
       8:    "/rel:Relationships/rel:Relationship[@Type='http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties']",
       9:     nsmgr) as XmlElement;
      10:  string partNamePath = coreElm.GetAttribute("Target");
      11:   
      12:  ZipEntry partNameEntry = zipFile.GetEntry(partNamePath.TrimStart(new char[] { '/' }));
      13:   
      14:  XmlDocument coreXml = new XmlDocument();
      15:  coreXml.Load(zipFile.GetInputStream(partNameEntry));
      16:   
      17:  XmlNode title = coreXml.SelectSingleNode("/cp:coreProperties/dc:title", nsmgr);
      18:  if (title != null) {
      19:      Console.WriteLine("Title of document is " + title.InnerText);
      20:  }
      21:  else {
      22:      Console.WriteLine("Title not found");
      23:  }

    Pretty easy! First of all create an System.Xml.XmlNamespaceManager object which holds the different namespaces that we need to parse the parts (line 1-5). Then select the correct relationship in the Start Part for the Core Properties part (line 7-9). Read the core properties XML (line 10-15)  and finally read the title property (line 17).

    Getting the content

    Getting the rest of the document works in the same way; reading the relationship for the FixedDocument sequence and then retrieve the fixed documents.

    Now you have seen how easy you can start producing your own XPS parsers and readers without using the .NET 3.0 Framwork classes [2] which we will look at next time.

    Further reading and references

    [1] XPS Specification[2] XPS in .NET 3.0[3] #ziplib[4] Open Packaging Convention

  • NVIDIA has released new beta drivers for Windows Vista

    Tags: Windows Vista, Hardware

    Yesterday NVIDIA released a new set of beta drivers for Microsoft Windows Vista, v 158.18. The drivers supports the GeForce 6, 7 and 8 series (not the mobile ones).

    Apart from a number of bug fixes and improvements (to the NVIDIA Control Panel, improved WMV playback quality and 3D performance) the new interesting feature is the PureVideo HD support. But there are numerous things for NVIDIA to fix, jus read the Release Notes.

    Download here: 32 bit and 64 bit.

  • Microsoft XPS Essentials Pack 1.0 RTW

    Tags: Windows XP, Windows Vista, Windows Server 2003, XPS

    Microsoft has released version 1.0 of the XML Paper Specification Essentials Pack. The pack is available for Windows Vista or Windows XP and Windows 2003 Server (both 32 bit and 64 bit versions is available).

    XPS Reader EPXPS Essentials Pack contains

    • An XPS viewer called XPS Viewer EP - for reading XPS files
    • An XPS Document writer - for printing to an XPS file
    • Filters for previewing (IPreview) and searching (IFilter) XPS files
    • Windows Shell handlers, for Windows Explorer integration and thumbnails

    Note: On Windows Vista Internet Explorer will still be the default viewer for XPS files. Just right click any XPS file and choose Open With and then Choose Default Program. In the dialog choose the XPS viewer you want to use as default.

    Choose default program for XPS files

  • Winter is over!

    Tags: Personal

    Finally the winter is over here in Sweden, the spring is here! I'm currently sitting in the car and the sun is shining outside and the temperature is close to 20 degrees celsius outside.

    I really like travelling in the car when the sun shines, and it's even more fun when you are online on the highway - using bluetooth and my HTC TyTN with 3G connection.

  • Windows Vista start menu power button

    Tags: Windows Vista

    The Start menu has dramatically changed in Windows Vista and one of the changes are how you choose to shut down, log of or put your computer to sleep.

    By default the two buttons in the start menu can be used to put your computer to sleep and to log you off. If you really want to turn your computer off you can press the right-arrow button and get a menu where you can shut down, restart etc. Windows XP also has two buttons but instead of having a sleep button it has a shut down button.

    Putting your computer to sleep is a good idea, it saves you some time when starting up Vista and logging on. But, Vista is not that stable yet that you can leave your machine running for days and weeks, at least not for me who works with development and a lot of applications. I always shut the computer down so the memory is fresh when I start to use the computer. So this new menu does not make me work faster.

    I now press the Windows key and then hits the right arrow key three times, to reach the shut down alternative, and then hit enter to shut my machine down.

    To save two keyboard hits or one mouse click you can alter the start menu power button to shut down instead of going to sleep, by going to the Control Panel and Power Options then select Change plan settings for one of your power plans. Then click on Change advanced power settings. This will bring up a dialog in which you can select Start menu power button, in the tree. There you can change what the button will do for you, for each power plan.

    This is how your start menu will look like when you choose to use the button to Shut Down.

  • Dissecting XPS, part 5 - Document properties

    Tags: XML, XPS

    This is the fith part of the Dissecting XPS series and will focus on the Xml Paper Specification, XPS, document properties.

    Core Properties

    The properties used in an XPS document are stored in the Core Properties Part, specified in the Open Packaging Conventions, OPC [1]. The Part is located by reading the [Content_Types].xml file and finding the content type application/vnd.openxmlformats-package.core-properties+xml. A document should have one Core Properties part, so there is no requirement to have one but having serveral indicates an invalid package. But there should be no reason to leave out the part. There are also no requirements on which elements that should be present in the part.

    The Core Properties Part contains information about the title, author, creation time etc which are properties that I think are necessary today, it allows you to locate and find documents faster.

       1:  <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
       2:  <cp:coreProperties 
       3:    xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties"
       4:    xmlns:dc="http://purl.org/dc/elements/1.1/" 
       5:    xmlns:dcterms="http://purl.org/dc/terms/" 
       6:    xmlns:dcmitype="http://purl.org/dc/dcmitype/" 
       7:    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
       8:      <dc:title>Wictor test 1</dc:title>
       9:      <dc:subject>XPS test 1</dc:subject>
      10:      <dc:creator>Wictor Wilen</dc:creator>
      11:      <dcterms:created xsi:type="dcterms:W3CDTF">2007-04-01T00:00:00Z</dcterms:created>
      12:      <dcterms:modified xsi:type="dcterms:W3CDTF">2007-04-02T00:00:00Z</dcterms:modified>
      13:      <cp:contentStatus>Reviewed</cp:contentStatus>
      14:      <cp:category>Test</cp:category>
      15:  </cp:coreProperties>

    The sample above is an example of a Core Properties Path, all available elements and the subset of Dublin Core [2] elmennts can be found in the OPC specification[1].

    Thumbnails

    Thumbnails are great for all kind of files and XPS/OPC allows you to provide your own thumbnail instead of relying on the consumer to create one for you. Thumbnails can be used either on the whole XPS Package or on individual fixed pages. If used on one individual page then it should be used on all pages, according to the specification[3]. Thumbnails are images in the format of either JPEG or PNG.

    Thumbnails are specified as relationships, in the .rels files, using the type http://schemas.openxmlformats.org/package/2006/relationships/metadata/thumbnail, like below. The Target attribute specifies the actual thumbnail file.

       1:  <?xml version="1.0" encoding="utf-8"?>
       2:  <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
       3:    <Relationship Target="/thumbnail/thumbnail.png" Id="R0"
       4:       Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/thumbnail"/>
       5:  </Relationships>

    By now we have covered pretty much of the XPS specification and It's time to look at some code on how to consume and produce XPS files, but that's for the next post in the series.

    Further reading and references

    [1] ECMA-376 Part 2, Office Open Xml, Open Packaging Conventions[2] Dublin Core Metadata Initiative - Metadata Terms[3] XPS Specification

  • Dissecting XPS, part 4 - the content markup

    Tags: XML, WinFX, Windows Vista, XPS

    This part in the Dissecting XPS series will take off were we ended part 3, by looking into how the actual content is marked up.

    The content is contained in the FixedPage element and it is marked up by three different elements

    • the Path element which specified a geometry filled with a brush
    • the Glyphs element which represents text
    • the Canvas element which groups elements together

    The Path element

    A triangle using the Path element The Path element is used to specify a geometry shape and optionally fill it using a brush. This XPS markup code creates the triangle shown on the right.

       1:  Path Stroke="#000000" StrokeThickness="10"> 
       2:   Path.Fill>
       3:    LinearGradientBrush MappingMode="Absolute"  StartPoint="0,0"            EndPoint="0,8" SpreadMethod="Reflect"> 
       4:     LinearGradientBrush.GradientStops> 
       5:       GradientStop Color="#333311" Offset="0.0" /> 
       6:       GradientStop Color="#3333FF" Offset="1.0" /> 
       7:      LinearGradientBrush.GradientStops> 
       8:     LinearGradientBrush> 
       9:   Path.Fill>
      10:   Path.Data> 
      11:    PathGeometry> 
      12:     PathFigure StartPoint="50,50" IsClosed="true"> 
      13:      PolyLineSegment Points="250,50 150,250" /> 
      14:     </PathFigure> 
      15:    </PathGeometry> 
      16:   Path.Data> 
      17:  Path> 

    The Path element syntax contains several advanced features and allows you to create advanced vector graphics including lines, curves, arcs, beziers etc. Read more in the XPS Specification [1] or at Feng Yuans[5] blog (here an example of radial gradient brushes). If you are familiar with the XAML elements then this will be a piece of cake [6].

    The Glyph element

    Hello World using Glyph The Glyph element is used to draw text that has the same font and style. You specify the font, size and the location of the Unicode text to write:

       1:  Glyphs Fill="#000000" FontRenderingEmSize="48"  
       2:  OriginX="100" 
       3:  OriginY="100"  
       4:  UnicodeString="Hello World!"  
       5:  FontUri="../../../Resources/Fonts/arial.ttf" />

    The sample above also requires that we have a Font part (the .TTF file), a relationship to the Font part in the FixedPage and that the TTF Content Type is present in the [Content_Types].xml file.

    As the Path element the Glyph element is very powerful and allows you to do really advanced typing in any kind of written language. You may also apply any kind of brush to fill the glyphs.

    The Canvas element

    The Canvas element groups other elements (Paths, Glyphs or other Canvas elements) together to either group the elements into units or to apply properties to each child or ancestor of the unit, for example opacity.

    By now you should be able to create your own XPS file using just Notepad and a ZIP program. Up next in the series is some more information on the XPS document properties.

    Further reading and references

    [1] XPS Specification[2] Dissecting XPS - part 1 - The basics[3] Dissecting XPS - part 2 - Inside the XPS document[4] Dissecting XPS - part 3 - the Fixed Document[5] The blog of Feng Yuan - master of XPS [6] WPF/XAML Graphics

    Side note: Windows Vista uses XPS as it's internal printer spooling.

  • Microsoft Expression products now for MSDN subscribers

    Tags: Microsoft Expression, Windows Vista

    Microsoft has decided to make the Expression Blend and Expression Web products available for all MSDN Premium subscribers. This is great news for all developers, and a great enhancement to the MSDN subscription.

    The Expression Design application will not be included in the MSDN subscription and neither will Expression Media. I surely can understand why Media is not in but I think that Design should be included. Blend will help developers making nice WPF applications and Web will help out when making nice websites, but there is great need for nice graphics on a website and therefore I think Design should be included in the MSDN subscription.

  • Dissecting XPS - part 3 - the Fixed Document

    Tags: XPS

    This is the third part in the Dissecting XPS Series and this episode will focus on the Fixed Document parts of an XPS document. The previous part described how an XPS document is packed into a package and how we could find the actual document within it.

    FixedDocument and PageContent

    The FixedDocument element [1] is the part of the XPS document which contains the actual pages, which are represented as PageContent elements. The PageContent elements appears in the exact same order in which they should appear in the document and contains a reference to the FixedPage Part and optionally size (width and height) of the page.

    The PageContent elements may also contain LinkTarget elements, which informs the XPS consumer that the page contains these named links (or anchors). This is a smart design that allows the consumer to just scan the FixedDocument Part for all links, instead of browsing through the whole XPS document and all fixed pages. The same is for Width and Height of the PageContent element, which is optional to specify at this level. Specifying the size on the PageContent element allows XPS consumers to make initial previews faster without loading the actual content.

    The example below shows the FixedDocument Part, normally having the extension of .fdoc, of the XPS specification document [1], and you can see how the PageContent element refers to the FixedPage Parts and how the LinkTargets are used to show the links in each part. The FixedPage Parts are normally located in files ending with the .fpage extension and the Source attribute is showing the relative path to the file.

       1:  FixedDocument xmlns="http://schemas.microsoft.com/xps/2005/06">
       2:   PageContent Source="Pages/1.fpage">
       3:    PageContent.LinkTargets>
       4:     LinkTarget Name="PG_1_LNK_1812"/>
       5:    PageContent.LinkTargets>
       6:   PageContent>
       7:   PageContent Source="Pages/2.fpage">
       8:   PageContent>
       9:   PageContent Source="Pages/3.fpage">
      10:    PageContent.LinkTargets>
      11:     LinkTarget Name="PG_3_LNK_1813"/>
      12:    PageContent.LinkTargets>
      13:   PageContent>
      14:  ...
      15:  FixedDocument>

    The FixedPage Part

    The FixedPage Part, representing the actual page, has a FixedPage element as root and that element contains all the other elements that is making up the page. The FixedPage element has some important attributes that are required;

    • The size of the page must be specified, using the Width and Height attributes
    • The default language must be specified, using the xml:lang attribute. The language is specified according to RFC 3066 [2].

       1:  FixedPage xmlns="http://schemas.microsoft.com/xps/2005/06" 
       2:    xml:lang="en-us" 
       3:    Width="816" 
       4:    Height="1056">
       5:  ...
       6:  FixedPage>

    The size of the page, the Width and Height, are specified using a real number in units of the effective coordinate space. By default the coordinate space is defined with units of 1/96" [1]. This size is the actual size of the page, compared to the size at the PageContent element which only are advisory.

    The element also have two optional attributes that are important for viewing and especially printing, called BleedBox and ContentBox. The ContentBox, which is recommended to use, is used to defined an area within or equal to the FixedPage area defined by the (0,0,Width,Height) coordinates and specifies the area that contains all content that must be seen when printing or viewing the page. The BleedBox on the other hand defines a surrounding area of the FixedPage and is used when you,for example, have crop marks and other notations not used in the final output of a document but is used after printing as an aid for cutting or folding. If you are interested in this read through section 3.3 of the XPS Specification [1].

    The FixedPage element optionally also have a Name attribute to identify the page when for example hyperlinking to it.

    Content

    Next time we will look into how the content is marked up using the Path, Glyphs and Canvas elements that are used in the PageContent element.

    Further reading and references

    [1] XPS Specification[2] RFC 3660 - Tags for the Identification of Languages[3] Dissecting XPS - part 1 - The basics[4] Dissecting XPS - part 2 - Inside the XPS document

About Wictor...

Wictor Wilén is a Director and SharePoint Architect working at Connecta AB. Wictor has achieved the Microsoft Certified Architect (MCA) - SharePoint 2010, Microsoft Certified Solutions Master (MCSM) - SharePoint  and Microsoft Certified Master (MCM) - SharePoint 2010 certifications. He has also been awarded Microsoft Most Valuable Professional (MVP) for four consecutive years.

And a word from our sponsors...

SharePoint 2010 Web Parts in Action