locked
V4 Print Drivers: Why no read access to UserPropertyBag from JavaScript constraint script?

    Question

  • Hello,

    In our Printer Extension we would like user to be able to add custom options to some features and then to print with those custom options. Examples of such options are custom paper sizes and custom watermarks. In order for these options to pass validation we need to extend PrintCapabilities in the completePrintCapabilities JavaScript API and add these custom options to the corresponding feature XML elements. But how can we pass information about custom options to JavaScript constraint script?

    The appropriate place to store these custom options would be UserPropertyBag, but it is not accessible from JavaScript.

    How can we solve this problem?

    Thank you.

    Thursday, May 31, 2012 7:17 AM

Answers

All replies

  • Hi Kondakovdmitry,

    I believe you are using the wrong tool for the job. The user property bag starts with an uninitialized state and is not synchronized across client and server. As a result, it is a bad place to store information about the watermarks or custom paper sizes. In contrast, the driver property bag is synchronized across client and server, has a read-only initial state and is accessible in constraint JavaScript. If you put the information there, you could build the feature/option/property tree in the completePrintCapabilities JavaScript function and then consume it in your printer extension.

    We intend for the user property bag to store things like user preferences. So for instance, if a user indicates in a printer extension that they always want to print 2-sided, you could put that into the user property bag and then ensure it is applied in any/all of the JavaScript, printer extension, or Metro style device app. I should also add that in the Release Preview, we have made user property bags accessible from constraint JavaScript, so please download that and have a look.

    Thanks!

    Justin

    Thursday, May 31, 2012 10:11 PM
  • Hi Justin,

    First, it's good news that user property bag is now accessible from JavaScript in Release Preview! Thank you.

    As for the place to store custom options, perhaps I was not very clear describing our problem. Driver property bag does not fit our needs because it is read-only. We need a writable storage, because we want users to be able to define and add their own paper sizes and watermarks after the driver is installed.

    For example, user finds that their favorite paper size is not listed in the predefined driver options. In this case they can define their own additional paper size and print with it. So it seems user property bag might be a better place to store such information.

    Best regards,

    Dmitry.

    Friday, June 1, 2012 4:07 AM
  • Dmitry,

    The following thread should be helpful:

    http://social.msdn.microsoft.com/Forums/en-US/wdk/thread/f0a00ea5-c69d-4f93-852f-5f0f66aedd23

    Best Wishes - Eric

    Friday, June 8, 2012 7:18 AM
    Moderator