Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.14.36408.4 d17.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Decrypting-encrypted-PDF-document", "Decrypting-encrypted-PDF-document\Decrypting-encrypted-PDF-document.csproj", "{93EFCE7C-2111-4150-AB8D-5E675DADB782}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{93EFCE7C-2111-4150-AB8D-5E675DADB782}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{93EFCE7C-2111-4150-AB8D-5E675DADB782}.Debug|Any CPU.Build.0 = Debug|Any CPU
{93EFCE7C-2111-4150-AB8D-5E675DADB782}.Release|Any CPU.ActiveCfg = Release|Any CPU
{93EFCE7C-2111-4150-AB8D-5E675DADB782}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {ACAC9DFE-C228-4D63-BEB8-B3F16EDEA60F}
EndGlobalSection
EndGlobal
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Decrypting_encrypted_PDF_document</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.Pdf.Net.Core" Version="*" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using Syncfusion.Drawing;
using Syncfusion.Pdf;
using Syncfusion.Pdf.Graphics;
using Syncfusion.Pdf.Parsing;
using Syncfusion.Pdf.Security;

using (FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/Input.pdf"), FileMode.Open, FileAccess.Read))
{
// Load the encrypted PDF document from the input stream
PdfLoadedDocument loadedDocument = new PdfLoadedDocument(inputStream, "syncfusion");

// Set the document permissions to default (removes any restrictions)
loadedDocument.Security.Permissions = PdfPermissionsFlags.Default;

// Clear the owner and user passwords to decrypt the document
loadedDocument.Security.OwnerPassword = string.Empty;
loadedDocument.Security.UserPassword = string.Empty;

using (FileStream outputStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.Write))
{
// Save the decrypted PDF document to the output stream
loadedDocument.Save(outputStream);
}
// Close the loaded PDF document and release resources
loadedDocument.Close(true);
}
Loading