objective c - iOS 8 API printing PDFs: broken when drawing text? -


After

I have an application that has been generously created using Quartz / UIKit since IOS 4, But since the upgrade of the project to iOS 8, whenever PDF attempts to present the text in context, it crashes the drawing line & amp; A rectangle is fine, but any change of string rendering fails with one exception in one of the low level libraries.

Instead of posting your own source, I tried working backwards from Apple's document. Assumption that it has been outdated, but if it is not going to work, then they have to decide it.

Customized source code:

  - (zero) yield PDF {NSString * text = "Bergerge Bluff Glup Foo!" ;; CFATAditorisingTraftTect = CFETEEDStringCarate (zero, (CF stringerf) text, faucet); CTFramesetterRef frameset = CTFramesetterCreateWithAttributedString (current text); NSString * pdfFileName = fullPath; Create PDF Contection using the default page size of 612 x 792. UigRFixBijinPDFCTXToFile (PDFFilename, CGRTaZero, Zero); CFRange current range = CfRangemake (0, 0); NSInteger current page = 0; BOOL = No; Do {// mark the beginning of a new page UIGraphicsBeginPDFPageWithInfo (CGRectMake (0, 0, 612, 792), zero); // Draw a page number at the bottom of each page. CurrentPage ++; // [auto draw number: current page]; // Present the current page and update the current category at the beginning of the next page on // page. // currentRange = [Self RenderPagesWithtechners: Current Range and Fremmeter: Framestator]; CurrentRange = [Self Renderpage: Textures with Current Page: Current Range and Framesasseter: Frameseter]; // If we are at the end of the text, then exit the loop. If (currentRange.location == CFAttributedStringGetLength (currently CFAttributedStringRef))) = Yes; } While (done!); // Close PDF reference and write out the content. UIGraphicsEndPDFContext (); // Release Frerighter CFRelease (framesetter); // String attributed to. CFRelease (currentText); } - (CFRange) renderPage: (NSInteger) pageNum withTextRange: (CFRange) currentRange andFramesetter: (CTFramesetterRef) framesetter {// Get Graphics Reference. CGContextRef currentContext = UIGraphicsGetCurrentContext (); // Put the text matrix in a known state. This ensures that no old scaling factor has been left in place. CGContextSetTextMatrix (CurrentContact, CGAffineTransformIdentity); // Create path object to attach text. Use 72 point // margin around all points, CGRact frame = CGRactack (72, 72, 468, 648); CGMutablePathRef FramePath = CGPathCreateMutable (); CGPathAddRect (framepath, faucet, framework); // get the frame which will rendering // The current range specifies the variable only the starting point. The amount of text that the framesetter // frames will bring out will be the same CTFrameRef Frame Ref = CTFramesetterCreateFrame (Frameset, Current Range, Framepath, Faucet); CGPathRelease (framePath); // Core text pulls from bottom-left corner, so // flip the current conversion before drawing. CGContextTranslateCTM (CurrentContacts, 0, 792); CGContextScaleCTM (Current Context, 1.0, -1.0); // Draw Frame CTFrameDraw (Frameraf, CurrentContax); // Update the current category based on what was prepared. CurrentRange = CTFrameGetVisibleStringRange (frameraf); CurrentRange.location + = currentRange.length; CurrentRange.length = 0; CFRelease (frameRef); Return current range; }  

I have tried many permutations, and all these lessons feel unsuccessful at the exact point of rendering. The above-mentioned Apple-derived example dies on line:

  CTFRMDO (Framerf, CurrentConttex);  

Other code tries to get the minimum amount of work done:

  NSMutableParagraphStyle * textstyle = NSMutableParagraphStyle.defaultParagraphStyle.mutableCopy; TextStyle.alignment = NSTextAlignmentLeft; NSDictionary * textFontAttributes = @ {NSFontAttributeName: [UIFont fontWithName: @ "Helvetica" size: 12], NSForegroundColorAttributeName: UIColor.redColor, NSParagraphStyleAttributeName: textstyle}; [@ "Hello world!" DrawAtPoint: CGPointZero withAttributes: textFontAttributes];  

... accidents on "drawAtPoint" calls

"itemprop =" text ">

what's the price, if I execute an app on a device connected to the debugger (such as the springboard Run / kill / launch), then PDF creation works just fine. Possibly the fictitious exception being thrown away is ignored in real life.


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -