Tengo un problema, que es cómo convertir la imagen del formato .png necesario para convertir el archivo .pdf. Por favor sugiera cualquier solución.Cómo convertir la imagen .png a .pdf en iphone programáticamente
Gracias, Madan Mohan
Tengo un problema, que es cómo convertir la imagen del formato .png necesario para convertir el archivo .pdf. Por favor sugiera cualquier solución.Cómo convertir la imagen .png a .pdf en iphone programáticamente
Gracias, Madan Mohan
puede obtener el código debajo de la URL. Ir a través de ese ........
http://ipdfdev.com/2011/04/22/convert-an-image-to-pdf-on-the-iphone-and-ipad/
realmente su aplicación funcionando bien pero necesito para convertir tif archivo a archivo PDF y UIWebView pantalla.
ANURAG PUEDE USTED FAVOR DEJARME SABER, SI SE ENCUENTRA CUALQUIER SOLUCIÓN :) – Mangesh
-(void)createPdf:(NSImage*)image
{
PDFDocument *pdf = [[PDFDocument alloc] init];
NSImage *image = [[NSImage alloc] initWithContentsOfFile:fileName];
PDFPage *page = [[PDFPage alloc] initWithImage:image];
[pdf insertPage:page atIndex: [pdf pageCount]];
[pdf writeToFile:path];
}
utilizar el método anterior de la siguiente manera:
NSImage *image = [[NSImage alloc] initWithContentsOfFile:PATH_OF_YOUR_PNG_FILE];
[self createPdf:image];
¿Qué es PDFDocument y PDFPage aquí? OP ha preguntado sobre el desarrollo de iPhone. –
Use el código siguiente para crear un archivo PDF a partir de imágenes.
UIImage* image = [UIImage imageNamed:@"sample.png"];
CGRect frame = CGRectMake(20, 100, 300, 60);
NSString* fileName = @"FileName.PDF";
NSArray *arrayPaths =
NSSearchPathForDirectoriesInDomains(
NSDocumentDirectory,
NSUserDomainMask,
YES);
NSString *path = [arrayPaths objectAtIndex:0];
NSString* pdfFileName = [path stringByAppendingPathComponent:fileName];
// Create the PDF context using the default page size of 612 x 792.
UIGraphicsBeginPDFContextToFile(pdfFileName, CGRectZero, nil);
// Mark the beginning of a new page.
UIGraphicsBeginPDFPageWithInfo(CGRectMake(0, 0, 612, 792), nil);
[image drawInRect:frame];
// Close the PDF context and write the contents out.
UIGraphicsEndPDFContext();
remítase esto- http://stackoverflow.com/questions/1360912/how-can-i-create-a-pdf-file-programmatically-in-an-iphone-application que se findout! –
¿tiene una sola imagen del archivo .png o tiene un conjunto de imágenes para convertir la imagen al pdf? –