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. Image for the cookie policy date

PdfHTMLTextElement support in WinRT

Is PdfHTMLTextElement supported in WinRT version? Doesnt seem to be if not what is the equivalent class I can use in WinRT enviroment?


7 Replies

CM Chinnu Muniyappan Syncfusion Team January 6, 2016 09:34 AM UTC

Hi Vasanth,
Thank you for contacting Syncfusion support.
Currently we do not have support for PdfHtmlTextElement in WinRT platform and we are suggesting you to use PdfTextElement to draw text, please refer the below link for more details about PdfTextElement,
http://help.syncfusion.com/file-formats/pdf/working-with-text#creating-a-multicolumn-pdf-document
Regards,
Chinnu


VA Vasanth January 6, 2016 02:40 PM UTC

Hi Chinnu,

Thanks for the reply! I tried to use PdfTextElement but it doesnt seem to work for the scenario I am trying to address. Basically I want some portion of the text paragraph to be in bold font.

Here is an example:

Some Name: You are doing a great job.

So I want the name section to be in bold font but not the comments. Multi-column approach will not work because size of Name is unknown. Please let me know a good approach.




CM Chinnu Muniyappan Syncfusion Team January 7, 2016 12:48 PM UTC

Hi Vasanth,

We have created a simple sample for achieving your scenario, we can’t directly use PdfTextElement  like PdfHtmlTextElement. Instead of we can use more than one PdfTextElement to draw a different font styles. For more details please refer the below code snippet and sample.

Code Snippet[C#]:

            //Create a font

            PdfFont font = new PdfStandardFont(PdfFontFamily.TimesRoman, 12, PdfFontStyle.Bold);


            PdfFont font1 = new PdfStandardFont(PdfFontFamily.TimesRoman, 12, PdfFontStyle.Regular);

          

           

            //Create a Pdf text element

            PdfTextElement element1 = new PdfTextElement("Some Name:", font);


            //draw text element

            PdfLayoutResult result = element1.Draw(page, new System.Drawing.PointF(10, 10));


           //Create a Pdf text element

            PdfTextElement element2 = new PdfTextElement ("You are doing a great jop",font1);


            //draw text element using PdfLayoutResult

            element2.Draw(page, result.Bounds.Right + 10, result .Bounds .Y);


            MemoryStream ms = new MemoryStream();

            //save the document
            doc.Save(ms);

Sample link:
http://www.syncfusion.com/downloads/support/forum/121589/ze/App1-1584338854

Regards,
Chinnu



VA Vasanth January 11, 2016 03:18 PM UTC

Hi Chinnu,

Sample code seems to work only when the text content are small and fits one line. If I change the name & comment to long it doesnt wrap, gets truncated. Is there anything special I need to do for that?

Thanks,
Vasanth


CM Chinnu Muniyappan Syncfusion Team January 12, 2016 08:49 AM UTC

Hi Vasanth,
We have suggested you to use rectangle of bounds instead of PointF on the PdfTextElement Drawing overload, for more details please refer the below sample and code snippet.

           

            //Get the client size of the page

            SizeF pageSize = page.GetClientSize();


            //Calculate the width and height of the text element

            float width = pageSize.Width - (result.Bounds.Right + 10);

            float height = pageSize.Height - result.Bounds.Y;

           

            //draw text element
            element2.Draw(page, new RectangleF(result.Bounds.Right + 10, result .Bounds .Y, width ,height));

Sample link:
http://www.syncfusion.com/downloads/support/forum/121589/ze/App1-1489447044

Regards,
Chinnu



VA Vasanth January 12, 2016 02:17 PM UTC

Hi Chinnu,

Sample is splitting name and content into two columns, but I want them in continuous  fashion. Below is an example:

Some long name: PDF is a standard for encoding documents in an as printed form that is portable between systems. However, the suitability of a PDF file for archival preservation depends on options chosen when the PDF is created: most notably, whether to embed the necessary fonts for rendering the document; whether to use encryption; and whether to preserve additional information from the original document beyond what is needed to print it.

Hope that clears the confusion. Please let me know.


PH Praveenkumar H Syncfusion Team January 13, 2016 04:03 PM UTC

Hi Vasanth,
As we said earlier we don’t have the support for PdfHtmlTextElement in Winrt platform, so as a workaround we have provided sample in last update with PdfTextElement, you have to use multiple PdfTextElement to draw the multiple style text.
Please let us know if you need further assistance.
With Regards,
Praveen

Loader.
Up arrow icon