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?