Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Questions about iOS development and PDF
  • Page:
  • 1

TOPIC:

Crash with bitmap annotation when saving as 10 years 2 months ago #5285

  • jandrad
  • jandrad's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 3
  • Thank you received: 0
Hi

I've been having trouble with bitmap annotations when the document is saved into another file instead of the original.

I'm adding the bitmap annotation using this code:
PDFMatrix *mat = [vpage CreateMatrix];
    UIImage * imgAdd = [UIImage imageNamed:@"image.png"];
    PDF_RECT rect;
    
    float pdf_x = [vpage ToPDFX:x :[m_view vGetX]];
    float pdf_y = [vpage ToPDFY:y :[m_view vGetY]];
    
    rect.bottom = pdf_y - aWidth;
    rect.top = pdf_y + aWidth;
    rect.right =pdf_x + aHeight;
    rect.left =pdf_x - aHeight;
    
    [mat invert];
    [mat transformRect:&rect];
    
    [page addAnnotBitmap:mat.handle bitmap:imgAdd.CGImage alpha:YES rect:&rect];

The annotation is saved properly when using saving the document using Document_save(), however if I use Document_saveAs() the app crashes the next time the pdf is opened.

The steps I use to reproduce the issue are the following:

1. Open the original PDF file.
2. Save the a copy of the PDF file to another path.
3. Close the original PDF.
4. Open the created PDF for editing.
4. Add a bitmap annotation using the code mentioned earlier.
5. Save a copy of the created PDF file to another path.
6. Open the second copy, the app crashes.

Here are the original and generated PDFs and the crash log I'm getting when I try to open the generated PDF.

dl.dropboxusercontent.com/u/1634860/TestPDF.zip

Could anyone help me with this problem?

Please Log in or Create an account to join the conversation.

Crash with bitmap annotation when saving as 10 years 1 month ago #5373

  • emanuele
  • emanuele's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 580
  • Thank you received: 67

Please Log in or Create an account to join the conversation.

Crash with bitmap annotation when saving as 10 years 1 month ago #5392

  • jandrad
  • jandrad's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 3
  • Thank you received: 0
Thank you emanuele, I can confirm it is not crashing anymore. However when I add a bitmap annotation on the saved pdf the first one does not contain alpha. If I add more than one the rest hast the alpha channel set correctly.

Could you help me with this?

Thanks again

Please Log in or Create an account to join the conversation.

Crash with bitmap annotation when saving as 10 years 1 month ago #5398

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1123
  • Thank you received: 73
just fixed, plz wait next version again.

Please Log in or Create an account to join the conversation.

Crash with bitmap annotation when saving as 10 years 1 month ago #5425

  • emanuele
  • emanuele's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 580
  • Thank you received: 67
Hi,

a new version has been published with this fix:

www.androidpdf.mobi/download/download-io...69-ios-pdfviewer-188
The following user(s) said Thank You: Anju

Please Log in or Create an account to join the conversation.

Crash with bitmap annotation when saving as 10 years 1 month ago #5444

  • jandrad
  • jandrad's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 3
  • Thank you received: 0
I can confirm it is now working as expected.

Thank you!

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Powered by Kunena Forum