tags:

views:

157

answers:

1

Hi

How can I emded a pdf inside my app? Should i just pass the pdfs file url to a web view and let that take care of it or is there a better way/

Cheers

w://

A: 

after snooping about I found this:

CGContext context = UIGraphics.GetCurrentContext();

context.SaveState();

CGPDFDocument pdfDoc = CGPDFDocument.FromUrl(_pdfFileUrl);
if(pdfDoc.Pages >= 1)
{
    CGPDFPage pdfPage = pdfDoc.GetPage(1);  

    context.ScaleCTM(SCALE.Width, SCALE.Height);
    // the PDFRectangle is the media box rect of the page, which is hardcoded
    // for now
    context.TranslateCTM(-this.PDFRectangle.X, -this.PDFRectangle.Height - this.PDFRectangle.Y);

    context.DrawPDFPage(pdfPage);
}

pdfDoc.Dispose();

context.RestoreState();

from here:

http://stackoverflow.com/questions/2289174/monotouch-coregraphics-pdf-memory-issues-with-cgpdfdocument-and-cgpdfpage

Which was a question about memory leakage but answered my q in the process.

w://

cvista