1
我有一個帶註釋的PDF,並希望將其轉換爲圖像。 PDF已成功轉換爲圖片,但轉換中缺少註釋。如何將帶註釋的PDF轉換爲圖像?
這是代碼:
NSPDFImageRep *img = [NSPDFImageRep imageRepWithContentsOfFile:PdfFilePath];
NSFileManager *fileManager = [NSFileManager defaultManager];
[img setCurrentPage:0];
NSImage *temp = [[NSImage alloc] init];
[temp addRepresentation:img];
NSBitmapImageRep *rep = [NSBitmapImageRep imageRepWithData:[temp TIFFRepresentation]];
NSData *finalData = [rep representationUsingType:NSJPEGFileType properties:nil];
NSString *pageName = [NSString stringWithFormat:@"Page1_%d.jpeg", 0];
NSString *imgFilePath = [NSString stringWithFormat:@"%@/%@",@"/Users/Desktop/PDFImages", pageName];
[fileManager createFileAtPath:imgFilePath contents:finalData attributes:nil];
是否有存儲註釋PDF格式的圖像以不同的方式?