5
A
回答
3
你可以在以下网址的代码。通过去........
http://ipdfdev.com/2011/04/22/convert-an-image-to-pdf-on-the-iphone-and-ipad/
1
真的是你的应用程序工作正常,但我需要.tif文件转换为PDF文件,并显示UIWebView的。
+0
ANURAG能否让我知道,如果找到任何解决方案:) – Mangesh 2013-05-11 07:24:51
-2
-(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];
}
使用上面的方法如下:
NSImage *image = [[NSImage alloc] initWithContentsOfFile:PATH_OF_YOUR_PNG_FILE];
[self createPdf:image];
0
使用下面的代码从图像创建PDF文件。
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();
相关问题
- 1. 如何以编程方式将PDF转换为iOS中的PNG
- 2. 如何使用我的C程序将PDF转换为图像格式(jpeg,png,...)?
- 3. 将EPS/PDF转换为JPEG/PNG格式?
- 4. 将.png图像转换为.gif图像
- 5. 如何以编程方式将Word文件转换为PDF?
- 6. 如何将PDF转换为图像?
- 7. 将PDF转换为图像
- 8. 在Android中将图像转换为PDF
- 9. 以编程方式将HTML页面转换为图像/ PDF的最佳Java库
- 10. 如何到Base64 PNG图像串为PNG格式转换成C#
- 11. 如何将rtf转换为图像格式(jpg/png ..)
- 12. 如何将png图像字符串数据转换为png?
- 13. 如何在Internet Explorer中将svg转换为png图像?
- 14. pdfbox2.0.4将PDF转换与中国为PNG
- 15. 以编程方式将GIF转换为PNG
- 16. 无法在Codeigniter中将图像转换为.png格式
- 17. 如何将base64 svg图像转换为base64图像png
- 18. 如何将base64_encode png图像转换为简单图像
- 19. 如何将位图图像转换为Windows Phone 7中的png?
- 20. 如何以编程方式在iPhone中将图像旋转90度?
- 21. 如何将字符串转换为图像格式编程
- 22. 以编程方式将kml转换为图像
- 23. 将SVG转换为PNG图像
- 24. 将PNG图像转换为视频
- 25. 尝试将SVG转换为PNG图像
- 26. 将PDF转换为php中的图像
- 27. 如何PDF文件转换成PNG(图像)文件中的QT
- 28. 我如何将wav转换为wma编程方式在C++中?
- 29. 将闪存图转换为图像/ pdf
- 30. 在Android操作系统中将JPEG/PNG图像转换为TIFF图像格式
请参考这个 - http://stackoverflow.com/questions/1360912/how-can-i-create-a-pdf-file-programmatically-in-an-iphone-application你会findout! – 2011-01-27 12:51:14
你有一个.png文件的图像,或者你有一组图像将图像转换为pdf? – 2013-11-21 07:59:40