2

Can any one help me out that how to display tiff files(Contains multiple images like pdf) in ios?

NSData *imageData = [Base64 decode:_img];
[_wv loadData:imageData MIMEType:@"image/tiff" textEncodingName:nil baseURL:nil];

I am using the code above. But it is displaying only the first image in tiff file. how to display all the images in tiff file.

Boggarapu
  • 333
  • 2
  • 7
  • 15

1 Answers1

1

Just try this..

NSString *str = [imageData base64Encoding]; 
NSData *new_data = [NSData dataWithBase64EncodedString:str];
UIImage *image2 = [UIImage imageWithData:new_data];
[image_view setImage:image2]; // Just check with image view
[web_view loadData:new_data MIMEType:@"image.tiff" textEncodingName:nil baseURL:nil];
Mani
  • 17,549
  • 13
  • 79
  • 100
  • Still displaying only first image in tiff file. – Boggarapu Jan 09 '14 at 09:57
  • @Boggarapu did you check this `image2.images`(for animated images, `images` property of `UIImage` will hold all images)? – Mani Jan 09 '14 at 10:06
  • .png or .jpeg images are stored into array. and to show that array "images" property is used. But tif/tiff is containing multiple images like pdf. images property doesn't work for tiff file. – Boggarapu Jan 09 '14 at 10:27
  • @Boggarapu Did you try this? Is it work for you? I think, it will be just store as raw data(no need to .jpeg or .png ), which point out by `images` property(array)? – Mani Jan 09 '14 at 10:30
  • its not working. it is showing a warning "Incompatible pointer types sending 'NSArray *' to parameter of type 'UIImage *' " – Boggarapu Jan 09 '14 at 11:35
  • Hey man, I told that try this `UIImage *image2 = [UIImage imageWithData:new_data]; image2.images = //check this`? – Mani Jan 09 '14 at 11:56
  • That is what I tried. I finally found the solution that ios doesn't support tiff files. try to open some sample tiff file in safari browser. It shows only the first image of file. – Boggarapu Jan 10 '14 at 04:57
  • iOS doesn't support multi-page TIFF: https://discussions.apple.com/thread/6680065 – ULazdins Feb 20 '18 at 09:06