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

TOPIC:

addAnnotBitmap doesn't work in 2.2.0 6 years 8 months ago #6409

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1037
  • Karma: 43
  • Thank you received: 62
is it this?
BOOL result = [page addAnnotBitmap:mat :ref :YES :&rect];

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

addAnnotBitmap doesn't work in 2.2.0 6 years 8 months ago #6414

  • Rossi
  • Rossi's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
  • Posts: 49
  • Karma: 1
  • Thank you received: 0
Are you saying I should use mat instead mat.handle?
In this case, mat is a PDFMatrix and addAnnotBitmap need a PDF_MATRIX.

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

addAnnotBitmap doesn't work in 2.2.0 6 years 8 months ago #6424

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

try to save m_doc before [self refresh]

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

addAnnotBitmap doesn't work in 2.2.0 6 years 8 months ago #6431

  • Rossi
  • Rossi's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
  • Posts: 49
  • Karma: 1
  • Thank you received: 0
hi, crashes evenly.

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

addAnnotBitmap doesn't work in 2.2.0 6 years 8 months ago #6479

  • stronglee
  • stronglee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 93
  • Karma: 1
  • Thank you received: 2
Hi,
Try iOS PDFViewer SDK 3.0.2 version. :-)

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

addAnnotBitmap doesn't work in 2.2.0 6 years 8 months ago #6531

  • Rossi
  • Rossi's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
  • Posts: 49
  • Karma: 1
  • Thank you received: 0
Hi,
i tried the new sdk, it is better in may aspect but i have the same problem within add a bitmap.
I set the cache file in pdfOpen:
if(SYS_VERSION>=7.0)
    {
        m_view = [[PDFView alloc] initWithFrame:CGRectMake(0, 0, rect.size.width, rect.size.height)];
    }
    else
    {
        m_view = [[PDFView alloc] initWithFrame:CGRectMake(0, 0, rect.size.width, rect.size.height-20-44)];
    }
    NSString *cachesPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
    cachesPath = [cachesPath stringByAppendingPathComponent:@"file.dat"];
    [m_doc setCache:cachesPath];
    [m_view vOpen :m_doc :(id<PDFViewDelegate>)self];

In onsigletapped i insert this line
[m_view vAddAnnotBitmap:x y:y image:myimage];

and this is the vAddAnnotBitmap implemented in PDFView
struct PDFV_POS pos;
    [m_view vGetPos:&pos:x:y];
    if(pos.pageno>=0)
    {
        PDFVPage *vpage = [m_view vGetPage:pos.pageno];
        PDFPage *page = [vpage GetPage];
        
        PDF_RECT rect;
        
        rect.bottom = 300;
        rect.left = x;
        rect.right = y;
        rect.top = 100;
        
        if( page != NULL )
        {
            CGImageRef ref = [image CGImage];
            PDFMatrix *mat = [vpage CreateInvertMatrix:self.contentOffset.x * m_scale :self.contentOffset.y * m_scale];
            BOOL result = [page addAnnotBitmap0:mat :ref :YES :&rect];
            //BOOL result = Page_addAnnotBitmap(mat.handle, mat.handle, ref, 1, &rect);
            Matrix_destroy(mat.handle);
            [m_view vRenderSync:pos.pageno];
            [m_doc save];
            [self refresh];
        }
    }

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

Powered by Kunena Forum