How to store a single page as binary data?


How to store a single page as byte[] to store in a database?


Assuming the PDFDoc object contains other pages, then something like the following would isolate that one page and give you back the bytes for it.

// given x is the page you want to store (index starts at one) // given source is PDFDoc containing page x PDFDoc sink = new PDFDoc(); ArrayList importList = new ArrayList(); importList.Add(souce.GetPage(x)); ArrayList imported = sink.ImportPages(importList, importBookmarks); // where importBookmarks is a boolean. Set to true if you care about preserving bookmarks sink.PagePushBack(imported[0] as Page); byte[] pdfPageData = sink.Save(SDFDoc.SaveOptions.e_remove_unused);