List bullet size - titanium

How to increase the size of a list bullet? I am using ""\u2023 ABC" and applying style with font size :16. However the bullet size does not scale and only the font size scales.
"\u2023"= unicode for the bullet

Prasad, size of the bullet is also increasing with respect to the font size. But the probelm is the size of the bullet is small compared to the text. Please refer the screenshots I've taken in iPhone simulator with different font size
The above in the above images, each of them has font sizes 16, 30 and 80 respectively. You can see that the arrow size is also increasing with respect to the font size.
And here is a working solution for you.
Here I've used two labels - one for the arrow and other for the city name having a font size 40 and 20 respectively, added them to the tableViewRow. You can change the font size as per your requirement
Here is my code
for(var i = 0 ; i < number_of_cities; i++ ){
var lblArrow = Ti.UI.createLabel({
text : "\u2023",
font : {fontSize : 40},
left : '3%'
});
var lblValue = Ti.UI.createLabel({
text : cityList[i].name,
font : {fontSize : 20},
left : '10%'
});
tblData[i] = Ti.UI.createTableViewRow();
tblData[i].add(lblArrow);
tblData[i].add(lblValue);
}
Please note : I'm not sure that it's a best method, but it will resolve your issue

There are numerous variations of Unicode bullets and a quick visit to
Geometric Shapes is always useful. My personal favorite is "Black Circle" which, as with so much of Unicode, may be many things but a circle it is not.
● is a nice fat bullet — a bullet with attitude. In Hex it is ● and parsed for the purposes of list styling written as "\25AC" in the content value of your li:before tag:
li:before {
content: "\25AC";
etc.

Related

iText - PDFAppearence issue

We're using iText to put a text inside a signature placeholder in a PDF. We use a code snippet similar to this to define the Signature Appearence
PdfStamper stp = PdfStamper.createSignature(inputReader, os, '\0', tempFile2, true);
sap = stp.getSignatureAppearance();
sap.setVisibleSignature(placeholder);
sap.setRenderingMode(PdfSignatureAppearance.RenderingMode.DESCRIPTION);
sap.setCertificationLevel(PdfSignatureAppearance.NOT_CERTIFIED);
Calendar cal = Calendar.getInstance();
sap.setSignDate(cal);
sap.setLayer2Text(text+"\n"+cal.getTime().toString());
sap.setReason(text+"\n"+cal.getTime().toString()); `
Everything works fine, but the signature text does not fill all the signature placeholder area as expected by us, but the area filled seems to have an height that is approximately the 70% of the available space.
As a result, sometimes especially if the length of the signature text is quite big, the signature text does not fit in the placeholder and the text is striped away.
Example of filled Signature:
I looked into the PdfSignatureAppearence class and I found this code snippet in the getApperance() method that is responsible of this behaviour and is invoked when
sap.setRenderingMode(PdfSignatureAppearance.RenderingMode.DESCRIPTION);
is being called
else {
dataRect = new Rectangle(
MARGIN,
MARGIN,
rect.getWidth() - MARGIN,
rect.getHeight() * (1 - TOP_SECTION) - MARGIN);
}
I don't get the reason for that, because I expect that the text could use all the available placeholder height, with the proper margin.
Is there any way to bypass this behaviour?
We are using iText 5.4.2, but also newer version contains same code snippet so I expect that the behaviour will be same.
As #JJ. already commented,
TOP_SECTION is connected with acro6layers rendering and the code [determining the datarect in pure DESCRIPTION mode] does not take into account the value of the acro6layer flag.
Unless one wants to fix this in the iText 5 code itself, the easiest way to make one's description use the whole signature space is to construct the layer 2 appearance oneself.
To do so one merely has to retrieve a PdfTemplate from PdfSignatureAppearance.getLayer(2) and fill it as desired after one has called PdfSignatureAppearance.setVisibleSignature. The PdfSignatureAppearance remembers that you already have retrieved the layer 2 and doesn't change it anymore.
For the case at hand we essentially copy the PdfSignatureAppearance.getAppearance code for generating layer 2 in pure DESCRIPTION mode, merely correcting the code determining the datarect:
PdfSignatureAppearance appearance = ...;
[...]
appearance.setVisibleSignature(new Rectangle(36, 748, 144, 780), 1, "sig");
PdfTemplate layer2 = appearance.getLayer(2);
String text = "We're using iText to put a text inside a signature placeholder in a PDF. "
+ "We use a code snippet similar to this to define the Signature Appearence.\n"
+ "Everything works fine, but the signature text does not fill all the signature "
+ "placeholder area as expected by us, but the area filled seems to have an height "
+ "that is approximately the 70% of the available space.\n"
+ "As a result, sometimes especially if the length of the signature text is quite "
+ "big, the signature text does not fit in the placeholder and the text is striped "
+ "away.";
Font font = new Font();
float size = font.getSize();
final float MARGIN = 2;
Rectangle dataRect = new Rectangle(
MARGIN,
MARGIN,
appearance.getRect().getWidth() - MARGIN,
appearance.getRect().getHeight() - MARGIN);
if (size <= 0) {
Rectangle sr = new Rectangle(dataRect.getWidth(), dataRect.getHeight());
size = ColumnText.fitText(font, text, sr, 12, appearance.getRunDirection());
}
ColumnText ct = new ColumnText(layer2);
ct.setRunDirection(appearance.getRunDirection());
ct.setSimpleColumn(new Phrase(text, font), dataRect.getLeft(), dataRect.getBottom(), dataRect.getRight(), dataRect.getTop(), size, Element.ALIGN_LEFT);
ct.go();
(CreateSignature.java test signWithCustomLayer2)
(As description text I used some paragraphs from the question body.)
The result:
By adapting the MARGIN value in the code above, one can even use more are. As that can result in the text touching the border, though, that might not be really beautiful.
As an aside:
if the length of the signature text is quite big, the signature text does not fit in the placeholder and the text is striped away.
If you initialize the size variable above with a non-positive value, the code in the if (size <= 0) block will calculate a font size which allows all of the text to fit into the signature rectangle. This does happen in the code above as new Font() returns a font with a size of UNDEFINED which is a constant -1.

How do I get phantomJS to generate pdf that is just a single page that contains my page?

I am trying to create a pdf from a webpage using phantomJS. I want the pdf to just be a single page long that is the same height as my webpage. If I don't set paperSize or viewportSize at all then it creates a page that is almost the right height, it is just a little short by about 100px. If I detect page height and use that to set viewportSize I have the exact same problem, it's short by about 100px. Is there a way to get phantomJS to just create a pdf based on the webpage's size? I want it to be exact because the page is a dark colour and it looks really bad to have a big white block at the end of the page (which is what is there if I add a constant to viewport height to make it fit everything in one page).
My code to find height(Note: the height is the same whether I use body or the classname below to find it):
var size = page.evaluate(function() {
var height = $('.export-athlete-detail-report').outerHeight(true);
return {width: 700, height:height};
});
page.paperSize = size;
page.render(reportFile);

Image Resize - Fixed width and height with padding even image is smaller

When i upload 100x100 image, i cant make it 120x120 with whitespace filled for those extra 20px.
If i upload 200x150, then 120x120 image is ok, filled whitespace.
This is my code.
var setting = new ResizeSettings
{
Width = 120,
Height = 120,
Format = "jpg"
};
ImageBuilder.Current.Build(image, "desctination", setting, false, false);
Don`t know why, but i think i used this method successfully in past.
Any suggestion?
This is explained in paragraph 2 of the ImageResizer API Introduction page; use &scale=canvas or Scale = ScaleMode.UpscaleCanvas.

Ready An Existing PDF Page Size (ex. 8.5 x 11, 11 x 17) VB.Net

Like the title says i'd like to read an existing pdf page size with VB.Net. I've been working with Itext.Sharp, and the Acrobat.dll. Is this possible??
There are a number of different "Boxes" a given page can have:
Media Box (required): The initial page size when printing viewing.
Crop Box (optional): Supersedes the media box. Defaults to match the media box. Must be a subset or match the media box.
There's also art/trim/bleed boxes, but they don't matter as much and are much less common.
So, the page size:
PdfReader reader = new PdfReader(myPath);
// gets the MEDIA BOX
Rectangle pageRect = reader.getPageSize(1); // 1 -> first page
// gets the crop box if present, or the media box if not.
Rectangle cropRect = reader.getCropBox(1);
// and finally
Rectangle artBox = reader.getBoxSize( 1, "art");
// could be "art", "bleed", "crop", "media", or "trim"
I'd go with getCropBox().
I also recommend checking out the JavaDoc for things like this. At the very least you would have come up with getPageSize() on your own. No, it's not C#. Yes, it's very useful.
http://api.itextpdf.com/
Also note that these Rectangles need not be based on 0,0 (which would be the lower left corner on an unrotated page).
Further, you should check the page's rotation, getPageRotation(int), and swap height and width if the rotation is 90 or 270. There is getPageSizeWithRotation(int), but it only works with the media box, so I'd do it yourself if I were you. It's only a few extra lines of code:
// rotation has to be 0, 90, 180, or 270. "360" isn't kosher IIRC.
if (reader.getPageRotation(pageNum) % 180 != 0) {
float tmp = width;
width = height;
height = tmp;
}

How do I create a graphics banner with multiple lines in Rebol (can only create one line)?

This works:
view layout [
box white 728x90 effect reduce [ 'gradient 0x1 sky]
font [align: 'center size: 40 color: red] "Your banner text"
]
But how do I add other lines ?
Thank you.
Include a new line in your text:
view layout [
box white 728x90 effect reduce [ 'gradient 0x1 sky]
font [align: 'center size: 40 color: red] "Your banner text^/on two lines"
]
If you aren't used to "escaping" characters in Rebol, it's pretty similar to doing so in C or Java or JavaScript or .....
This page in the Rebol Core Manual has all the details - http://www.rebol.com/docs/core23/rebolcore-16.html#section-2.11
You should be able to work out how to get multiple lines with different font sizes and colours by reading this - http://www.rebol.com/how-to/subpanels.html