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

TOPIC:

addAnnotBitmap doesn't work in 2.2.0 9 years 10 months ago #6370

  • Rossi
  • Rossi's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
  • Posts: 49
  • Thank you received: 0
I tied to add an image to pdfview. I implemente the method
- (BOOL)addAnnotBitmap:(PDF_MATRIX)matrix :(CGImageRef)bitmap :(BOOL)has_alpha :(const PDF_RECT *)rect  {
    return Page_addAnnotBitmap(m_page, matrix, bitmap, has_alpha, rect);
}
but when i use it although it return true, no image is displayed and the annotation count not increase it value.

It is a bug or I did something wrong?

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

addAnnotBitmap doesn't work in 2.2.0 9 years 10 months ago #6371

  • nermeen
  • nermeen's Avatar
  • Offline
  • Platinum Member
  • Platinum Member
  • Posts: 962
  • Thank you received: 87
Try using the following:
PDFPos pos = m_view.vGetPos((int)rects[0], (int)rects[1]);//where rect is in screen coordinate.
PDFVPage vpage = m_view.vGetPage(pos.pageno);
Matrix mat = vpage.CreateInvertMatrix(m_view.vGetX(), m_view.vGetY());
mat.TransformRect(rect);
Page page = vpage.GetPage();
page.AddAnnotBitmap(bitmap, has_alpha, rect);
mat.Destroy();

Then you need to rerender the page

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

addAnnotBitmap doesn't work in 2.2.0 9 years 10 months ago #6372

  • Rossi
  • Rossi's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
  • Posts: 49
  • Thank you received: 0
Sorry, i don't understand how to use your code.
- PDFPos return unknown type (i generally use PDFV_POS)
- how i should create rects
- Matrix is also unknown type and the method CreateInvertMatrix does not exist

Please can you explain me your code?

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

addAnnotBitmap doesn't work in 2.2.0 9 years 10 months ago #6373

  • nermeen
  • nermeen's Avatar
  • Offline
  • Platinum Member
  • Platinum Member
  • Posts: 962
  • Thank you received: 87
Sorry that was for android, soon my colleague will send you the ios version

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

addAnnotBitmap doesn't work in 2.2.0 9 years 10 months ago #6374

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

try to set cache path... something like:

NSString *cachesPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
cachesPath = [cachesPath stringByAppendingPathComponent:@"file.dat"];
[m_doc setCache:cachesPath];

it must be set to add an image.

That procedure is already been explained in this old post:

www.androidpdf.mobi/forum/ios-dev/1213-h...uiimage?start=6#4370

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

addAnnotBitmap doesn't work in 2.2.0 9 years 10 months ago #6377

  • Rossi
  • Rossi's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
  • Posts: 49
  • Thank you received: 0
Hi, thank you for your reply. I not saw the old post.
I try with your tips and successfully add image on my pdfview but with same problem.
If i add a trasparent png it is inserted with black background.
Same time when i add the image the aplpication crashes on this function
-(bool)IsFinished
in PDFVPage with EXEC_BAD_ACCESS.

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

Powered by Kunena Forum