- Posts: 49
- Thank you received: 0
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
addAnnotBitmap doesn't work in 2.2.0
IP: 192.168.0.71
11 years 10 months ago #6370
by Rossi
addAnnotBitmap doesn't work in 2.2.0 was created by Rossi
I tied to add an image to pdfview. I implemente the method
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?
Code:
- (BOOL)addAnnotBitmap:(PDF_MATRIX)matrix :(CGImageRef)bitmap :(BOOL)has_alpha :(const PDF_RECT *)rect {
return Page_addAnnotBitmap(m_page, matrix, bitmap, has_alpha, rect);
}
It is a bug or I did something wrong?
IP: 192.168.0.158
11 years 10 months ago #6371
by nermeen
Replied by nermeen on topic addAnnotBitmap doesn't work in 2.2.0
Try using the following:
Then you need to rerender the page
Code:
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
IP: 192.168.0.71
11 years 10 months ago #6372
by Rossi
Replied by Rossi on topic addAnnotBitmap doesn't work in 2.2.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?
- 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?
IP: 192.168.0.158
11 years 10 months ago #6373
by nermeen
Replied by nermeen on topic addAnnotBitmap doesn't work in 2.2.0
Sorry that was for android, soon my colleague will send you the ios version
IP: 192.168.0.127
11 years 10 months ago #6374
by emanuele
Replied by emanuele on topic addAnnotBitmap doesn't work in 2.2.0
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
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
IP: 192.168.0.71
11 years 10 months ago #6377
by Rossi
Replied by Rossi on topic addAnnotBitmap doesn't work in 2.2.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.
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.
Time to create page: 0.386 seconds