简体   繁体   中英

How to Add textfield in PDF in iPhone?

是否可以在PDf文件中的这些字段中添加文本字段和标签并添加ID,以便以后可以通过它们的相应ID来访问这些字段?

Yes like this:

 CGContextBeginPage(yourPDFContextRef,nil);

 //Draw view into PDF
 UIView *aPageNote=[[UIView alloc]initWithFrame:CGRectMake(0,0, 612, 892)]; //provide height and width of pdf page
 aPageNote.backgroundColor=[UIColor whiteColor];

 //turn PDF upsidedown
 CGAffineTransform aCgAffTrans = CGAffineTransformIdentity;
 aCgAffTrans = CGAffineTransformMakeTranslation(0,892);
 aCgAffTrans = CGAffineTransformScale(aCgAffTrans, 1.0, -1.0);
 CGContextConcatCTM(yourPDFContextRef, aCgAffTrans);

 //add UI Control here to UIVIEW
 UIImageView *aImgViewSign = [[UIImageView alloc] initWithFrame:frame];
            aImgViewSign.image = [imageArray objectAtIndex:index];
 [aPageNote addSubview:aImgViewSign];    
 [aPageNote.layer renderInContext:yourPDFContextRef];
 [aPageNote release]; 
 CGContextEndPage (yourPDFContextRef);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM