Questions tagged [fromhtml]

44 questions
4
votes
1 answer

jsPDF - fromHTML and custom fonts

I am using the jsPDF library with the fromHtml plugin to generate a pdf document from HTML content and it works well. Now I am also trying to add a custom font with this plugin: https://github.com/sphilee/jsPDF-CustomFonts-support However, the two…
cmplx96
  • 1,541
  • 8
  • 34
  • 48
3
votes
1 answer

Android HtmlCompat.toHtml(Spanned) returns improperly nested HTML tags

I have an Edittext (binding.text using view binding) that contains text styled with StyleSpans, i.e. bold and italics. To save the formatted text, I use HtmlCompat.toHtml(spannable) in Kotlin to convert it into HTML. var htmlString =…
Tong Jing Yen
  • 199
  • 2
  • 12
3
votes
0 answers

ImageSpan adds space above image in some API level

I convert HTML string to spannable by using HtmlCompat.fromHtml(...), the ImageGetter I use simply uses Glide to download images. By using ContextCompat.getDrawable(...) for comparison it gives similar result indeed. In emulator with API level 16,…
fikr4n
  • 3,250
  • 1
  • 25
  • 46
3
votes
5 answers

Android: remove deprecation warning for Html.fromHtml

I would like to remove the deprecation warning for Html.fromHtml(string). I tried to do like this: if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) { htmlSpanned =…
Daniele B
  • 19,801
  • 29
  • 115
  • 173
2
votes
3 answers

how to show a String variable with color in alertDialog.setMessage() in android

I want my alertDialog look like this My API is 26, and this is my code so far alertDialog.setTitle("Warning"); alertDialog.setMessage(Html.fromHtml("Are you sure"+"\n"+"\n"+"

Est. Total Cost : $ 9.00…
luke lin
  • 51
  • 4
2
votes
0 answers

how to share the html content with css style

This is on android, and in one adroid app to do sharing the html content via intent. Having an email html content and would like to open the apps share chooser to share using other app. function to do the sharing: Intent shareIntent =…
lannyf
  • 9,865
  • 12
  • 70
  • 152
2
votes
0 answers

Android N - Spanned.subSequence from Html get exception StringIndexOutOfBoundsException on some case

I'm facing this exception on Android N : java.lang.StringIndexOutOfBoundsException line : res.add(new SpannableStringBuilder(in.subSequence(lastImageSpanPosition, spanStart))); I don't know why fromHtml medthod in android N returning different…
Dao Quoc Khanh
  • 613
  • 1
  • 7
  • 13
2
votes
1 answer

Html.fromHtml on Nougat doesn't call custom HtmlHandler

I have a custom TextView, to show html text. For pre-Nougat devices it works. As you already know on Nougat, fromHtml is deprecated and it needs a flag..so my code is like this Spannable s = getRichText(text); if (android.os.Build.VERSION.SDK_INT…
Vasileios Pallas
  • 4,801
  • 4
  • 33
  • 50
2
votes
1 answer

How to remove CSS styling from text

I am getting HTML text from a web service. I removed the HTML by using following code, but CSS code is still there. Code TextView tvNews; tvNews.setText(Html.fromHtml(extractContent)); tvNews = (TextView)…
dev90
  • 7,187
  • 15
  • 80
  • 153
2
votes
0 answers

Android TextView: Html.fromHtml() - Valid URL / Link in an link tag rules?

Are there any rules around (or just the regexp) that explain which URL's a Html.fromHtml(...) call will linkify / accept when placed in an < a > tag? I ask as I'm wasting hours trying to work out what causes some links to be clickable, while others…
arober11
  • 1,969
  • 18
  • 31
1
vote
1 answer

TextView HTML with anchor link

I have a text in HTML with links external and internal (page navigation). When I use this text in Html.fromHtml and display it in a TextView, external links work, but inside the page itself, it does not go. I have already tried both…
1
vote
1 answer

How to add font style to textview android kotlin

I need help, i am stuck in this. My requirement is, I need to add text inside a tooltip. I did that actually. But the text include multiple line text also some lines having bold style other line having regular style with custom font style. By the…
S S
  • 189
  • 5
  • 23
1
vote
0 answers

jsPDF - fromHTML does not write at the correct page

I am doing a small project with jsPDF. I need to write colored text, changing the font size and using bold text. Therefore fromHtml is my choise, because i can easyly do it with css and html. The problem is that only around the half of the page can…
Daniel
  • 11
  • 2
1
vote
0 answers

android.text.html (fromHtml): render inline CSS colors

I have a text like this: Test which is given to Html.fromHtml call, which returns a Spanned used in a StaticLayout drawn on an Android Canvas bound to a Bitmap. The image which is drawn contains this bold text.…
JarsOfJam-Scheduler
  • 2,809
  • 3
  • 31
  • 70
1
vote
2 answers

Html.fromHtml not working with bold text in body while share intent in email

String mailContent = "boldText:" I tried below also but not working. String mailContent = "boldText:" Email intent. Intent sendIntent = new…
Vaibhav K
  • 43
  • 2
  • 12
1
2 3