-
Notifications
You must be signed in to change notification settings - Fork 48
868485 sample #65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Sri-hari-haran-g
wants to merge
5
commits into
master
Choose a base branch
from
868485_sample
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
868485 sample #65
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
e72c3b8
868485: Added code sample for troubleshooting in security.
Sri-hari-haran-g 03233ae
868485: Added missing files.
Sri-hari-haran-g 93686cd
868485: Added comment line for the sample.
Sri-hari-haran-g 20fb464
868485: Update the encryption key size.
Sri-hari-haran-g 7c1b8ed
868485: Update proper app name.
Sri-hari-haran-g File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.8.34330.188 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp1", "ConsoleApp1\ConsoleApp1.csproj", "{F791E0B1-C642-4323-80E3-6194633CEFFE}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{F791E0B1-C642-4323-80E3-6194633CEFFE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{F791E0B1-C642-4323-80E3-6194633CEFFE}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{F791E0B1-C642-4323-80E3-6194633CEFFE}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{F791E0B1-C642-4323-80E3-6194633CEFFE}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {F9DF932F-EB48-4DE6-A052-C05C40E70DAF} | ||
EndGlobalSection | ||
EndGlobal |
14 changes: 14 additions & 0 deletions
14
Security/troubleshooting/.NET/ConsoleApp1/ConsoleApp1.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Syncfusion.Pdf.Net.Core" Version="24.1.47" /> | ||
</ItemGroup> | ||
|
||
</Project> |
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using Syncfusion.Pdf.Parsing; | ||
using Syncfusion.Pdf.Security; | ||
using System.Security.Cryptography; | ||
|
||
// Open a FileStream for reading the PDF file. | ||
FileStream fileStream = new FileStream("OwnerPasswordOnly.pdf", FileMode.Open, FileAccess.Read); | ||
// Load the PDF document from the FileStream with the specified owner password. | ||
PdfLoadedDocument loadedDocument = new PdfLoadedDocument(fileStream, "12345"); | ||
// Access the security settings of the loaded PDF document. | ||
PdfSecurity security = loadedDocument.Security; | ||
// Disable incremental update for the file structure. | ||
loadedDocument.FileStructure.IncrementalUpdate = false; | ||
// Set specific permissions for a PDF document. | ||
loadedDocument.Security.Permissions = PdfPermissionsFlags.EditAnnotations | PdfPermissionsFlags.AssembleDocument; | ||
// Set the encryption algorithm to AES for the document security. | ||
security.Algorithm = PdfEncryptionAlgorithm.AES; | ||
// Set the encryption key size to 256 Bit. | ||
security.KeySize = PdfEncryptionKeySize.Key256Bit; | ||
// Create a MemoryStream to store the modified PDF document. | ||
MemoryStream stream = new MemoryStream(); | ||
// Save the modified PDF document to the MemoryStream. | ||
loadedDocument.Save(stream); | ||
// Close the loaded PDF document. | ||
loadedDocument.Close(true); | ||
// Write the contents of the MemoryStream. | ||
File.WriteAllBytes("output.pdf", stream.ToArray()); | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.