Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 5th, 2012  |  syntax: None  |  size: 0.88 KB  |  hits: 14  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Problems to create a Thumbnailimage from a WORD document in Objective c
  2. UIWebView *myWebView22 = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
  3.  
  4. path44 = [caminoINICIAL stringByAppendingPathComponent:@"documentoInicial.doc"];
  5.  
  6. NSURL *fileURL22 = [[NSURL alloc] initFileURLWithPath:path44];
  7.  
  8. NSURLRequest *req22 = [NSURLRequest requestWithURL:fileURL22];
  9.  
  10. [myWebView22 setScalesPageToFit:YES];
  11.  
  12. [myWebView22 loadRequest:req22];
  13.  
  14.  
  15. UIGraphicsBeginImageContext(myWebView22.bounds.size);
  16.  
  17. CGContextRef c = UIGraphicsGetCurrentContext();
  18.  
  19. CGContextTranslateCTM(c, 0, 0);
  20.  
  21. [myWebView22.layer renderInContext:c];
  22.  
  23. UIImage* viewImage = UIGraphicsGetImageFromCurrentImageContext();
  24.  
  25. UIGraphicsEndImageContext();
  26.  
  27. pngPath = [caminoINICIAL stringByAppendingPathComponent:[NSString stringWithFormat:@"imagenFinal.png"]];
  28.  
  29. [UIImagePNGRepresentation(viewImage) writeToFile:pngPath atomically:YES];