Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API to generate PDF (or XPS) documents #672

Open
bgulrich opened this issue May 8, 2019 · 6 comments
Open

API to generate PDF (or XPS) documents #672

bgulrich opened this issue May 8, 2019 · 6 comments
Assignees
Labels
feature proposal New feature proposal team-Controls Issue for the Controls team

Comments

@bgulrich
Copy link

bgulrich commented May 8, 2019

Proposal: API to generate PDF (or XPS) documents

Summary

In some LOB applications, XAML controls are a good way to present a user with an interactive form that can highlight sections that should be filled out, accept signatures in inking panels, etc. Once complete, it would be helpful to be able to save the contents of this control as a PDF (or XPS document).

Rationale

Many LOB applications require a locked copy of a document that isn't merely recreated from source data at runtime. This would also be helpful in scenarios where the underlying document template changes over time.

Functional Requirements

Important Notes

Open Questions

@bgulrich bgulrich added the feature proposal New feature proposal label May 8, 2019
@msft-github-bot msft-github-bot added the needs-assignee-attention Assignee needs to follow-up or investigate this issue label May 9, 2019
@chrisglein
Copy link
Member

In the short term it seems like a WebView would be able to do what you want. To know how to accomplish this for XAML can you give a bit of an overview of what kind of form controls you're using and what you would expect from a PDF export?

@LucasHaines
Copy link

LucasHaines commented Jun 12, 2019

@bgulrich Would you want an entire page or portions of the page? Also, please take a look at #82 where we have outlined a forms control. While this scenario isn't called out directly (i will add it), it seems like the right way to achieve the functionality you have described.

@jevansaks jevansaks removed the needs-assignee-attention Assignee needs to follow-up or investigate this issue label Jul 3, 2019
@verelpode
Copy link

I see this PDF issue wasn't closed or relocated, so does this also mean that the microsoft-ui-xaml repo is the correct repo to post issues regarding Windows.Data.Pdf.PdfDocument?

@bgulrich wrote:

it would be helpful to be able to save the contents of this control as a PDF (or XPS document).

Isn't your proposal practically the same as the preexisting ability of a UWP app to print anything to the virtual printers named "Microsoft Print to PDF" and "Microsoft XPS Document Writer"? What's the difference? Why can't you use Windows.Graphics.Printing and Windows.Devices.Printers etc?

I'm not saying you're wrong. I'm just asking questions to try to gain a better understanding of your proposal. PDF's are also important in our environment.

@chrisglein wrote:

In the short term it seems like a WebView would be able to do what you want.

Unless I'm mistaken, WebView supports neither display of PDF's nor printing a HTML webpage to any printer. In contrast, the beta version of WebView2 does support both of those functions.

@stefankueng
Copy link

I think the problem with using the virtual printers is that they require user interaction because you can't print to those without showing the print UI, and you can't specify the resulting filename/location to where it prints to. So basically you can not create a pdf/xps automatically, e.g. in a background task.

@verelpode
Copy link

@stefankueng
Good point! I didn't know that this is another feature in the list of features available in WPF but lost in UWP. Although the UWP and WinUI teams are doing a fantastic job, it would also be helpful to understand that it's very frustrating for developers when a preexisting capability is lost and remains lost for years.

There are 2 issues there:

  1. WPF (but not UWP) apps can skip the print dialog.
  2. I don't know whether WPF allows the output PDF or XPS file name/path to be specified programmatically for those virtual printers.

Obviously it would be beneficial for UWP apps to support both of the above. The default security setting should be to disallow UWP apps from skipping the print dialog, but this security issue has an easy solution: In the "Capabilities" section of the "Package.appxmanifest", create a new capability that represents printing without dialog.

A supplementary proposal is: Extend Windows.Data.Pdf to support PDF creation. Currently it only supports rendering. If it is extended to support PDF creation, then this would operate without the printing API, thus print dialogs would be non-applicable. It could also be usable in ASP.NET web-apps in addition to UWP apps -- this would be a big advantage, especially because many web-apps need the ability to create PDF documents. Does anyone know which repo owns the namespace Windows.Data.Pdf?

I found the following request in UserVoice. We can all add our votes and comments to it.
"Allow direct printing without Modern UI print dialog"

@199621616
Copy link

PDF、PDF、PDF。
A large number of paper information carriers are not available, and a large number of information carriers need to be changed to PDF. We need a fully functional PDF generation API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature proposal New feature proposal team-Controls Issue for the Controls team
Projects
None yet
Development

No branches or pull requests

8 participants