itextsharp: getting coordinates of image - vb.net

in vb.net is it possible to get the coordinates of an image like if i do a
document.add (jpeg_image)
x_coordinate = jpeg_image.xcoordinate???????

If you're trying to get this info while you are building the PDF document:
The x-coordinate of the left edge of your image will depend on how the image was added to the PDF document. If you use an absolute position to add it, you'll have your x-coordinate. If you just add it, without absolute position, or any other modifiers, the x-coordinate will be equal to whatever the left margin is, since that is the default. If you've specified that the image should be centered or left-justified, then you'll need your image width and your margins to figure the location of the left edge of the image.
If you're trying to get this info from an already-created and saved PDF file:
Jay is right, there is no method in iTextSharp to do this.

Related

Center external image on RDLC with dynamic padding

I have a problem centering my image on the RDLC report. I'm using image control and external source (path) for the image but I don't know the size of the image and I want to keep the actual size of the image but centered in image control. Is there any option that I can read image width in expression for left padding?
My idea is to read image size and I know image control size, so I can set left padding as (control size - image size) / 2.
Any other idea is welcome.

Itext Sharp: adding a textbox to a correct position in the rotated PDF

I would like to add a textbox to the rotated pdf (270 degrees). When I use a function of GetPageSizeWithRotation(pageNum), it returns a rectangle with an incorrect position. Thus, the added textbox is also in the incorrect position.
My problems are shown in the following figure:
Please suggest me some solutions to get the PDF position exactly. Thanks!
According to your comments you identified that the issue occurs only for page which have a crop box differing from your media box. Thus, you should base your calculation on the crop box instead of your media box
GetPageSizeWithRotation essentially is implemented like this:
virtual public Rectangle GetPageSizeWithRotation(PdfDictionary page) {
Rectangle rect = GetPageSize(page);
int rotation = GetPageRotation(page);
while (rotation > 0) {
rect = rect.Rotate();
rotation -= 90;
}
return rect;
}
GetPageSize(page) called from here essentially returns the media box.
Thus, you should have analog code based upon the crop box.
EDIT According to your new results it becomes clear that the problem is not coupled with the presence of a CropBox entry but more likely with the lower left corner of the box not being the origin of the coordinate system.
In this case the rotation of the box is executed differently by iText(Sharp) and Adobe Acrobat:
iText(Sharp) rotates the box dimensions and keeps the lower left offsets.
Adobe Acrobat rotates the lower left offsets, too.
That cause for the difference: The PDF specification describes the Rotate entry like this:
The number of degrees by which the page shall be rotated clockwise when displayed or printed.
I.e. the Rotate entry is not at all specified as something changing coordinate systems but merely as something changing the output orientation. Thus, those result are equally correct.
To emulate the Adobe Acrobat coordinate transition, therefore, one needs to program an explicit method. With those example result it should be easy to implement.

Resize height of picture and extend width

i have some picture which is 675x503. I would like to make more width on it and let's say to 1024 and in height to 400. How to do that without cutting my image and keep quality? I just would like to have this image on my website top. I got photoshop 6. I tried with Image->image size but its not what i need.
If you don't want to cut the picture at all, this will distort the image due to different height and width ratios. If this is not an issue, you could simply hit ctrl(or cmd)+t when the layer with the picture is selected. It will let you resize and rotate the entire image. There is also an option in the Image -> Image Size menu called "Bicubic Sharper", found in the drop-down list at the bottom of the menu(Photoshop CS6). It's meant for image reduction and should also solve your problem.

How to revert back to not require rasterize

I used to be able to color any Text, shape, or image by just selecting the particular layer and use pain bucket tool for example. Not sure what I clicked, but recently when I try to do the same; I always get the following message:
"This type Layer must be rasterized before proceeding. Its text will
no longer be editable. Rasterize the type? "
I do not want to rasterize. Can I know how to revert back to the normal setup where I can do the coloring without the need for rasterize please.
It also seems to mess around with my selection.
For example - I have a circle shape in the middle with transparent background.
I used to be able to go Select>All followed by Select>Inverse and it will select the circle shape.
But now it selects the entire canvas when I select all but returns the following error when I Select>Inverse
"Warning No Pixels were selected".
You may not be able to color a vector object with paint bucket tool. Instead, can you try using the color option in the blending mode. That will retain the vector property and also apply the color.
The following applies to PS-CS6
In the layers palette,
= Right click on the layer > Blending Options > Select Color Overlay

iOS loss of image quality

This is the case:
I have an image. In the projects browser it looks good.
/but when I 'load' it in one of my controls the edges get rather blurry. And I'm not resizing it or anything. Why is this?
The image, unloaded:
The image when loaded in a control:
As you can see the corners get rather blurry/streched. Why?
It happened to me in the past.
Most of the time the problem is that the dimensions of the image are different from the dimensions of the controller.
Check you controller size with:
NSLog(#"controller size = %#",NSStringFromRect(your_controller.rect));
And see if it the image size fits.
I've also had this before and as #shannoga said if the dimensions of the view are different to the image it will auto stretch it.
Are you loading the image into an ImageView? if so the imageView.Mode property defaults to Scale To Fill. If you set the mode to Top, Left or Center it wont stretch the image.