ios 创建和绘画pdf文件 -转

转自:http://blog.csdn.net/ant1239/article/details/7761676

本方法为项目中画pdf的一个方法,画pdf,一共分为几步,1,获取地址,有两种获取地址方法,这是其中一种,2,关联上下文后开始绘画pdf,开始新的一页后必须用cgcontentbeginpage方法开始新的一页,从新设置坐标,等属性。3,释放。pdf就是个画布,我们是往上面画东西,而不是写东西,还有就是pdf用的坐标系是数学坐标,左下角为原点,而不是编程里常用的左上角为为坐标原点~一下是源码,重复的东西有点多,懒得整理了~关键的就那么几句~

-(void)MyPDFContextCreate{

//获取路径

    NSArray *paths=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);坐标

    NSString *saveDirectory=[paths objectAtIndex:0];

    NSString *saveFileName=@"myPDF.pdf";

    NSString *newFilePath=[saveDirectory stringByAppendingPathComponent:saveFileName];

    const char *filename=[newFilePath UTF8String];

//设置页面大小

    CGRect pageRect=CGRectMake(0, 0, 612, 792);

//关联上下文的对象

    CGContextRef pdfContext;

    CFStringRef path;

    CFURLRef url;

    path=CFStringCreateWithCString(NULL, filename, kCFStringEncodingUTF8);

    url=CFURLCreateWithFileSystemPath(NULL, path, kCFURLPOSIXPathStyle, 0);

    CFRelease(path);

    pdfContext=CGPDFContextCreateWithURL(url, &pageRect, nil);

    CFRelease(url);

    //开始画pdf

    NSString *temtext=[[NSString alloc]init];

    const char *text=(char *)[temtext UTF8String];

    int  width;

    int height;

    // 画推荐信

    NSNumber *en=[self.fatherobject valueForKey:@"enabel"];

    if(en.boolValue){

        height=700;

//开始画pdf,开始新的一页

        CGContextBeginPage(pdfContext, &pageRect);

//设置字体,字体大小等

        CGContextSelectFont(pdfContext, "Helvetica", 30, kCGEncodingMacRoman);

        CGContextSetTextDrawingMode(pdfContext, kCGTextFill);

        CGContextSetRGBFillColor(pdfContext, 0, 0, 0, 1);

        //画姓名

        if(self.firstname!=nil||self.lastname!=nil){

            if(self.firstname==nil){

                self.firstname=@"";

            }

            if(self.lastname==nil){

                self.lastname=@"";

            }

            temtext=[NSString stringWithFormat:@"%@ %@",self.firstname,self.lastname];

        }

        width=[self getfontwidth:temtext fontsize:30];

        text=(char*)[temtext UTF8String];

        CGContextSetFontSize(pdfContext, 30);

//关键方法,在指定位置画上text文字,文字必须为char类型

        CGContextShowTextAtPoint(pdfContext, (612-width)/2, height, text, strlen(text));

        height=height-30;

        if((self.street!=nil&&![self.street isEqualToString:@""])||

           (self.apt!=nil&&![self.apt isEqualToString:@""])||

           (self.city!=nil&&![self.city isEqualToString:@""])||

           (self.state!=nil&&![self.state isEqualToString:@""])||

           (self.zip!=nil&&![self.zip isEqualToString:@""])){

            if(self.street==nil){

                self.street=@"";

            }

            if(self.apt==nil){

                self.street=@"";

            }

            if(self.city==nil){

                self.city=@"";

            }

            if(self.state==nil){

                self.state=@"";

            }

            if(self.zip==nil){

                self.zip=@"";

            }

            temtext=[NSString stringWithFormat:@"%@,%@,%@,%@,%@",self.street,self.apt,self.city,self.state,self.zip];

            text=(char *)[temtext UTF8String];

            width=[self getfontwidth:temtext fontsize:13];

            CGContextSetFontSize(pdfContext, 13);

            CGContextShowTextAtPoint(pdfContext, (612-width)/2, height, text, strlen(text));

            height=height-13;

        }

        if(self.phone==nil){

            self.phone=@"";

        }

        if(self.fax==nil){

            self.fax=@"";

        }

        if(self.Email==nil){

            self.Email=@"";

        }

        if(self.website==nil){

            self.website=@"";

        }

        if(![self.phone isEqualToString:@""]||

           ![self.fax isEqualToString:@""]||

           ![self.Email isEqualToString:@""]||

           ![self.website isEqualToString:@""]){

            temtext=[NSString stringWithFormat:@"Phone:%@, Fax:%@, Email:%@, Website:%@",self.phone,self.fax,self.Email,self.website];

            text=(char *)[temtext UTF8String];

            width=[self getfontwidth:temtext fontsize:13];

            CGContextSetFontSize(pdfContext, 13);

            CGContextShowTextAtPoint(pdfContext, (612-width)/2, height, text, strlen(text));

            height=height-13;

        }

        //划线

        CGContextMoveToPoint(pdfContext, 50, height);

        CGContextAddLineToPoint(pdfContext, 612-50, height);

        CGContextStrokePath(pdfContext);

        height=height-20;

        //画cotterletter内容

        NSManagedObject *myobject=[DataController getcontactinfo:self.fatherid];

        NSString *myapt=[myobject valueForKey:@"apt"];  

        NSString *mycity=[myobject valueForKey:@"city"];

        NSString *mycompanyname=[myobject valueForKey:@"companyname"];

        NSString *myfirstname=[myobject valueForKey:@"firstname"];

        NSString *mylastname=[myobject valueForKey:@"lastname"];

        NSString *myposition=[myobject valueForKey:@"postion"];

        NSString *mystate=[myobject valueForKey:@"state"];

        NSString *mystreet=[myobject valueForKey:@"street"];

        NSString *mytitle=[myobject valueForKey:@"title"];

        NSString *myzip=[myobject valueForKey:@"zip"];

        NSDate *mydate=[myobject valueForKey:@"date"];

        if(mydate!=nil){

            NSDateFormatter *myformatter=[[NSDateFormatter alloc]init];

            [myformatter setDateFormat:@"MMMM, yyyy"];

            temtext=[NSString stringWithFormat:@"%@",[myformatter stringFromDate:mydate]];

            [myformatter release];

            text=(char *)[temtext UTF8String];

            CGContextSetFontSize(pdfContext, 13);

            CGContextShowTextAtPoint(pdfContext, 50, height, text, strlen(text));

            height=height-30;

        }

        if((mytitle!=nil&&![mytitle isEqualToString:@""])||

           (myfirstname!=nil&&![myfirstname isEqualToString:@""])||

           (mylastname!=nil&&![mylastname isEqualToString:@""])){

            temtext=[NSString stringWithFormat:@"%@ %@ %@",mytitle,myfirstname,mylastname];

            height=[self plaintextatwith:50 width:450 text:temtext height:height fontsize:13 context:pdfContext];

            height=height-14;

        }

        if(myposition!=nil&&![myposition isEqualToString:@""]){

            temtext=[NSString stringWithFormat:@"%@",myposition];

            height=[self plaintextatwith:50 width:450 text:temtext height:height fontsize:13 context:pdfContext];

            height=height-14;

        }

        if(mycompanyname!=nil&&![mycompanyname isEqualToString:@""]){

            temtext=[NSString stringWithFormat:@"%@",mycompanyname];

            height=[self plaintextatwith:50 width:450 text:temtext height:height fontsize:13 context:pdfContext];

            height=height-14;

        }

        if((![myapt isEqualToString:@""]&&myapt!=nil)||

           (![mystreet isEqualToString:@""]&&mystreet!=nil)){

            temtext=[NSString stringWithFormat:@"%@.,%@",myapt,mystreet];

            height=[self plaintextatwith:50 width:450 text:temtext height:height fontsize:13 context:pdfContext];

            height=height-14;

        }

        if((mycity!=nil&&![mycity isEqualToString:@""])||

           (mystate!=nil&&![mystate isEqualToString:@""])||

           (myzip!=nil&&![myzip isEqualToString:@""])){

            temtext=[NSString stringWithFormat:@"%@,%@,%@",mycity,mystate,myzip];

            height=[self plaintextatwith:50 width:450 text:temtext height:height fontsize:13 context:pdfContext];

            height=height-14;

        }

        if((mytitle!=nil&&![mytitle isEqualToString:@""])||

           (mylastname!=nil&&![mylastname isEqualToString:@""])){

            height=height-15;

            temtext=[NSString stringWithFormat:@"Dear %@.%@",mytitle,mylastname];

            height=[self plaintextatwith:50 width:450 text:temtext height:height fontsize:13 context:pdfContext];

            height=height-40;

        }

        if(self.coverletter!=nil&&![self.coverletter isEqualToString:@""]){

            temtext=[NSString stringWithFormat:@"%@",self.coverletter];

            height=[self plaintextatwith:50 width:450 text:temtext height:height fontsize:13 context:pdfContext];

        }

        //结束

        CGContextEndPage(pdfContext);

    }

    if(YES){

    //开始画resume内容

    CGContextBeginPage(pdfContext, &pageRect);

    CGContextSelectFont(pdfContext, "Helvetica", 30, kCGEncodingMacRoman);

    CGContextSetTextDrawingMode(pdfContext, kCGTextFill);

    CGContextSetRGBFillColor(pdfContext, 0, 0, 0, 1);

    //显示first和lastname

    if(self.firstname!=nil||self.lastname!=nil){

        if(self.firstname==nil)

            self.firstname=@"";

        if(self.lastname==nil)

            self.lastname=@"";

        temtext=[NSString stringWithFormat:@"%@ %@",self.firstname,self.lastname];

        width=[self getfontwidth:temtext fontsize:30];

        height=700; 

        text=(char*)[temtext UTF8String];

        CGContextShowTextAtPoint(pdfContext, (612-width)/2, height, text, strlen(text));

    }

    //显示street等basicinfo信息

    //street,apt

    if((self.street!=nil &&![self.street isEqualToString:@""])||(self.apt!=nil&&![self.apt isEqualToString:@""])){

        if(self.street==nil){

            self.street=@"";

        }

        if(self.apt==nil){

            self.apt=@"";

        }

        height=[self getfontheight:temtext fontsize:10 height:height];

        CGContextSelectFont(pdfContext, "Helvetica", 10, kCGEncodingMacRoman);

        temtext=[NSString stringWithFormat:@"%@,%@",self.street,self.apt];

        width=[self getfontwidth:temtext fontsize:10];

        text=(char *)[temtext UTF8String];

        CGContextShowTextAtPoint(pdfContext, (612-width)/2, height, text,strlen(text));

    }

    //city,state zip

    if((self.city!=nil&&![self.city  isEqualToString:@""])||

       (self.state!=nil&&![self.state isEqualToString:@""])||

       (self.zip!=nil&&![self.state isEqualToString:@""])){

        if(self.city==nil){

            self.city=@"";

        }

        if(self.state==nil){

            self.state=@"";

        }

        if(self.zip==nil){

            self.zip=@"";

        }

        height=[self getfontheight:temtext fontsize:10 height:height];

        CGContextSelectFont(pdfContext, "Helvetica", 10,kCGEncodingMacRoman );

        temtext=[NSString stringWithFormat:@"%@,%@,%@",self.city,self.state,self.zip];

        width=[self getfontwidth:temtext fontsize:10];

        text=(char *)[temtext UTF8String];

        CGContextShowTextAtPoint(pdfContext, (612-width)/2, height, text, strlen(text));

    }

    //phone

    if(self.phone!=nil&&![self.phone isEqualToString:@""]){

        height=[self getfontheight:temtext fontsize:10 height:height];

        CGContextSelectFont(pdfContext, "Helvetica", 10,kCGEncodingMacRoman );

        temtext=[NSString stringWithFormat:@"Phone: %@",self.phone];

        width=[self getfontwidth:temtext fontsize:10];

        text=(char *)[temtext UTF8String];

        CGContextShowTextAtPoint(pdfContext, (612-width)/2, height, text, strlen(text));

    }

    //fax

    if(self.fax!=nil&&![self.fax isEqualToString:@""]){

        height=[self getfontheight:temtext fontsize:10 height:height];

       CGContextSelectFont(pdfContext, "Helvetica", 10,kCGEncodingMacRoman );

        temtext=[NSString stringWithFormat:@"Fax: %@",self.fax];

        width=[self getfontwidth:temtext fontsize:10];

        text=(char *)[temtext UTF8String];

        CGContextShowTextAtPoint(pdfContext, (612-width)/2, height, text, strlen(text));

    }

    //Email

    if(self.Email!=nil&&![self.Email isEqualToString:@""]){

        height=[self getfontheight:temtext fontsize:10 height:height];

        temtext=[NSString stringWithFormat:@"Email: %@",self.Email];

        width=[self getfontwidth:temtext fontsize:10];

        text=(char *)[temtext UTF8String];

        CGContextShowTextAtPoint(pdfContext, (612-width)/2, height, text, strlen(text));

    }

    //website

    if(self.website!=nil&&![self.website isEqualToString:@""]){

        height=[self getfontheight:temtext fontsize:10 height:height];

        temtext=[NSString stringWithFormat:@"Website: %@",self.website];

        width=[self getfontwidth:temtext fontsize:10];

        text=(char *)[temtext UTF8String];

        CGContextShowTextAtPoint(pdfContext, (612-width)/2, height, text, strlen(text));

    }

    //Objective

    if(self.objective!=nil&&![self.objective isEqualToString:@""]){

        //画线

        height=[self getfontheight:temtext fontsize:10 height:height];

        CGContextMoveToPoint(pdfContext, 50, height);

        CGContextAddLineToPoint(pdfContext, 612-50, height);

        CGContextStrokePath(pdfContext);

        height=height-20;

        text=(char *)[@"Objective" UTF8String];

        CGContextSetFontSize(pdfContext, 15);

        CGContextShowTextAtPoint(pdfContext, 55, height, text, strlen(text));

      //  CGContextSetFontSize(pdfContext, 10);

        height=height+13;

        temtext=[NSString stringWithFormat:@"%@",self.objective];

        height=[self plaintextatwith:150 width:350 text:temtext height:height fontsize:13 context:pdfContext];

    }

    //5个可以排序的

    for (int i=0;i<5;i++){

        if([OrderData getskillnumber]==i){                  //skill

            if(self.skills!=nil&&[self.skills count]!=0){

                // skill划线

                height=[self getfontheight:temtext fontsize:15 height:height];

                CGContextMoveToPoint(pdfContext, 50, height);

                CGContextAddLineToPoint(pdfContext, 612-50, height);

                CGContextStrokePath(pdfContext);

                height=height-20;

                text=(char *)[@"Skills" UTF8String];

                CGContextSetFontSize(pdfContext, 15);

                CGContextShowTextAtPoint(pdfContext, 55, height, text, strlen(text));

                //skill内容

                //height=height+13;

                for(int i=0;i<[self.skills count];i++){

                    NSManagedObject *object=[self.skills objectAtIndex:i];

                    temtext=[NSString stringWithFormat:@"* %@",[object valueForKey:@"skill"]];

                    height=[self plaintextatwith:150 width:350 text:temtext height:height fontsize:13 context:pdfContext];

                  //  height=height-13;

                }

            }

        }else if([OrderData getothernumber]==i){                //other

            if(self.others!=nil&&[self.others count]!=0){

                // other划线

                height=[self getfontheight:temtext fontsize:15 height:height];

                CGContextMoveToPoint(pdfContext, 50, height);

                CGContextAddLineToPoint(pdfContext, 612-50, height);

                CGContextStrokePath(pdfContext);

                height=height-20;

                text=(char *)[@"Others" UTF8String];

                CGContextSetFontSize(pdfContext, 15);

                CGContextShowTextAtPoint(pdfContext, 55, height, text, strlen(text));

                //other内容

                for(int i=0;i<[self.others count];i++){

                    NSManagedObject *object=[self.others objectAtIndex:i];

                    temtext=[NSString stringWithFormat:@"* %@",[object valueForKey:@"other"]];

                    height=[self plaintextatwith:150 width:350 text:temtext height:height fontsize:13 context:pdfContext];

                  //  height=height-13;

                }

            }

        }else if([OrderData getexperiencenumber]==i){                   //experience

            if(self.experience!=nil&&[self.experience count]!=0){

                //排序

                NSSortDescriptor *descriptor=[NSSortDescriptor sortDescriptorWithKey:@"start" ascending:NO];

                [self.experience setArray:[self.experience sortedArrayUsingDescriptors:[NSArray arrayWithObjects:descriptor, nil]]];

                // other划线

                height=[self getfontheight:temtext fontsize:15 height:height];

                CGContextMoveToPoint(pdfContext, 50, height);

                CGContextAddLineToPoint(pdfContext, 612-50, height);

                CGContextStrokePath(pdfContext);

                height=height-20;

                text=(char *)[@"Experience" UTF8String];

                CGContextSetFontSize(pdfContext, 15);

                CGContextShowTextAtPoint(pdfContext, 55, height, text, strlen(text));

                //experience内容

                for(int i=0;i<[self.experience count];i++){

                    NSManagedObject *object=[self.experience objectAtIndex:i];

                    NSString *position=[object valueForKey:@"position"];

                    NSString *companyname=[object valueForKey:@"companyname"];

                    NSString *location=[object valueForKey:@"location"];

                    NSDate *startdate=[object valueForKey:@"start"];

                    NSDate *enddate=[object valueForKey:@"end"];

                    NSString *thisid=[object valueForKey:@"thisid"];

                    temtext=[NSString stringWithFormat:@"%@",position];

                    height=[self plaintextatwith:150 width:350 text:temtext height:height fontsize:15 context:pdfContext];

                    height=height-13;

                    temtext=[NSString stringWithFormat:@"%@, %@",companyname,location];

                    height=[self plaintextatwith:180 width:320 text:temtext height:height fontsize:13 context:pdfContext];

                    height=height-13;

                    NSDateFormatter *timeformatter=[[NSDateFormatter alloc]init];

                    [timeformatter setDateFormat:@"MMMM, yyyy"];

                    NSNumber *number=(NSNumber*)[object valueForKey:@"currentjob"];

                    if(!number.boolValue){

                        temtext=[NSString stringWithFormat:@"%@ ~ %@",[timeformatter stringFromDate:startdate],[timeformatter stringFromDate:enddate]];

                    }else{

                         temtext=[NSString stringWithFormat:@"%@ ~ Present",[timeformatter stringFromDate:startdate]];

                    }

                    [timeformatter release];

                    height=[self plaintextatwith:180 width:320 text:temtext height:height fontsize:13 context:pdfContext];

                    NSMutableArray *responsibility=[DataController getresponsibility:thisid];

                    NSLog(@"responsibility cout:%d \n responsibility context:%@",[responsibility count],responsibility);

                    for(int j=0;j<[responsibility count];j++){

                        NSManagedObject *object=[responsibility objectAtIndex:j];

                        NSString *respon=[object valueForKey:@"responsibility"];

                        temtext=[NSString stringWithFormat:@"* %@",respon];

                        height=[self plaintextatwith:150 width:350 text:temtext height:height fontsize:13 context:pdfContext];

                        height=height-13;

                        NSLog(@"J=%d",j);

                    }               

                    height=height-15;

                }

            }

        }else if([OrderData geteducationnumber]==i){                    //Education

            if(self.education!=nil&&[self.education count]!=0){

                //排序

                NSSortDescriptor *descriptor=[NSSortDescriptor sortDescriptorWithKey:@"starttime" ascending:NO];

                [self.education setArray:[self.education sortedArrayUsingDescriptors:[NSArray arrayWithObjects:descriptor, nil]]];

                // other划线

                height=[self getfontheight:temtext fontsize:15 height:height];

                CGContextMoveToPoint(pdfContext, 50, height);

                CGContextAddLineToPoint(pdfContext, 612-50, height);

                CGContextStrokePath(pdfContext);

                height=height-20;

                text=(char *)[@"Education" UTF8String];

                CGContextSetFontSize(pdfContext, 15);

                CGContextShowTextAtPoint(pdfContext, 55, height, text, strlen(text));

                //内容

                for(int i=0;i<[self.education count];i++){

                    NSManagedObject *object=[self.education objectAtIndex:i];

                    NSString *schoolname=[object valueForKey:@"school"];

                    NSDate *startdate=[object valueForKey:@"starttime"];

                    NSDate *enddate=[object valueForKey:@"endtime"];

                    NSString *comment=[object valueForKey:@"comment"];

                    NSString *major=[object valueForKey:@"major"];

                    //height=height-13;

                    temtext=[NSString stringWithFormat:@"%@",schoolname];

                    height=[self plaintextatwith:150 width:350 text:temtext height:height fontsize:15 context:pdfContext];    

                    height=height-13;

                    NSDateFormatter *timeformatter=[[NSDateFormatter alloc]init];

                    [timeformatter setDateFormat:@"MMMM, yyyy"];

                    temtext=[NSString stringWithFormat:@"%@ ~ %@",[timeformatter stringFromDate:startdate],[timeformatter stringFromDate:enddate]];

                    [timeformatter release];

                    height=[self plaintextatwith:180 width:320 text:temtext height:height fontsize:13 context:pdfContext];

                    height=height-13;

                    temtext=[NSString stringWithFormat:@"%@",major];

                    height=[self    plaintextatwith:180 width:320 text:temtext height:height fontsize:13 context:pdfContext];

                    height=height-13;

                    temtext=[NSString stringWithFormat:@"%@",comment];

                    height=[self plaintextatwith:180 width:320 text:temtext height:height fontsize:13 context:pdfContext];

                }

            }

        }else if([OrderData getawardnumber]==i){            //award

            if(self.awards!=nil&&[self.awards count]!=0){

                //排序

                NSSortDescriptor *descriptor=[NSSortDescriptor sortDescriptorWithKey:@"awarddate" ascending:NO];

                [self.awards setArray:[self.awards sortedArrayUsingDescriptors:[NSArray arrayWithObjects:descriptor, nil]]];

                // other划线

                height=[self getfontheight:temtext fontsize:15 height:height];

                CGContextMoveToPoint(pdfContext, 50, height);

                CGContextAddLineToPoint(pdfContext, 612-50, height);

                CGContextStrokePath(pdfContext);

                height=height-20;

                text=(char *)[@"Awards" UTF8String];

                CGContextSetFontSize(pdfContext, 15);

                CGContextShowTextAtPoint(pdfContext, 55, height, text, strlen(text));

                //award内容

                for(int i=0;i<[self.awards count];i++){

                    NSManagedObject *object=[self.awards objectAtIndex:i];

                    NSString *comment=[object valueForKey:@"comment"];

                    NSString *name=[object valueForKey:@"name"];

                    NSDate *awarddate=[object valueForKey:@"awarddate"];

                    temtext=[NSString stringWithFormat:@"%@",name];

                   height= [self plaintextatwith:150 width:350 text:temtext height:height fontsize:15 context:pdfContext];

                    height=height-13;

                    NSDateFormatter *timeformatter=[[NSDateFormatter alloc]init];

                    [timeformatter setDateFormat:@"MMMM, dd, yyyy"];

                    temtext=[NSString stringWithFormat:@"%@",[timeformatter stringFromDate:awarddate]];

                    [timeformatter release];

                    height=[self plaintextatwith:180 width:320 text:temtext height:height fontsize:15 context:pdfContext];

                   height=height-13;

                    temtext=[NSString stringWithFormat:@"%@",comment];

                    height=[self plaintextatwith:180 width:320 text:temtext height:height fontsize:13 context:pdfContext];

                    height=height-15;

                    }

                }

            }

        } 

               CGContextEndPage(pdfContext);

    }

        CGContextRelease(pdfContext);

}
时间: 2024-10-05 05:30:56

ios 创建和绘画pdf文件 -转的相关文章

ios 创建自己的.a文件

1:首先创建个 静态工程(Cocoa Touch Static Library); 方法名字,一定要暴露在.h文件中, 2:分别在模拟器环境和真机环境下 Analyze (shift+command+B) , 然后分别找到.a文件 保存(现在的.a  文件只能在对应的环境下使用,不能通用) 3:制作 真机和模拟器通用的.a文件 打开终端, lipo -create 保存的一个.a文件路径  另外一个.a文件路径   -output 合成后的通用的.a文件路径(可以自己设置) 4:使用,把通用.a

iOS开发:读取pdf文件

方法一:使用QLPreviewController #pragma mark  浏览存在沙盒的文件 -(void)quickLook { QLPreviewController *QLPreviewVc = [[QLPreviewController alloc] initWithNibName:nil bundle:nil]; QLPreviewVc.dataSource = self; QLPreviewVc.delegate = self; [self presentViewControl

怎么用OCR图文识别软件在MS Office中创建PDF文件

ABBYY PDF Transformer+是一款可创建.编辑及将PDF文件转换为其他可编辑格式的OCR图文识别软件,不仅可以从纸质文档.图像文件和任何其他流行格式创建PDF文件(相关文章请参考如何从文件创建ABBYY PDF Transformer+ PDF文档),还可以从MS Office中创建PDF文件,本文为大家详解如何使用ABBYY PDF Transformer+从MS Office中轻松创建PDF文件. 本文仅以Microsoft Word为例,MS的其他应用程序操作步骤类似. 步

PDF文件中如何插入对象

在已有的文本中插入对象,是一种非常常见的编辑技巧.放在Word文档中,我相信大多数的人都会轻松搞定这个问题.但如果在PDF文档中去插入自己想要的对象的话,很多人就会纳闷了,难道PDF还可以进行编辑?别不相信,现在我们只要使用专门的pdf编辑器早就可以对PDF进行编辑了. 捷速PDF编辑器就是这样的一款软件,帮助我们解决各种PDF的编辑问题.捷速PDF编辑器是一款体积小,功能强大的软件,专业的PDF编辑器能使用户如同操作Office系列软件一样去创建和编辑PDF文件,捷速就完全能做到.软件不仅支持

IOS加载PDF文件

今天的任务是:在iOS上加载显示pdf文件. 方法一:利用webview [cpp] view plaincopy -(void)loadDocument:(NSString *)documentName inView:(UIWebView *)webView { NSString *path = [[NSBundle mainBundle] pathForResource:documentName ofType:nil]; NSURL *url = [NSURL fileURLWithPath

iOS 创建静态库文件时去掉其中的Symbols

在工程中创建静态库文件时,默认会将一些Symbols加到静态库文件中,这样做有两个缺点: 1.如果引用静态库文件的工程中发生了bug,就会直接跳转到静态库的源码. 2.静态库文件的大小会因此翻几番.本人最近做的这个静态库文件中,去掉symbols前大小为7.8MB左右,去掉以后大小为2.8MB. 要去掉Symbols,首先打开Build Settings并选中静态库的Target,然后设置下列选项: 如果有错误或遗漏,欢迎批评指正. iOS 创建静态库文件时去掉其中的Symbols,布布扣,bu

iOS 创建文件夹,删除文件夹,对文件夹重命名的操作

iOS 创建文件夹,删除文件夹,对文件夹重命名的操作 by 伍雪颖 + (void)createFolder:(NSString *)folderName { NSString *imageDir = [NSString stringWithFormat:@"%@/Documents/%@", NSHomeDirectory(),folderName]; NSLog(@"HomeDir: %@",imageDir); BOOL isDir = NO; NSFileM

展示PDF文件——Android/IOS

年后到现在,公司的项目紧,导致年初的计划并没有很好的执行. 最近熬夜越熬越晚,希望6月前能如期完成第一个目标. 今天谈谈直接在代码中加载PDF文件(公司的新需求,就地取材). 我的需求背景: 1.首先,随着移动端继续侵占PC的场景,手机上阅读越来越普遍,而一些既有的PDF文本也就被希望加载到手机端做友好展示 2.其次,公司新项目的思路是展示型,尽可能减少网络交互(即尽可能少的调用接口获取数据),除了用户反馈.检测更新等,全项目只用了两个接口,大量业务逻辑是通过下载数据库在本地进行操作.因而,PD

iOS:quartz2D绘图(在PDF文件上绘制图片)

quartz2D还可以在PDF文件上绘制图片,它有自己的PDF Graphics Context上下文,通过UIGraphicsBeginPDFContextToFile方法开始上下文后就可以绘制图片了,最后记得使用UIGraphicsEndPDFContext()方法结束上下文.绘制pdf时,既可以绘制单页pdf,也可以绘制多页pdf成一本书,在绘制开始时,使用UIGraphicsBeginPDFPage()开始新的一页这是非常重要的.下面演示绘制单页pdf和多页的pdf. 具体的实例如下: