Exception when calling PTImage Create

14 views
Skip to first unread message

david.w.compton

unread,
Aug 29, 2016, 5:17:54 PM8/29/16
to PDFTron PDFNet SDK
I have been using the following code to write out images to a PDF file that I am creating on the fly to attach to an email.

 // Write the annotation icon
        NSString * imagePath = [[NSBundle mainBundle] pathForResource: [[imageName lastPathComponent] stringByDeletingPathExtension] ofType:[imageName pathExtension]];
        PTSDFDoc *sdfDoc = [doc GetSDFDoc];
        
        @try {
            PTImage *img = [PTImage Create: sdfDoc filename: imagePath];
            element = [eb CreateImageWithCornerAndScale:img x:leftMargin y:(lineY - 5) hscale:14 vscale:14];
            [ew WritePlacedElement: element];
        }
        @catch (NSException *exc) {
            [theAppDelegate logException:exc withMessage:@"Unable to write the annotation icon in createAnnotationsPDF."];
        }

Recently, since upgrading to iOS 9, this code has stopped working.  It throws the following exception when it calls [PTImage Create.......]:

exc NSException * name: @"PDFNet Exception" - reason: @"Failed to embed PNG image" 0x0000000136d028e0

I have PNG compression turned off in my XCode project settings.

Can you help me to resolve this issue?

David  

Ryan

unread,
Aug 30, 2016, 6:26:56 PM8/30/16
to PDFTron PDFNet SDK
could you post, or email to support at pdftron.com the image in question?

also, are you able to use that png in the AddImageTest sample that comes with the SDK? Or does the error only happen in your project?

thanks
Reply all
Reply to author
Forward
0 new messages