Reply:
It looks like a picture will paste in the past, in fact, this PDF is the need to be repainted. Open the pdf PDFDocumentRef, and then draw pictures on the page.
Get the original PDFDocumentRef:
CGPDFDocumentRef WQGetPDFDocumentRef (NSString * filename)
{
CFStringRef path;
CFURLRef url;
CGPDFDocumentRef document;
size_t count;
path = CFStringCreateWithCString (NULL, [filename UTF8String], kCFStringEncodingUTF8);
url = CFURLCreateWithFileSystemPath (NULL, path, kCFURLPOSIXPathStyle, 0);
CFRelease (path);
document = CGPDFDocumentCreateWithURL (url);
CFRelease (url);
count = CGPDFDocumentGetNumberOfPages (document);
if (count == 0) {
printf ("[% s] needs at least one page! \ n", [filename UTF8String]);
return NULL;
}
return document;
}
Then draw a new one, the first draw of the original pages of information and then draw pictures
/ / Draw pictures to give you package up a method
void drawPicture (CGContextRef myContext, CGRect rect, UIImage * image)
{
CFDataRef imgData = (__bridge CFDataRef) (UIImagePNGRepresentation (image));
CGDataProviderRef dataProvider = CGDataProviderCreateWithCFData (imgData);
CGImageRef imageRef = CGImageCreateWithPNGDataProvider (dataProvider,
NULL,
NO,
kCGRenderingIntentDefault);
CGContextDrawImage (myContext, rect, imageRef);
CGDataProviderRelease (dataProvider);
CGImageRelease (imageRef);
}
void yourDrawPDFFunc (...)
{
...
/ / In the BeginPage drawn between the content of this page and EndPage called when
CGPDFContextBeginPage (pdfContext, pageDictionary);
/ / Draw the original first page data
/ / Then call drawPicture
CGPDFContextEndPage (pdfContext);
....
}
Reply:
As for your mouse pointer position, the data transfer is good, right? Note that the coordinate system conversion.
Also, a suggestion: do not use as much as possible after posting "urgent!!" This wording more clearly describe their problems patiently, trying to do what I hope what effect, the card where it is. His word describes the problem very few people willing to participate in the general answer and exchanges.
Good night.
No comments:
Post a Comment