Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - loadFromString results in 401 error
  FAQ FAQ  Forum Search   Register Register  Login Login

loadFromString results in 401 error

 Post Reply Post Reply
Author
Message
MrPopup View Drop Down
Team Player
Team Player
Avatar

Joined: 19 Dec 05
Location: New Zealand
Status: Offline
Points: 32
Post Options Post Options   Thanks (0) Thanks(0)   Quote MrPopup Quote  Post ReplyReply Direct Link To This Post Topic: loadFromString results in 401 error
    Posted: 27 May 14 at 11:04PM
Good morning,

Using DLL version 10.  Have tried both DPLLoadFromString and DPLLOadFromStringA. Same problem.  Jade development environment is being used.  This is the obny call I have had an issue with.

The code is:

vars
qp : PDF;
st : String;
begin
create qp transient; //create and unlock library
qp.loadFromFile("c:\temp\seka.pdf",""); //import existing pdf (4pages)
qp.deletePages(2,qp.pageCount-1); //delete all pages except page 1
qp.selectPage(1); //select page 1
st := qp.saveToString; //get pdf as a string and hold
write st.length; //check length of string
write st; //display string
delete qp; //delete and release library
create qp transient; //create and unlock library
qp.loadFromString(st,""); //load pdf from held string
write qp.lastErrorCode; //display error code
qp.saveToFile("c:\temp\test_save.pdf"); //save new document as a pdf
delete qp; //delete and release library
end;

All calls are successful except the loadFromString call.

Thank you.
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 28 May 14 at 8:27AM
is it okay with another dll-version?
If not: Please upload the pdf anywhere
and post the link - so we can check it.
 
Cheers, Ingo
 
Cheers,
Ingo

Back to Top
MrPopup View Drop Down
Team Player
Team Player
Avatar

Joined: 19 Dec 05
Location: New Zealand
Status: Offline
Points: 32
Post Options Post Options   Thanks (0) Thanks(0)   Quote MrPopup Quote  Post ReplyReply Direct Link To This Post Posted: 29 May 14 at 8:50PM
ftp site
219.89.207.2
US: quickpdf
PW pdf1004

Thank you.

Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 29 May 14 at 9:24PM
I think the problem is before the LoadFromString.
You should check each returning value.
What about the returning value of DeletePages?
It should be the number of the remaining pages.
I don't know Jade... the string content should be Ansi...

Cheers,
Ingo

Back to Top
MrPopup View Drop Down
Team Player
Team Player
Avatar

Joined: 19 Dec 05
Location: New Zealand
Status: Offline
Points: 32
Post Options Post Options   Thanks (0) Thanks(0)   Quote MrPopup Quote  Post ReplyReply Direct Link To This Post Posted: 29 May 14 at 9:47PM
QuickPDF Library Responses
DPLLoadFromFileA response: 1
DPLPageCount response: 4
DPLDeletePages response: 1
DPLPageCount response: 1
DPLSelectPage response: 1
String length: 219
LoadFronStringA response: 0
LastErrorCode response: 401
SaveToFile response: 1
Back to Top
MrPopup View Drop Down
Team Player
Team Player
Avatar

Joined: 19 Dec 05
Location: New Zealand
Status: Offline
Points: 32
Post Options Post Options   Thanks (0) Thanks(0)   Quote MrPopup Quote  Post ReplyReply Direct Link To This Post Posted: 29 May 14 at 10:17PM
I note that the DPLLoadFromStringA construct makes use of both char (ansi) and w_char (unicode) data types.  
No other constructs that I have used mix the two types.
Thanks.
Back to Top
AndrewC View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 08 Dec 10
Location: Geelong, Aust
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post Posted: 30 May 14 at 10:13AM
MrPopup,

Here is the C# wrapper code for LoadFromString and SaveToString ?  It should be helpful with porting it to Jade.  The C# wrapper is calling the DLL also.

Andrew.

        public int LoadFromString(byte[] Source, string Password)
        {
            if (dll == null) return 0;
            else
            {
                GCHandle gch = GCHandle.Alloc(Source, GCHandleType.Pinned);
                IntPtr bufferID = dll.DebenuPDFLibraryCreateBuffer(instanceID, Source.Length);
                dll.DebenuPDFLibraryAddToBuffer(instanceID, bufferID, gch.AddrOfPinnedObject(), Source.Length);
                int result = dll.DebenuPDFLibraryLoadFromString(instanceID, bufferID, Password);
                dll.DebenuPDFLibraryReleaseBuffer(instanceID, bufferID);
                gch.Free();
                return result;
            }
        }

        public byte[] SaveToString()
        {
            if (dll == null) return new byte[0];
            else
            {
                IntPtr data = dll.DebenuPDFLibrarySaveToString(instanceID);
                int size = dll.DebenuPDFLibraryAnsiStringResultLength(instanceID);
                byte[] result = new byte[size];
                Marshal.Copy(data, result, 0, size);
                return result;
            }
        }

Back to Top
MrPopup View Drop Down
Team Player
Team Player
Avatar

Joined: 19 Dec 05
Location: New Zealand
Status: Offline
Points: 32
Post Options Post Options   Thanks (0) Thanks(0)   Quote MrPopup Quote  Post ReplyReply Direct Link To This Post Posted: 31 May 14 at 9:45PM
Thank you Andrew. I am not sure how I would use this, but appreciate the effort.
Back to Top
AndrewC View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 08 Dec 10
Location: Geelong, Aust
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post Posted: 04 Jun 14 at 7:14AM

Mr Popup,

You will need do some research and see how strings and arrays work in Jade.  The code examples show how the C# wrapper loads and saves strings using the DLL calls.

Andrew.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store