Print as vector pdf / create vector based image


All our diagram elements are xaml-paths, which were converted from svg images. In the end we are creating a pdf document with a bitmap image on it using the CreateBitmap function but actually we’d rather like to create a vector based pdf from the xaml in order to raise print quality. Is there any way to do this with GoXam?

The easiest way to support that is to let users just print to an XPS or PDF document. That probably doesn’t even require any extra work on your part, since printing to XPS is probably already installed on the user’s machine. Whether or not there is a PDF print driver depends on what other software has been installed there.

I tried this approach and while printing to pdf does create a vector based pdf I was unable to find a way to do so without showing up a save file dialog to the user. Is there a way to use a specific file path instead of having the user pick one?
This is my current approach:

public void Print(Northwoods.GoXam.Diagram diagram)
    var printDialog = new PrintDialog();
    diagram.AllowPrint = true;
    diagram.PrintManager.Scale = double.NaN;            

The default printer was set to the pdf printer which does not show a printing dialog but we need to get rid of the save dialog.

I’m not sure, but apparently you can find information about this at:

Well, the diagram’s print manager only offers a printing function with a PrintDialog as parameter. How am I to influence its behavior?

Well, I think you want to customize the PrintTicket of the PrintDialog.

Here’s the definition of CommandHandler.Print:

    public virtual void Print() {
      Diagram diagram = this.Diagram;
      if (diagram == null) return;
      try {
        PrintManager mgr = diagram.PrintManager;
        if (mgr == null) return;
        PrintDialog dlg = new PrintDialog();
        if (dlg.ShowDialog() == true) mgr.Print(dlg);
      } catch (Exception ex) {

So you could set the PrintDialog.PrintTicket just before calling PrintManager.Print.

EDIT: Hmmm, I’m not sure that PrintTicket is the right mechanism to specify the file path. I’m not familiar with this, so I can’t really help you, other than telling you how the GoXam PrintManager is called.