TCPDF: Mixed orientation in one pdf - pdf-generation

Is it possible to have mixed orientation in one PDF. E.g. some pages portrait and some landscape? Or is it possible to rotate content? I can see that you can set the overall orientation can be set in the constructor, but didn't see anything.
MS

It's actually pretty easy all yo have to do is when you add a page:
// protrait
$tcpdf->addPage( 'P', 'LETTER' );
// landscape
$tcpdf->addPage( 'L', 'LETTER' );

For rotating the content you can use the following code.
$pdf->StartTransform();
$pdf->Rotate(-90);
$pdf->Cell(0,0,'This is a sample data',1,1,'L',0,'');
$pdf->StopTransform();

Related

Drawing an image with a color tint in MonoTouch

What do I need to read up on to tint the image I draw with a predefined color. Alternatively just adjust the alpha value? I've played around with BlendMode but I basically don't know what I'm doing. :)
Simplyfied code below
_backgroundImage = UIImage.FromFile ("whiteblock.png");
var ctx = UIGraphics.GetCurrentContext ();
// What do I do here to tint or adjust alpha of the image
ctx.DrawImage (rect, _backgroundImage.CGImage);
Thanks
AnkMannen
I recommend starting with the Core Image Filter reference docs (see also CIFilter).
(Note that depending on the version of the OS, not all filters may be available.)
You probably want to focus on the filters in the CICategoryColorAdjustment category.
In particular, the CITemperatureAndTint filter can adjust the tint of the image, as you ask. But, it is not straightforward to use.* There are other questions on StackOverflow describing it, like this one: Input parameters of CITemperatureAndTint (CIFilter)
Finally check out the MonoTouch docs for a code example with CITemperatureAndTint. (I believe the image attached to the examples given there are wrong, as they show a scaled image, not a tinted image.)
*It takes two parameters, each a 2D CIVector. I believe the first component of the vector is temperature and should be in the ballpark of (1k ... 30k). I believe the second component is wavelength, so in the ballpark of (380 ... 700). If someone knows better, correct me.

TinyMCE prevent image resizing

I am adding an image to a TinyMCE editor using:
var params = {
src: filename,
title: "Attached image: " + filename,
width: 500
};
ed.execCommand("mceInsertContent", false, ed.dom.createHTML("img", params));
This insert the image correctly in the editor. However, when the user clicks on the image he has the ability of resizing it.
I would like to know if there is a way to:
Prevent the user to resize only in one direction (i.e. how do I keep a fixed aspect ratio for the image)
Completely prevent the user to resize the image
I found a (partial) answer, so I thought I will share it here.
Adding
'object_resizing' : false
In the editor config prevents the resizing.
Note that this is a feature of Mozilla only (e.g. Google Chrome does not allow you to resize the image).
I am still looking for a way of keeping aspect ratio in real time, but I do not know if that is really possible.
You can simply add this little plugin to tinyMCE, I used it and it works very well!
Here's the documentation: Link
You would need to implement a resize handler (for example a jQuery handler).
It might be helpfull to add attributes to your images to save its dimensions or to use one single setting holding the aspect ratio. For this you will adjust the tinymce configuration setting valid_elements to allow those attributes for images - otherwise tinymce would strip them out.
When resize gets fired you grab the new dimensions and adjust the dimensions according to the aspect ratio - eigther adjust using the new width or new heigth (the other value is needs to get corrected).
Example: images have an attribute aspectratio holding the aspect ration
You may place this code in thetinymce setup configuration parameter
setup : function(ed) {
ed.onInit.add(function(ed) {
$(ed.getBody()).find('img').resize( function(event){
$(event.target).css('width', parseInt ( event.target.width * this.aspectratio) );
});
});
}
Update:
I have created a tinymce fiddle to show an example to use with IE.

Check Portrait or Landscape in WP7

I'm developing a WP/ camera app that shows the picture that have been taken. Is there a way to somehow know how your currently holding your camera so that the image preview will display the picture as portrait or landscape?
Have a read of How to Handle Orientation Changes in WP7
On PhoneApplicationFrame you have Orientation property
Just replace or add the below codes to PhoneApplicationFrame.....
SupportedOrientations=ā€¯PortraitOrLandscapeā€¯

Handling size of image after orientation change WP7

I've got an Image with an overlay Canvas with some rectangles whose position is relative to image's size. The problem comes when I change the phone orientation, because image size changes (or at least, the renderization) but I can't manage to re-distribute the rectangles according to the new size, and the OrientationChanged event doesn't help me because it's fired before rendering the image (so all the rectangles go to (0,0))
Anyone can help me finding the correct event?
I'd either not use percentage widths or save them as exact values when first rendered/measured for one orientation. You can then adjust the dimensions relative to the orientation.
Update
If you can't get the exact values passed to you then you coudl load the image where teh user can't see it to measure it.
If you're getting the image and positions from an external source which always assumes a portrait orientation then why not just always display it as such in your app.
Finally got it!
The event I was looking for was the SizeChanged, I can't imagine how I didn't see it before...

Orientation Questions - palm pre webos

Just a couple of quick questions...not too hard to answer hopefully!
How do I set the allowed orientation from scene to scene?
I can set it for the entire stage with:
this.controller.setWindowOrientation("free");
but I want to be able to set it for each scene, some of which I don't want any rotation...
Any ideas?
Also, is there any way to restrict the orientation to just up and down (portrait and reverse portrait) and not have a rotation on landscape?
Many thanks
TheBounder.
1)use the following code in scenes which one you want to set orientation
if (this.controller.stageController.setWindowOrientation) {
this.controller.stageController.setWindowOrientation("free");
}
2) for your second question set the orientation left and right only it will work

Resources