SwiftUI tappable subtext

Update for iOS 15 and higher: There is a new Markdown formatting support for Text, such as: Text(“Some text [clickable subtext](some url) *italic ending* “) you may check WWDC session with a timecode for details The old answer for iOS 13 and 14: Unfortunately there is nothing that resembles NSAttributedString in SwiftUI. And you have … Read more

C# Extract text from PDF using PdfSharp

Took Sergio’s answer and made some extension methods. I also changed the accumulation of strings into an iterator. public static class PdfSharpExtensions { public static IEnumerable<string> ExtractText(this PdfPage page) { var content = ContentReader.ReadContent(page); var text = content.ExtractText(); return text; } public static IEnumerable<string> ExtractText(this CObject cObject) { if (cObject is COperator) { var cOperator … Read more

Where is the Origin (x,y) of a PDF page?

The dimensions of a page (aka the page boundaries) are defined in a page dictionary: /MediaBox: the boundaries of the physical medium (the page). This value is mandatory, so you’ll find it in every PDF. /CropBox: the region that is visible when displayed or printed. The /CropBox is equal to or smaller than the /MediaBox. … Read more

Android append text file

I figured it out….I had to change the line FileOutputStream fOut = openFileOutput(“savedData.txt”, MODE_WORLD_READABLE); to FileOutputStream fOut = openFileOutput(“savedData.txt”, MODE_APPEND); After that I was able to append the text file without overwriting the data that was already inside the text file. Thanks for your assistance guys. I guess going to the 4th page on google … Read more

automatically position text box in plot

Just use annotate and specify axis coordinates. For example, “upper left” would be: plt.annotate(‘Something’, xy=(0.05, 0.95), xycoords=”axes fraction”) You could also get fancier and specify a constant offset in points: plt.annotate(‘Something’, xy=(0, 1), xytext=(12, -12), va=”top” xycoords=”axes fraction”, textcoords=”offset points”) For more explanation see the examples here and the more detailed examples here.

How to highlight selected text within excel

This is the basic principle, I assume that customizing this code is not what you are asking (as no details about this were provided): Sub Colors() With Range(“A1”) .Value = “Test” .Characters(2, 2).Font.Color = vbGreen End With End Sub Small description although it speaks quite for itself: the first “2” refers to the first character … Read more

How to process huge text files that contain EOF / Ctrl-Z characters using Python on Windows?

It’s easy to use Python to delete the DOS EOF chars; for example, def delete_eof(fin, fout): BUFSIZE = 2**15 EOFCHAR = chr(26) data = fin.read(BUFSIZE) while data: fout.write(data.translate(None, EOFCHAR)) data = fin.read(BUFSIZE) import sys ipath = sys.argv[1] opath = ipath + “.new” with open(ipath, “rb”) as fin, open(opath, “wb”) as fout: delete_eof(fin, fout) That takes … Read more