Open bgulrich opened 5 years ago
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?
@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.
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.
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.
@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:
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"
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.
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