Skip to content
This repository was archived by the owner on Apr 25, 2019. It is now read-only.
This repository was archived by the owner on Apr 25, 2019. It is now read-only.

After we insert a textField annotation, we save it with the pdf page, the textField is disappeared, but it is really saved to the pdf.  #12

@gyx8899

Description

@gyx8899

When I encounter this problem, i am so surprised with the "right" code in drawing text String.
After server days, I found the key of the problem. My code are following:

  • (void) drawInContext:(CGContextRef)context {
    UIGraphicsPushContext(context); // key 1

    CGContextSetTextMatrix(context, CGAffineTransformMake(1.0,0.0, 0.0, -1.0, 0.0, 0.0));
    CGContextSetTextDrawingMode(context, kCGTextFill); // This is the default
    CGContextSetFillColorWithColor(context, [[UIColor blackColor] CGColor]);
    [self.text drawInRect:self.rect withAttributes:@{NSFontAttributeName:self.font}];

    UIGraphicsPopContext(); // key 2
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions