When I set the security.encryption on a pdf document, regardless of what PdfPermissionFlags I use, the setting "Page Extraction" is set to "not allowed".
How can I enabled Page extraction in my output PDF files?
Here's the code I'm using to merge files;
- Code: Select all
Private Shared Sub MergeFiles(filename As String, files As String(), pw As String, encryption As PDFEncryptionLevel, info As PDFDocInfo)
Try
Using doc As PdfDocumentBase = PdfDocument.MergeFiles(files)
Try
'// Set the doc properties
Dim Keywords As New List(Of String)
For Each file In files
Keywords.Add(Path.GetFileNameWithoutExtension(file))
Next
doc.DocumentInformation.Keywords = String.Join(", ", Keywords)
doc.FileStructure.Version = PdfVersion.Version1_7
If Not IsNothing(info) Then
doc.DocumentInformation.Title = info.Title
doc.DocumentInformation.Author = info.Author
doc.DocumentInformation.Creator = info.Creator
doc.DocumentInformation.Producer = info.Producer
End If
If Not String.IsNullOrWhiteSpace(pw) Then
Dim permissions = PdfPermissionsFlags.Print Or PdfPermissionsFlags.EditContent Or
PdfPermissionsFlags.CopyContent Or PdfPermissionsFlags.EditAnnotations Or
PdfPermissionsFlags.FillFields Or PdfPermissionsFlags.AccessibilityCopyContent Or
PdfPermissionsFlags.AssembleDocument Or PdfPermissionsFlags.FullQualityPrint
'// all permissions
Select Case encryption
Case PDFEncryptionLevel.None
'// None...
Case PDFEncryptionLevel.Key128
doc.Security.Encrypt(pw, OwnerPW, permissions, PdfEncryptionKeySize.Key128Bit)
Case PDFEncryptionLevel.Key256
doc.Security.Encrypt(pw, OwnerPW, permissions, PdfEncryptionKeySize.Key256Bit)
Case Else
Throw New NotImplementedException("Unknown PDFEncryptionLevel")
End Select
End If
Try
'// doc.Conformance = PdfConformanceLevel.Pdf_A1A
doc.Save(filename, FileFormat.PDF)
doc.Close()
Catch ex As Exception
Throw
End Try
Catch ex As Exception
Throw
End Try
End Using
Catch ex As Exception
Throw
End Try
End Sub