Convert Wpf form to .Pdf report RRS feed

  • Question

  • Dear Sirs

    We have a WPF application which display a complex form for a medical data record. User can also click a button to convert the form into the Pdf format for further reading. The current implementation is a two steps conversion which is to to convert it to .XPS first and then convert it from Xps to .Pdf.

    Unfortunately this is a lengthy procedure. always takes more than 30 seconds to complete. is there any more efficient way for this conversion? maybe just convert without using XPS? 

    Best Regards

    Jeff W

    Friday, June 12, 2020 1:35 AM

All replies

  • Since you're using WPF, how about just display the report in XPS format directly with DocumentViewer control, and add button to save as PDF if needed?
    • Edited by cheong00 Friday, June 12, 2020 2:22 AM
    Friday, June 12, 2020 2:21 AM
  • Dear Sirs

    I am not sure if i have described the question clearly. I am using the Wpf form to display the data which was extracted from a complex medical data record. This display involves quite a few Wpf controls. textbox, listboxes.. Are you suggesting to use the DocumentViewer to show the report in xps format? 

    Best Regards

    Jeff W

    Friday, June 12, 2020 5:20 AM
  • Yes. Since you already have code to generate the report in XPS format, the most logical way to reduce time consumption is to take away the extra step to convert it from XPS to PDF.

    Your company could buy iText and use it to generate report, and I think the performance should be great, but that'll add time for your project to re-create the report in a new way.

    Just suggestion that I think will better fit your scenario.

    Friday, June 12, 2020 5:46 AM
  • Hi Jeff Wei,
    Based on your description, it is mostly related to WPF. So it is recommended to ask the questions in Microsoft Q&A forum and you can get more professional answer.
    Thank you for your understanding.
    Best Regards,
    Daniel Zhang

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, June 12, 2020 6:13 AM
  • Well, generating XPS or PDF report in application is not something WPF specific.

    Only my recommandation to switch viewer component and eliminate a conversion step makes it WPF specific.

    Friday, June 12, 2020 7:23 AM