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!
loadFromString results in 401 error |
Post Reply |
Author | |
MrPopup
Team Player Joined: 19 Dec 05 Location: New Zealand Status: Offline Points: 32 |
Post Options
Thanks(0)
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.
|
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
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 |
|
MrPopup
Team Player Joined: 19 Dec 05 Location: New Zealand Status: Offline Points: 32 |
Post Options
Thanks(0)
|
ftp site
219.89.207.2 US: quickpdf PW pdf1004 Thank you. |
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
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 |
|
MrPopup
Team Player Joined: 19 Dec 05 Location: New Zealand Status: Offline Points: 32 |
Post Options
Thanks(0)
|
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
|
|
MrPopup
Team Player Joined: 19 Dec 05 Location: New Zealand Status: Offline Points: 32 |
Post Options
Thanks(0)
|
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.
|
|
AndrewC
Moderator Group Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
Post Options
Thanks(0)
|
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; } } |
|
MrPopup
Team Player Joined: 19 Dec 05 Location: New Zealand Status: Offline Points: 32 |
Post Options
Thanks(0)
|
Thank you Andrew. I am not sure how I would use this, but appreciate the effort.
|
|
AndrewC
Moderator Group Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
Post Options
Thanks(0)
|
Mr Popup, Andrew.
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store