How to store a single page as binary data?

Question:

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

Answer:

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);

https://www.pdftron.com/api/PDFTronSDK/dotnet/pdftron.PDF.PDFDoc.html#pdftron_PDF_PDFDoc_ImportPages_System_Collections_ArrayList_System_Boolean_