Microsoft Windows Phone 8.1 support ends (13 Jul 2017)

Microsoft has ended support for Windows Phone 8.1

Questions about iOS development and PDF

How add UIimage

More
IP: 192.168.0.149 12 years 4 months ago - 12 years 4 months ago #4370 by emanuele
Replied by emanuele on topic How add UIimage
Hi,

to add an image, you have to follow this steps:
  • set Document cache properly in PDFOpen method:

    NSString *cachesPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
    cachesPath = [cachesPath stringByAppendingPathComponent:@"file.dat"];
    bool ret1 = Document_setCache(m_doc, [cachesPath UTF8String]);
  • add the image like others Annot, for example:
    - (void)vAddImage
    {
    struct PDFV_POS pos;
    [m_view vGetPos:&pos:x:y];
    if(pos.pageno>=0)
    {
    PDFVPage *vpage = [m_view vGetPage:pos.pageno];
    PDF_PAGE page = [vpage GetPage];

    PDF_RECT rect;

    rect.bottom = 300;
    rect.left = 100;
    rect.right = 300;
    rect.top = 100;

    if( page != NULL )
    {
    CGImageRef ref = [[UIImage imageNamed:@"italy.png"] CGImage];
    PDF_MATRIX mat = [vpage CreateMatrix];
    BOOL result = Page_addAnnotBitmap(page, mat, ref, 1, &rect);
    Matrix_destroy(mat);
    [m_view vRenderPage:pos.pageno];
    Document_save(m_doc);
    [self refresh];
    }
    }
    }
Last edit: 12 years 4 months ago by CBA.
Time to create page: 0.336 seconds
Powered by Kunena Forum