Microsoft Windows Phone 8.1 support ends (13 Jul 2017)

Microsoft has ended support for Windows Phone 8.1

Questions about iOS development and PDF

adding image to pdf

More
9 years 2 months ago #11584 by Shades
adding image to pdf was created by Shades
Hi,

Need your help please to be able to add an image without alpha:
Code:
CGRect drawRect = CGRectMake(100, 0, 300, 300); UIImage *img =[UIImage imageWithData:data]; if(img){ CGContextDrawImage(context, drawRect, img.CGImage); }

After that I am not able to see the image added even after invoking
Code:
[m_view vRenderSync:page];
Thank you for your help
More
9 years 2 months ago #11585 by stronglee
Replied by stronglee on topic adding image to pdf
Hi,
did you check context is nil ?
and are you calling UIGraphicsGetCurrentContext() inside of the drawRect method? As far as I know, it can only be called within drawRect, otherwise it will just return nil.

I tried your method add into drawRect method ,it works.
More
9 years 2 months ago #11586 by stronglee
Replied by stronglee on topic adding image to pdf
If you want add image annot to PDF files,you can try AddAnnotBitmap method :)
More
9 years 2 months ago #11587 by Shades
Replied by Shades on topic adding image to pdf
Thank you for your reply :)

with AddAnnotBitmap,the image doesn't keep the transparent background .( the background is always white )That's why I am trying other methods.
More
9 years 2 months ago #11594 by emanuele
Replied by emanuele on topic adding image to pdf
Hi,

you can download the new beta version here , with the new PDFDoc method: [PDFDoc newImage] that uses a CGImageRef to create a PDFDocImage object.
Here is an example:
Code:
// Get PDFDocImage instance from CGImageRef (keeping alpha channel) PDFDocImage *i = [m_doc newImage:ref :YES]; // Add the image [page addAnnotBitmap:i :&rect];
More
9 years 2 months ago #11597 by Shades
Replied by Shades on topic adding image to pdf
Thank you very much for your help !! :)
Time to create page: 0.418 seconds
Powered by Kunena Forum