Hi,
This is an urgent matter for us as a client needs to lock down their software for tax season.
For merging PDFs we have switched from the old Tracker tools library to the new Tracker Editor Core. We have found that the new Core functionality is superior in almost every case.
Our issue with the new core is if a file to be merged in has encryption in it. (Not open document security, but security to edit, etc.)
In our old way of merging using the tool Library we would do something like example A below.
In our new way of doing it (Example B), we can’t figure out how to unencrypt the document before merging.
The Op.Do method is throwing an error: “Insert Pages Document: <Full path to PDF> is protected. You have no permissions to use it for this operation. Ignore Ignore All Abort.”
The attached file works in the old method but not in the new. We had switched to the new method because it is much more successful in working with large files.
Example A:
If nDocCount >= 1 Then
oDocITPDFOutput = New PDFClasses.cDocITPDFExisting
For nIdx = 0 To nDocCount - 1
frmMain.AddLogEntry(" Merging " & System.IO.Path.GetFileName(sPdfPaths(nIdx)))
If bFirstFile Then
With oDocITPDFOutput
.LoadFromFile(sPdfPaths(nIdx))
nDocPages = .PageCount
If .Encrypted Then
nRet = .Unencrypt
End If
nOutline = oDocITPDFOutput.GetFirstOutline()
bFirstFile = False
End With
Else
oDocITPDFInput = New PDFClasses.cDocITPDFExisting
With oDocITPDFInput
.LoadFromFile(sPdfPaths(nIdx))
nMergeDocID = .SelectedDocument
nDocPages = .PageCount
If .Encrypted Then
nRet = .Unencrypt
End If
nOutline = oDocITPDFInput.GetFirstOutline()
nRet = oDocITPDFOutput.MergeDocument(nMergeDocID, -1)
End With
oDocITPDFInput.ClosePDF()
oDocITPDFInput = Nothing
End If
Example B:
Dim m_Inst As PDFXEdit.PXV_Inst = Nothing
m_Inst = New PDFXEdit.PXV_Inst()
m_Inst.Init(Nothing, "licence key”)
Dim fsInst As PDFXEdit.IAFS_Inst = CType(m_Inst.GetExtension("AFS"), PDFXEdit.IAFS_Inst)
Dim nID As Integer = m_Inst.Str2ID("op.combineDocs", False)
Dim Op As PDFXEdit.IOperation = m_Inst.CreateOp(nID)
'This operation has quite a unique input that uses IOpInputItem
Dim input As PDFXEdit.ICabNode = Op.Params.Root("Input")
Dim destPath As PDFXEdit.IAFS_Name
Dim inpItem As PDFXEdit.IOpInputItem
For nIdx = 1 To nDocCount
frmMain.AddLogEntry(" Adding " & System.IO.Path.GetFileName(sPdfPaths(nIdx)) & " to list of files to merge.")
destPath = fsInst.DefaultFileSys.StringToName(sPdfPaths(nIdx))
inpItem = Op.CreateInputItem(destPath)
inpItem.Params.Root("PagesRange.Type").v = "All"
input.Add().v = inpItem
Next
Dim options As PDFXEdit.ICabNode = Op.Params.Root("Options")
options("AddRootBookmarks").v = False
'Perform actual merge.
frmMain.AddLogEntry(" Merging beginning")
Op.Do()
'Getting resulting document
Dim resDoc As PDFXEdit.IPXC_Document = DirectCast(Op.Params.Root("Output").v, PDFXEdit.IPXC_Document)
.
.
.
[attachment=0]Security Info.png[/attachment]
How to unencrypt a document before merging?
Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan
Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.
When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.
When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
-
- User
- Posts: 518
- Joined: Thu Dec 06, 2007 8:13 pm
How to unencrypt a document before merging?
- Attachments
-
- secured.pdf
- (31.27 KiB) Downloaded 94 times
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: How to unencrypt a document before merging?
Hello docu-track99,
The way to specify the documents' passwords is to open them before passing to the operation. Then if the password is correct, the operation will use the opened document and won't ask for the password. I think this should work if I understood you correctly.
Cheers,
Alex
The way to specify the documents' passwords is to open them before passing to the operation. Then if the password is correct, the operation will use the opened document and won't ask for the password. I think this should work if I understood you correctly.
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
-
- User
- Posts: 518
- Joined: Thu Dec 06, 2007 8:13 pm
Re: How to unencrypt a document before merging?
Hi Alex,
There is not a password required to open this document, but rather to perform operations on the document
In our old method we were not supplying the password but could do an unecrypt on the in memory object without it. (As shown in example A.)
Example B came originally from Tracker, but do not know how to do this opening an unecryption with the new API and example B.
Could you suggest sample code that we could try? Keep in mind that this is a merge operation that is being performed and we are not loading any of the files into the editor.
There is not a password required to open this document, but rather to perform operations on the document
In our old method we were not supplying the password but could do an unecrypt on the in memory object without it. (As shown in example A.)
Example B came originally from Tracker, but do not know how to do this opening an unecryption with the new API and example B.
Could you suggest sample code that we could try? Keep in mind that this is a merge operation that is being performed and we are not loading any of the files into the editor.
-
- User
- Posts: 518
- Joined: Thu Dec 06, 2007 8:13 pm
Re: How to unencrypt a document before merging?
We would like to emphasize the urgency of this.
With the old Tracker Tools SDK you can merge two files without providing a password. (The file has an operations level password, but not an open password.) With the new editor library we can not figure out how to do this.
Note that if you use the pdf file that we attached earlier today and try and merge it with another PDF in your new tracker editor, it throws an error.
Please get back to us as soon as possible so we can implement a solution or work around.
With the old Tracker Tools SDK you can merge two files without providing a password. (The file has an operations level password, but not an open password.) With the new editor library we can not figure out how to do this.
Note that if you use the pdf file that we attached earlier today and try and merge it with another PDF in your new tracker editor, it throws an error.
Please get back to us as soon as possible so we can implement a solution or work around.
- Lzcat - Tracker Supp
- Site Admin
- Posts: 677
- Joined: Thu Jun 28, 2007 8:42 am
Re: How to unencrypt a document before merging?
Hi docu-track99.
There was a bug in old SDK which will allow you to do everything you want even your password does not grant needed permissions, and you have successfully used it. We fixed this in new SDK, and all we can offer at the moment is a way to ask for owner (change permissions) password.
To do this you will need to call IPXC_Document::RequestPermission(Perm_ObjDoc, Perm_OperSecure, null, status) to check if you have needed permissions, and if not - call IPXC_Document::AcquireOwnerPermissions.
HTH.
There was a bug in old SDK which will allow you to do everything you want even your password does not grant needed permissions, and you have successfully used it. We fixed this in new SDK, and all we can offer at the moment is a way to ask for owner (change permissions) password.
To do this you will need to call IPXC_Document::RequestPermission(Perm_ObjDoc, Perm_OperSecure, null, status) to check if you have needed permissions, and if not - call IPXC_Document::AcquireOwnerPermissions.
HTH.
Victor
Tracker Software
Project manager
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Tracker Software
Project manager
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.