'''' This code is part of Document Solutions for PDF .NET demos.'' Copyright (c) MESCIUS inc. All rights reserved.''ImportsSystem.IOImportsGrapeCity.Documents.Pdf '' This example shows how to load a password protected PDF without specifying the password,'' and change (reverse) the order of the pages in the PDF.'' The modified PDF is saved and re-opened with the password so that we can show it in the demo.PublicClassNoPassReversePagesPublicFunctionCreatePDF(ByVal stream AsStream) AsIntegerUsing fsSrc = File.OpenRead(Path.Combine("Resources", "PDFs", "Wetlands-password-user.pdf"))'' Set up DecryptionOptions to allow loading password protected PDFs without password:Dim dopt = NewDecryptionOptions() With {.ThrowExceptionIfInvalidPassword = False}Dim docSrc = NewGcPdfDocument() docSrc.Load(fsSrc, dopt) '' Reverse the page order:For i = 0To docSrc.Pages.Count \ 2 - 1 docSrc.Pages.Swap(i, docSrc.Pages.Count - 1 - i)Next '' Demo site specific:' We save the modified password protected document to a temp file,' and load it again with the password, so that the demo site can show it' without asking the user for a password:Dim fn = Path.GetTempFileName() docSrc.Save(fn)Dim doc = NewGcPdfDocument()Using fs = File.OpenRead(fn) doc.Load(fs, "user") doc.Save(stream)EndUsingFile.Delete(fn)'' Done:Return docSrc.Pages.CountEndUsingEndFunctionEndClass