I have the text selection enabled in my PDF.js. When a user selects some text I would like to know what is the starting position of that selection in reference to the underlying file stream. The idea is to return the absolute position of the selection within the file.
Example:
E.g. the selected text might be returned with the absolute position char=300,312
Lore ipsum My Selection Lore ipsum Lore ipsum Lore ipsum Lore
Is this kind of reverse engineering even possible with PDF.js?
Related
By default, Graphviz centers the graph relatively to its caption (label):
graph {
label="lorem ipsum dolor sit amet consectetur adipiscing elit"
A -- B
}
How can I align the graph to the left, i.e., make A, B and the initial of "lorem" vertically aligned?
The attributes labeljust and labelloc have other purposes, and I cannot see anything in the reference to achieve this result.
(it helps it include your source as text, not png)
No direct way, but (if needed) use invisible nodes and/or node width to get the graph wide enough to meet your needs. Then use the labeljust attribute to to justify the label to the left (or right) of the entire graph.
graph {
// does not seem to work size="8!"
label="abcdefghijklmnopqrstuvblahblah" labeljust=r
{rank=same a node[style=invis width="2."] x1 x2 edge[style=invis] x1--a--x2}
a--b
}
giving:
I wanted to ask an opinion about adding an additional title to highcharts header.
Highcharts provides 2 (title and subtitle) by default, but what we are trying to do is to add one more title (dek) between them.
we solved it by adding breaks but fixing spacings killing me.
Also, we have specs and they should be strictly followed (every px counts).
PROBLEM : There are different properties that affecting titles such as chart.spacing[0], title.margin, svg y properties that we are trying to manipulate manually.
Also in our case titles are dynamic, they could be structured in different ways
include only Title
only dek (in-between title & subtitle)
only subtitle
Title & dek
Title & dek & subtitle
title & subtitle
dek & subtitle
In addition to that, we produce different types of charts. So it's a lot of conditions. Same thing with credits, we have multiple lines, but text doesn't wrap automatically (as it does for headers), I had to manually count how many characters could fit for particular width(styled mode).I feel it's not supposed to be this way and I really need to figure out how to solve it. That would be great to get an opinion from someone's who actually works in highcharts. Thank you!
Here is an example:
.
You can set useHTML proeprty to true and style the part of the title as you want:
title: {
useHTML: true,
align: 'left',
text: `
Lorem ipsum dolor sit amet <br>
<span class="titleSpan">Integer quis pharetra tellus. Cras tincidunt libero id dignissim convallis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.</span>
`
},
subtitle: {
align: 'left',
text: 'Sed aliquam ligula in pretium lobortis.'
}
Live demo: http://jsfiddle.net/BlackLabel/ad3reo8b/
API Reference: https://api.highcharts.com/highcharts/title.useHTML
As we known, UILabel has intrinsicContentSize, my puzzle is when we pin a label to it's superview with leading and trailing offset 10 for example, and set the numberOfLines to 0, assume the superview is a viewcontroller's view that has a width 320, and how label knows it's width is 300.
Another, when there are mutiple constraint that the label is compressed, and how the label know it's compressed and recalculate it's size?
The intrinsicContentSize is independent of any context, including any constraint applied to the label. This is, actually, the meaning of intrinsic.
So when you ask for the intrinsicContentSize of a label, it does not know that its width is gonna be 300, and indeed it returns any width that fits its content. Go on, check it: ask the the intrinsicContentSize of a label which contains "foo", or "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum vitae sapien nec elit tongue incident." You won't get the same result.
Know you may wonder: if the intrinsicContentSize is (52,21) or (633,21), why on earth does it end at (300, 21)?
Well the answer is simple: the intrinsicContentSize generates implicit constraints whose priorities are controlled by the contentHuggingPriority and contentCompressionResistancePriority of the label. Those are generally less than 1000. On the opposite, the priority of the leading and trailing offsets are 1000, the maximum. So the offset constraints win in the final layout, and the label ends with a 300 width.
Now try to set contentHuggingPriority and contentCompressionResistancePriority to 1000: you will see a conflict. Do you see why?
I'm using tesseract on iOS to extract a word from an image.
The Image contains a single word only.
Now I'm trying to detect a word from a paragraph by simply tapping a word in the image and this word will get highlighted and extracted by tesseract.
The Question is:
How can i detect, highlight and extract the word from a paragraph when the user taps on it?
This is a screen capture from Pragmatic Bookshelf.
How to make this boxed text with LaTeX? It has it's own heading with underline, and uses color.
And how to make some text with gray background as follows?
http://img20.imageshack.us/img20/7351/screenshot20100718at916.png
Added
Konrad's method works, but it looks like that it doesn't work well with multicolumn package.
Tonio's method shows the gray only for the characters, but I want to have the gray box expanded to the end of \textwidth.
http://img714.imageshack.us/img714/8417/screenshot20100718at247.png
I posted another question with respect to the \texwidth, and it seems to working anyway.
The rounded box is most easily created using TikZ:
\begin{tikzpicture}
\draw node[draw=black,fill=black!20,rounded corners,inner sep=2ex,text width=\textwidth] {
Lorem ipsum dolor sit amet \dots
};
\end{tikzpicture}
You should use the color package.
For example,
\colorbox{red}{Black text on red background}
creates a black text, with a red background.
A good description of the color capabilities can be seen here, and an extended example here.