cgpdfcontext

iPhone/iPad draw pdf like iBooks?

这一生的挚爱 提交于 2020-01-01 18:05:10
问题 Does anyone know how to use core graphics to draw a pdf like in iBooks. I can already draw a pdf page using core graphics but was curious how iBooks shows a lower quality view of each page so it loads fast and then when you stay on a page longer it renders it a full quality. This makes it able to open the pdf without having to make the user wait like most magazine apps you see on ipad. Any ideas would help! 回答1: Apple have some "ZoomingPDFViewer" sample code: http://developer.apple.com

iOS CGPdf highlight text using CGrect

折月煮酒 提交于 2019-12-11 21:15:59
问题 I am trying to highlight text using rect but the code below: CGRect originalSize = CGPDFPageGetBoxRect(pagePDFRef, kCGPDFMediaBox); return me rect less then I expected or maybe less then I see. Is there any already made method that highlight text using scanner and CGRect 来源: https://stackoverflow.com/questions/23920377/ios-cgpdf-highlight-text-using-cgrect

How to draw text in PDF context in Swift?

此生再无相见时 提交于 2019-11-27 21:34:37
I have a simple function that create pdf file and return its path. func createPDFFileAndReturnPath() -> String { let fileName = "pdffilename.pdf" let paths = NSSearchPathForDirectoriesInDomains(.LibraryDirectory, .UserDomainMask, true) let documentsDirectory = paths[0] let pathForPDF = documentsDirectory.stringByAppendingString("/" + fileName) UIGraphicsBeginPDFContextToFile(pathForPDF, CGRectZero, nil) UIGraphicsBeginPDFPageWithInfo(CGRectMake(0, 0, 100, 400), nil) let text = "text" //how to print this in whatever place? //text.drawInRect - this doesn't work UIGraphicsEndPDFContext() return

How to draw text in PDF context in Swift?

南笙酒味 提交于 2019-11-26 20:42:51
问题 I have a simple function that create pdf file and return its path. func createPDFFileAndReturnPath() -> String { let fileName = "pdffilename.pdf" let paths = NSSearchPathForDirectoriesInDomains(.LibraryDirectory, .UserDomainMask, true) let documentsDirectory = paths[0] let pathForPDF = documentsDirectory.stringByAppendingString("/" + fileName) UIGraphicsBeginPDFContextToFile(pathForPDF, CGRectZero, nil) UIGraphicsBeginPDFPageWithInfo(CGRectMake(0, 0, 100, 400), nil) let text = "text" //how to