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 - Problem with LoadFromString in 7.12 (DLL Version)
  FAQ FAQ  Forum Search   Register Register  Login Login

Problem with LoadFromString in 7.12 (DLL Version)

 Post Reply Post Reply
Author
Message
Jim Sullivan View Drop Down
Team Player
Team Player


Joined: 10 Nov 05
Location: United States
Status: Offline
Points: 36
Post Options Post Options   Thanks (0) Thanks(0)   Quote Jim Sullivan Quote  Post ReplyReply Direct Link To This Post Topic: Problem with LoadFromString in 7.12 (DLL Version)
    Posted: 13 Apr 09 at 11:15AM
I'm having a problem with LoadFromString when using the DLL version of 7.12.  The old version 5 LoadFromString and SaveToString returned a string.  This was problematic because of binary data such as images.
 
The new version returns a byte array.  Which is great for me since I was converting the string to a byte array anyway.  So the following code works just fine in my ASP.NET application:
 

Dim buffer As Byte()

Dim DataToRead As Int32

Dim pr As New QuickPDFDLL0712.PDFLibrary("C:\Quick PDF Library 7.12\DLL\QuickPDFDLL0712.dll")

Dim encoding As New System.Text.ASCIIEncoding

pr.UnlockKey("mykey")

pr.SelectImage(pr.AddImageFromFile("C:\Files\Images\image.GIF", 0))

pr.DrawImage(100, 100, 20, 30)

pr.DrawText(150, 500, "With image")

buffer = pr.SaveToString

Response.Expires = 0

Response.Buffer = True

Response.ClearHeaders()

Response.ContentType = "application/pdf"

Response.Expires = -1

DataToRead = buffer.Length

Response.Flush()

Response.OutputStream.Write(buffer, 0, DataToRead)

Response.Flush()

Response.End()

 
However, the following code does not work:
 

Dim buffer As Byte()

Dim DataToRead As Int32

Dim pr As New QuickPDFDLL0712.PDFLibrary("C:\Quick PDF Library 7.12\DLL\QuickPDFDLL0712.dll")

Dim encoding As New System.Text.ASCIIEncoding

pr.UnlockKey("mykey")

pr.SelectImage(pr.AddImageFromFile("C:\Files\Images\image.GIF", 0))

pr.DrawImage(100, 100, 20, 30)

pr.DrawText(150, 500, "With image")

Dim holderbuffer As Byte()

holderbuffer = pr.SaveToString

Dim abc As New QuickPDFDLL0712.PDFLibrary("C:\Quick PDF Library 7.12\DLL\QuickPDFDLL0712.dll")

abc.UnlockKey("mykey")

MsgBox(abc.LoadFromString(holderbuffer))

abc.DrawText(200, 600, "New from string")

buffer = abc.SaveToString

Response.Expires = 0

Response.Buffer = True

Response.ClearHeaders()

Response.ContentType = "application/pdf"

Response.Expires = -1

DataToRead = buffer.Length

Response.Flush()

Response.OutputStream.Write(buffer, 0, DataToRead)

Response.Flush()

Response.End()

 
The msgbox returns a 0 for LoadFromString.  This only happens for me if I put an image in the PDF.  Without an image the function works fine.  Since I'm getting a PDF in the first case, I assume that SaveToString works fine, but it's LoadFromString that's choking on the image.


Edited by Jim Sullivan - 13 Apr 09 at 11:17AM
Back to Top
Rowan View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 10 Jan 09
Status: Offline
Points: 398
Post Options Post Options   Thanks (0) Thanks(0)   Quote Rowan Quote  Post ReplyReply Direct Link To This Post Posted: 23 Jul 09 at 6:49AM
Hi Jim,

Are you still using the 7.12 C# wrapper? If so, then we think that's the problem. There was a bug with the 7.12 C# wrapper when loading binary data (LoadFromString, AddImageFromString, etc) which has now been fixed. If you use the 7.14 DLL and 7.14 wrapper then it should work properly.

You can download the latest version from the updates page.

You can compare the code in the QuickPDFDLL0712.cs and QuickPDFDLL0714.cs files to see the difference. In 7.14 it allocates a pinned block of memory to send the binary data to Quick PDF Library.

Does this solve the problem on your end?

Cheers,
- Rowan.
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