cgpdfdocument

How to get actual pdf page size in iPad?

泄露秘密 提交于 2019-11-30 05:56:50
问题 How can I get PDF page width and height in iPad? Any document or suggestions on how I can find this information? 回答1: I was using the answers here until I realised a one-liner for this CGRect pageRect = CGPDFPageGetBoxRect(pdf, kCGPDFMediaBox); // Which you can convert to size as CGSize size = pageRect.size; Used in Apple's sample ZoomingPDFViewer app 回答2: Here's the code to do it; also to convert a point on the page from PDF coordinates to iOS coordinates. See also Get PDF hyperlinks on iOS

CGPDFDocumentRef from NSData

好久不见. 提交于 2019-11-30 00:32:44
I get my PDF from SQLite DB into a NSData variable. Now what are my options to create CGPDFDocumentRef from this NSData? Or what are my options anyway to create this CGPDFDocumentRef, have the data in SQLite? viggio24 You can create a PDF document using this function: CGPDFDocumentRef CGPDFDocumentCreateWithProvider ( CGDataProviderRef provider ); To create the provider you can use this function: CGDataProviderRef CGDataProviderCreateWithCFData ( CFDataRef data ); and consider that NSData and CFDataRef are toll-free bridged so you can use them interchangeably. So summarizing try this: NSData

CGPDFDocumentRef from NSData

二次信任 提交于 2019-11-28 22:18:37
问题 I get my PDF from SQLite DB into a NSData variable. Now what are my options to create CGPDFDocumentRef from this NSData? Or what are my options anyway to create this CGPDFDocumentRef, have the data in SQLite? 回答1: You can create a PDF document using this function: CGPDFDocumentRef CGPDFDocumentCreateWithProvider ( CGDataProviderRef provider ); To create the provider you can use this function: CGDataProviderRef CGDataProviderCreateWithCFData ( CFDataRef data ); and consider that NSData and

Show PDF in iPad using CGPDF APIs [closed]

心已入冬 提交于 2019-11-28 18:27:38
I have learned Apple has release CGPDF APIs in SDK 3.2 for drawing PDF context. What I understand from these APIs is that you can draw a PDF to a data object or a PDF file. You can then export it, may be, to your sandbox's directory OR add as an attachment in the mail. But I am not sure if we can use these APIs to read a PDF from application bundle and show it to the user page-by-page on the screen. What I want to do is open a PDF of a magazine in a magazine reader app. I was also wondering if we can identify the links in a PDF file and open them in the app. Let me know if have done OR doing

How to get actual pdf page size in iPad?

家住魔仙堡 提交于 2019-11-28 10:24:59
How can I get PDF page width and height in iPad? Any document or suggestions on how I can find this information? I was using the answers here until I realised a one-liner for this CGRect pageRect = CGPDFPageGetBoxRect(pdf, kCGPDFMediaBox); // Which you can convert to size as CGSize size = pageRect.size; Used in Apple's sample ZoomingPDFViewer app Donal O'Danachair Here's the code to do it; also to convert a point on the page from PDF coordinates to iOS coordinates. See also Get PDF hyperlinks on iOS with Quartz #import <CoreGraphics/CoreGraphics.h> . . . . . . . . . . . NSString *pathToPdfDoc

Rendering a CGPDFPage into a UIImage

好久不见. 提交于 2019-11-28 06:07:04
I'm trying to render a CGPDFPage (selected from a CGPDFDocument) into a UIImage to display on a view. I have the following code in MonoTouch which gets me part way there. RectangleF PDFRectangle = new RectangleF(0, 0, UIScreen.MainScreen.Bounds.Width, UIScreen.MainScreen.Bounds.Height); public override void ViewDidLoad () { UIGraphics.BeginImageContext(new SizeF(PDFRectangle.Width, PDFRectangle.Height)); CGContext context = UIGraphics.GetCurrentContext(); context.SaveState(); CGPDFDocument pdfDoc = CGPDFDocument.FromFile("test.pdf"); CGPDFPage pdfPage = pdfDoc.GetPage(1); context.DrawPDFPage

PDFKitten is highlighting on wrong position

对着背影说爱祢 提交于 2019-11-27 23:18:22
I am using PDFKitten for searching strings within PDF documents with highlighting of the results. FastPDFKit or any other commercial library is no option so i sticked to the most close one for my requirements. As you can see in the screenshot i searched for the string "in" which is always correctly highlighted except the last one. I got a more complex PDF document where the highlighted box for "in" is nearly 40% wrong. I read the whole syntax and checked the issues tracker but except line height problems i found nothing regarding the width calculation. For the moment i dont see any pattern

Show PDF in iPad using CGPDF APIs [closed]

梦想的初衷 提交于 2019-11-27 11:21:24
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 4 years ago . I have learned Apple has release CGPDF APIs in SDK 3.2 for drawing PDF context. What I understand from these APIs is that you can draw a PDF to a data object or a PDF file. You can then export it, may be, to your sandbox's directory OR add as an attachment in the mail. But I am

Reading PDF files as string through iPhone application

走远了吗. 提交于 2019-11-27 10:28:26
I am facing some problem in iPhone application development for "Reading PDF". I have tried following code. I know I have used wrong methods for parsing - parsing methods are just used for searching purpose. But I want to convert entire pdf text in to a string. Say for example Apple's MobileHIG.pdf - I have used in this code. @implementation NetPDFViewController size_t totalPages; // a variable to store total pages // a method to get the pdf ref CGPDFDocumentRef MyGetPDFDocumentRef (const char *filename) { CFStringRef path; CFURLRef url; CGPDFDocumentRef document; path =

Is there a way to programmatically scroll to a PDF page within a UIWebView?

大兔子大兔子 提交于 2019-11-27 05:43:41
问题 It is possible to use JavaScript to set the pixel y-offset of a UIWebView , e.g.: [webView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"scrollTo(0, %d)", offset]]; So is there a way to get: The pixel height of an individual page of a PDF within the web view? The size of the gap between pages? Is this information available from the UIWebView or can it be calculated through alternative means? I'm thinking that if I have the number of pages (via