Determine current position when writing long text using AlivePDF - alivepdf

I need to create a layout with an image on the left and text to the right of it.
While the image width is known, the text length is not.
I want to be able to write the text and be able to determine where on the Y axis I need to addImage for the next image.
Thank you.

The PDF class exposes this public method:
pdf.getY()

Related

Creating a synthetic camera in vtk and manipulating the intrinsic parameters and extrinsic interactively

I want to render a scene interactively. The controls are already provided so that you can position the camera with mouse but you never know the exact value.
I want to manipulate the internal camera values as well e.g focal length.
Externally I want to set the translation and rotation of the camera.
I want to give all the values manually. Could anyone please help to point to such a demo or a code snippet to do it. Preferably in python.
Thanks a lot.
You can get the camera from the renderer with renderer->GetActiveCamera(). Then you can manipulate it using the class functions: http://www.vtk.org/doc/nightly/html/classvtkCamera.html
Here is a simple Python example: http://www.vtk.org/Wiki/VTK/Examples/Python/Camera

Byte Array to Image then display in DialogBox C++

as the title says, ive got this packet which contains the whole JPEG image file, so i've put that into a byte array, now how do i convert this to an image and then display it.
I dont need to save it, just display it then once the user enters an answer, delete it.
If you're wondering, its a captcha image. Something like what JDownloader does with captchas.
edit: i meant how can i display images in dialog boxes
You can use the GDI+ Image class to do this, using an IStream of your JPEG in memory as the input, which can be done using ISequentialStream::Read.

What manager is suggested for Gallery Manager?

I am working on implementing a gallery, I tried GridFieldManager for this, but the images of the thumbnail are not of same size. I sneaked through the gridfieldclass but there are no methods for making the cell size of each image constant.
Is it worth to use flowfieldmnager? When I tried overriding sublayout method for the above two managers it is not giving the desired reults.
Is it possible to sublayout flowfieldmanager?
Device : Blackberry 9780, OS 6.0
The below image is the desired result I am trying to get
I advice you to use a simple FlowFieldManager. But instead of BitmapField inside it, extend a Field to do the following:
setExtent to 1/4 of the Display width in the sublayout method
draw your own focus in the border of the image
draw your own borders and draw the image in the center of the field's extent

RaphaelJs : How to add some text to an area defined by a path?

I have an SVG image of the united states which I've drawn with a little bit of help from Raphaël js:
http://jsfiddle.net/zCRkg/2/
What I want to do is place some text to the right of each state when you hover over it. The problem is that, since each state is a path, its quite difficult to determine the x & y coordinates for where to place the label.
So, does anyone know a way of calculating the centre of a path using Raphaël? If failing that anyone know how to do this given a an array of vectors?
What you're looking for is the getBBox function in Raphaël. It will give you a bounding box object that you can use to calculate the central point of the path:
var bbox = st.getBBox();
var text = r.text(bbox.x + bbox.width/2, bbox.y + bbox.height/2, "Foo");
I forked your fiddle and made it show a static text in the middle of each state on hover. Picking up the state name from your data is left as an exercise.
the average of the difference between each coord should give you the centre, but thats probably not the most efficient way

LWUIT display bold text + normal text

I need to display some Rich-Text in LWUIT.
I was thinking of HTML Component, but I can't get linewrapping there - probably an error on my side.
Another idea would be to use TextAreas or Labels and do it manually.
I'd need the possibility to have bold words in a non bold sentence.
Hello, this is a bold. <- This dot shouldn't be bold.
Is there a way I can achieve that? I think I only can use one Font per Component...
Use a Container with flow layout and just place labels into it. This is what the HTML Component does internally.
Try com.sun.lwuit.html.HTMLComponent class. Use it like,
HTMLComponent htmlComp = new HTMLComponent(null);
htmlComp.setBodyText("<b>Hello</b>, this is a <b>bold</b>. <- This dot shouldn't be <b>bold</b>.");
form.addComponent(htmlComp);
This component will allow you to use html tags inside text. For more information, refer this link: HTMLComponent

Resources