Monotouch open pdf on device?

I need to open a pdf file from my package in a monotouch application. I do not know if this is going out of the way or not, but I cannot open this pdf. Can someone give me an example of how to open a pdf file? I am using the pdftron library.

+4
source share
2 answers

First, make sure your file is marked as Content in the Build Action of MonoDevelop. This will ensure that it is copied inside your application package.

Then from your application you can get your application pool using the following property:

 NSBundle.MainBundle.BundlePath 

From this, you can try checking your file, for example.

 if (File.Exists (Path.Combine (NSBundle.MainBundle.BundlePath, "myfile.pdf")) { Console.WriteLine ("got it"); } else { Console.WriteLine ("can't find it"); } 

Once you find the correct path to the file, you can provide it in your PDF library.

+6
source

PDFtron does not have .net bindings as far as I know.

iOS has built-in PDF reading capabilities, and Xamarin itself provides a sample for you. I recently encoded a PDF reader using this sample.

https://github.com/xamarin/monotouch-samples/tree/master/ZoomingPdfViewer

+1
source

All Articles