InsertPagesFromDoc function fails when source document is re

PDF-XChange Editor SDK for Developers

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.
Post Reply
docu-track99
User
Posts: 518
Joined: Thu Dec 06, 2007 8:13 pm

InsertPagesFromDoc function fails when source document is re

Post by docu-track99 »

Hi Tracker,

This is urgent as it was found by a large beta user just before our release which is scheduled for tomorrow.
The final line in the code below throws an exception if the source document (oCurrentDoc) has its read-only flag set.

Any suggestions as to what I can do to resolve this problem?


Dim sFilesToInboxPath = m_sDocItTempPath & "\FilesToInbox\"
Dim oCurrentDoc = frmMain.pdfCtrl.Doc.CoreDoc
Dim oNewDoc = frmMain.pdfCtrl.Inst.NewCoreDoc()
Dim nStart As Integer = Val(txtStart.Text)
Dim nEnd As Integer = Val(txtEnd.Text)
Dim sCurrentDocName = oCurrentDoc.SrcInfo.ActualFileName
Dim sNewDocName As String = IO.Path.GetFileNameWithoutExtension(sCurrentDocName) & " (Pages " & nStart & " " & Lang.Text_FL.To_FL() & " " & nEnd & ")" & IO.Path.GetExtension(sCurrentDocName)
Dim nOptions As Integer = CalculateFlags()

If rbAll.Checked Then
sNewDocName = IO.Path.GetFileNameWithoutExtension(sCurrentDocName) & IO.Path.GetExtension(sCurrentDocName)
End If

oNewDoc.Pages.InsertPagesFromDoc(oCurrentDoc, 0, nStart - 1, nEnd - nStart + 1, nOptions)

Thanks,

Mike Bell
User avatar
Vasyl-Tracker Dev Team
Site Admin
Posts: 2353
Joined: Thu Jun 30, 2005 4:11 pm
Location: Canada

Re: InsertPagesFromDoc function fails when source document i

Post by Vasyl-Tracker Dev Team »

Hi Mike.
... if the source document (oCurrentDoc) has its read-only flag set.
What do you mean for "read-only"? The source file on the disk has read-only attribute or what?
Vasyl Yaremyn
Tracker Software Products
Project Developer

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
docu-track99
User
Posts: 518
Joined: Thu Dec 06, 2007 8:13 pm

Re: InsertPagesFromDoc function fails when source document i

Post by docu-track99 »

We get an error if:
1. The read-only attribute of the file on the disk is set to true.
or
2. The pdf is launched from an Outlook attachment.
User avatar
Vasyl-Tracker Dev Team
Site Admin
Posts: 2353
Joined: Thu Jun 30, 2005 4:11 pm
Location: Canada

Re: InsertPagesFromDoc function fails when source document i

Post by Vasyl-Tracker Dev Team »

I just tried to reproduce it with our EU-Editor. For that I created new blank document and inserted to it the pages from document with read-only attribute on its source-file.
All works ok.. Can you reproduce your problem with our EU-Editor?
Vasyl Yaremyn
Tracker Software Products
Project Developer

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
docu-track99
User
Posts: 518
Joined: Thu Dec 06, 2007 8:13 pm

Re: InsertPagesFromDoc function fails when source document i

Post by docu-track99 »

Hi Vasyl,

We are not using, and do not have the EU Editor. We are using your most recent Editor SDK.

The exact code I used that caused the exception is listed in my first post.

I have attached a zip file that contains an image that shows the exception that is being thrown.

Mike
Attachments
Error.zip
(116.17 KiB) Downloaded 98 times
User avatar
Vasyl-Tracker Dev Team
Site Admin
Posts: 2353
Joined: Thu Jun 30, 2005 4:11 pm
Location: Canada

Re: InsertPagesFromDoc function fails when source document i

Post by Vasyl-Tracker Dev Team »

We still cannot reproduce it.
The error code from your last error-screenshot means "Operation not permitted".
Looks like that source document has security settings(password security or digital signature) that denies you to copy pages from it.
So, looks like that issue is document-related. To confirm/discard such explanation - please just try to insert pages from simple blank document(create it before and save to the disk) which source file has read-only attribute.
Vasyl Yaremyn
Tracker Software Products
Project Developer

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Post Reply