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 - PageCount not working
  FAQ FAQ  Forum Search   Register Register  Login Login

PageCount not working

 Post Reply Post Reply
Author
Message
pmaltais View Drop Down
Beginner
Beginner
Avatar

Joined: 14 Dec 10
Location: 404
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote pmaltais Quote  Post ReplyReply Direct Link To This Post Topic: PageCount not working
    Posted: 14 Dec 10 at 8:00PM
Hi,

I load PDF documents wich contain more than one page. PageCount always returns 1. I'm using LoadFromStream. What am I missing?

Note that further in the code I display the document in a PDF Viewer and the document is perfectly displayed. 

Here is my code listing:

// oDocument is a business object containing the PDF stream and other data related to it...
  try
    sLicence := 'my_reg_key';
    myPDFLibCtrl := TQuickPDF0722.Create();
    if (myPDFLibCtrl.UnlockKey(sLicence) = 1) then
    begin
      myPDFLibCtrl.LoadFromStream(oDocument.fileStream);
      oDocument.numberOfPages := myPDFLibCtrl.PageCount;
      Result := SaveNewDocument(oDocument);
    end
    else
    begin
      ShowMessage('Quick PDF Library: Invalid licence.');
    end;
  finally
    if Assigned(myPDFLibCtrl) then
    begin
      myPDFLibCtrl.Free();
      myPDFLibCtrl := nil;
    end;
  end;



Thanks for your help.

Patrick Maltais, programmer


Edited by Ingo - 15 Dec 10 at 8:05AM
Back to Top
pmaltais View Drop Down
Beginner
Beginner
Avatar

Joined: 14 Dec 10
Location: 404
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote pmaltais Quote  Post ReplyReply Direct Link To This Post Posted: 14 Dec 10 at 8:54PM
I have found the problem. The Stream must be repositionned to its beginning. I added the line

oDocument.fileStream.Seek(0, soFromBeginning);

just before the LoadFromStream call and it works perfectly.

Thanks
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: 15 Dec 10 at 1:00PM
Thanks for sharing. Useful tip.
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