We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

convert xaml to pdf?

Thread ID:

Created:

Updated:

Platform:

Replies:

114548 Nov 24,2013 02:47 AM UTC Oct 15,2018 12:03 PM UTC WinRT 9
loading
Tags: PDF
Nate Snowball
Asked On November 24, 2013 02:47 AM UTC

I'm developing a LOB app for my company.  The app has forms and auto-complete textboxes for people to fill out.  Can syncfusion convert an xaml grid to pdf similar to the new api in windows 8.1 where you can render an xaml to bitmap?


If not, how would I go about using syncfusion to convert the generated bitmap into pdf? 


George Livingston [Syncfusion]
Replied On November 26, 2013 08:55 AM UTC

Hi Nate,

Thank you for using Syncfusion product.

Yes it is possible to insert the images into the PDF document. At present, we do support JPEG encoded images.  Please find the sample available in the link below,

DrawImageSample.zip

Please let us know if you need any further assistance.

Regards,

George


Nate Snowball
Replied On November 27, 2013 01:17 AM UTC

Can you please give me an example where the image is already generated in the app and not from a file?  Remember that my app takes a snapshot of the xaml grid and creates a bitmap out of it.  What I'm trying to do now is create a pdf file out of this image.


George Livingston [Syncfusion]
Replied On November 27, 2013 10:56 AM UTC

Hi Nate,

Thank you for your update.

We have created the sample to convert XAML to bitmap and then to PDF, Please find the sample available in the link below,

http://www.syncfusion.com/downloads/support/directtrac/116000/XamlToPdfWinRT-1905009446.zip

Please let us know if the solution helps.

Regards,

George


Nate Snowball
Replied On November 27, 2013 05:10 PM UTC

One last question.  How do I set the page orientation?  I know it should be something obvious, but I can't seem to get it.  Many thanks.


George Livingston [Syncfusion]
Replied On November 28, 2013 12:54 PM UTC

Hi Nate,

Thank you for your update.

Please use the below code snippet to set the page orientation, herewith we have attached the sample for your reference.

PdfDocument document = new PdfDocument();

document.PageSettings.Orientation = PdfPageOrientation.Landscape;

Sample Link: http://www.syncfusion.com/downloads/support/directtrac/115661/XamlToPdfWinRT1456811131.zip

Please let us know if you need any further assistance.

Regards,

George


Syed Faisal Shah
Replied On June 1, 2018 05:48 AM UTC

H,

When I try to download the sample it says access denied.

Sowmiya Loganathan [Syncfusion]
Replied On June 4, 2018 09:56 AM UTC

Hi Nate, 

Please find the below KB link to convert XAML to PDF in UWP platform, since we have marked WinRT as classic platform. 


Please let us know if you have any concerns. 

Regards, 
Sowmiya L 


padmaja
Replied On October 14, 2018 05:21 PM UTC

Its only converting the visible portion of the window, If the window has scroll bars or multipage, Its not converting the entire content.

KarthikeyanC [Syncfusion]
Replied On October 15, 2018 12:03 PM UTC

Hi Padmaja, 
Thank you for contacting Syncfusion support. At present we do not have direct API for converting XAML to PDF. We can achieve this feature by converting the XAML to Image and then image to PDF. In this KB we have provided a work around sample for converting XAML to Image using the RenderTargetBitmap. XAML to image conversion depends on the UI element which we are given in the RenderAsync method. 

We have created a simple sample, enabled the scroll bar and added the Textbox control in bottom of the XAML page. The textbox is not visible in the current view of XAML page, and the text box preserved fine in the output PDF. Please make sure parameter of the  RenderAsync method is the parent of all UI element, so that the child controls will be preserved in the image. 

Code snippet: 
            //Create the Bitmpap from xaml page 
            await renderTargetBitmap.RenderAsync(SyncfusionForm); 
            var pixelBuffer = await renderTargetBitmap.GetPixelsAsync(); 
 
Please find the sample and output PDF below for your reference. 
Kindly check the above sample and let us know if you need further assistance on this. 
Regards, 
Karthikeyan  


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;