Note that there are some explanatory texts on larger screens.

plurals
  1. POWPF image vector format export (XPS?)
    text
    copied!<p>Our tool allows export to PNG, which works very nicely. Now, I would like to add export to some vector format. I tried XPS, but the results are not satisfying at all. </p> <p>Take a look at a comparison <a href="http://www.jakubmaly.cz/xps-vs-png.png" rel="nofollow">http://www.jakubmaly.cz/xps-vs-png.png</a>. The picture on the left comes from an XPS export, the picture on the right from PNG export, the XPS picture is visibly blurred when opened in XPS Viewer and zoomed 100%. </p> <p>Are there any settings that I am missing or why is it so? </p> <p>Thanks, Jakub. </p> <p>A sample xps output can be found here: <a href="http://www.jakubmaly.cz/files/a.xps" rel="nofollow">http://www.jakubmaly.cz/files/a.xps</a>. This is the code that does the XPS export: </p> <pre><code>if (!boundingRectangle.HasValue) { boundingRectangle = new Rect(0, 0, frameworkElement.ActualWidth, frameworkElement.ActualHeight); } // Save current canvas transorm Transform transform = frameworkElement.LayoutTransform; // Temporarily reset the layout transform before saving frameworkElement.LayoutTransform = null; // Get the size of the canvas Size size = new Size(boundingRectangle.Value.Width, boundingRectangle.Value.Height); // Measure and arrange elements frameworkElement.Measure(size); frameworkElement.Arrange(new Rect(size)); // Open new package System.IO.Packaging.Package package = System.IO.Packaging.Package.Open(filename, FileMode.Create); // Create new xps document based on the package opened XpsDocument doc = new XpsDocument(package); // Create an instance of XpsDocumentWriter for the document XpsDocumentWriter writer = XpsDocument.CreateXpsDocumentWriter(doc); // Write the canvas (as Visual) to the document writer.Write(frameworkElement); // Close document doc.Close(); // Close package package.Close(); // Restore previously saved layout frameworkElement.LayoutTransform = transform; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload