简体   繁体   English

如何在iPhone应用程序中将背景颜色转换为pdf视图

[英]how to background color to pdf view in iphone app

I am creating the pdf using the following tutorial is works for me 我正在使用以下教程创建pdf对我有用

but it shows white background of pdf i want to give color to the background how to do this 但它显示了pdf的白色背景我想给背景颜色如何做到这一点

i have seen all the code but there is no any option in this to give color is there anyway to give color. 我已经看到了所有的代码但是没有任何选项可以让颜色无论如何都能给出颜色。

Inside do while loop use these lines of code.... Here pdfpageFrame is the frame of your Pdfpage. 在while while循环中使用这些代码行....这里pdfpageFrame是你的Pdfpage的框架。

CGContextRef currentContext = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(currentContext, [UIColor redColor].CGColor );
CGContextFillRect(currentContext, pdfpageFrame);

Just before the drawBorder, do this: 就在drawBorder之前,执行以下操作:

  CGContextRef currentContext = UIGraphicsGetCurrentContext();
  CGContextSetFillColorWithColor(currentContext, [UIColor colorWithRed:1.0 green:1.0 blue:0.0 alpha:1.0].CGColor);
  CGContextFillRect(currentContext, pdfpageFrame);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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