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 - Extract image
  FAQ FAQ  Forum Search   Register Register  Login Login

Extract image

 Post Reply Post Reply
Author
Message
Quicker View Drop Down
Beginner
Beginner


Joined: 27 Apr 06
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote Quicker Quote  Post ReplyReply Direct Link To This Post Topic: Extract image
    Posted: 29 Apr 06 at 5:08AM

How do I extract images from a certain page of PDF?

Many thanks.

Back to Top
swb1 View Drop Down
Debenu Quick PDF Library Expert
Debenu Quick PDF Library Expert
Avatar

Joined: 05 Dec 05
Location: United States
Status: Offline
Points: 100
Post Options Post Options   Thanks (0) Thanks(0)   Quote swb1 Quote  Post ReplyReply Direct Link To This Post Posted: 30 Apr 06 at 12:06PM

An Example to extract images can be found here:

http://www.quickpdf.org/forum/forum_posts.asp?TID=376&KW=swb1

Back to Top
Quicker View Drop Down
Beginner
Beginner


Joined: 27 Apr 06
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote Quicker Quote  Post ReplyReply Direct Link To This Post Posted: 30 Apr 06 at 12:48PM

Steve, thank you.

Sorry, your example isn't what I was looking for.

I need to extract the image from the 5th page of PDF (for example). It is possible?

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: 30 Apr 06 at 1:11PM
Hi Quicker!

Steves' example is what you need. You only have to lay a loop "page by page" around it. You can separate each page and then analyze each page with Steves' code.

Best regards,
Ingo
Back to Top
Quicker View Drop Down
Beginner
Beginner


Joined: 27 Apr 06
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote Quicker Quote  Post ReplyReply Direct Link To This Post Posted: 02 May 06 at 3:16PM

Originally posted by Ingo Ingo wrote:

Hi Quicker!

Steves' example is what you need. You only have to lay a loop "page by page" around it. You can separate each page and then analyze each page with Steves' code.

Sorry, how can I separate each page?

Please give me the example.

Back to Top
swb1 View Drop Down
Debenu Quick PDF Library Expert
Debenu Quick PDF Library Expert
Avatar

Joined: 05 Dec 05
Location: United States
Status: Offline
Points: 100
Post Options Post Options   Thanks (0) Thanks(0)   Quote swb1 Quote  Post ReplyReply Direct Link To This Post Posted: 02 May 06 at 4:15PM

Quicker,

 

The problem is that an image is not necessarily “on” a given page. Images are part of the document and typically only a reference to an image is on a given page. This allows the PDF to be more efficient in the storage and display of images, particularly when they are redundant, for example: a company logo on a multiple page invoice.

 

The direct solution to this may be somewhat complicated. You would need to get a list of images and their references and then using GetPageContent you would cross reference the list of image references on the page. This is definitely advance topic and would require pretty good understanding of the PDF specification. I think a function of this sort would make a nice addition to the library but I don’t think that a simple way of doing this exists in the library today.

 

The indirect solution is to separate each page from the document, using ExtractPages, and then, as separate documents, use the code that I supplied. This is not very efficient and will require time and I/O however it should work.

 

An example to extract pages goes something like this:

 

procedure TForm1.btnExtractPagesClick(Sender: TObject);

var PageIndex : integer;

      FirstName : string;

      NewDocID : integer;

begin

      qPDF := TiSEDQuickPDF.Create;

      qPDF.UnlockKey(MY_QDPF_KEY);

      if OpenDialog1.Execute then

            begin

            qPDF.LoadFromFile( OpenDialog1.FileName );

            FirstName := copy(OpenDialog1.FileName,1,pos('.pdf',lowercase(OpenDialog1.FileName)));

            for PageIndex := 1 to qPDF.PageCount do

                  begin

                  qPDF.ExtractPages(PageIndex,1);

                  NewDocID := qPDF.SelectedDocument;

                  qPDF.SaveToFile(FirstName + IntToStr(PageIndex) + '.pdf' );

                  qPDF.RemoveDocument(NewDocID);

                  end

            end;

      qPdf.Free;

end;

 

 

sb

 

 

 

Back to Top
Quicker View Drop Down
Beginner
Beginner


Joined: 27 Apr 06
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote Quicker Quote  Post ReplyReply Direct Link To This Post Posted: 16 May 06 at 5:17AM

Sorry, I don't understand isedQuickPDF's rules well.

How many PDF files (or DocID) can it hold?

Is this correct:

  qPDF := TiSEDQuickPDF.Create;
  qPDF.UnlockKey(MY_QDPF_KEY);
  if OpenDialog1.Execute then
  begin
    qPDF.LoadFromFile(OpenDialog1.FileName);
    FirstName := Copy(OpenDialog1.FileName, 1, pos('.pdf', LowerCase(OpenDialog1.FileName)));
    for PageIndex := 1 to qPDF.PageCount do
    begin
      qPDF.ExtractPages(PageIndex, 1);
      NewDocID := qPDF.SelectedDocument;
      NumImages := qPDF.FindImages;
      if NumImages > 0 then
        for J := 1 to NumImages do
          qPDF.SaveImageToFile(FirstName + IntToStr(PageIndex) + IntToStr(J) + '.jpg');
      qPDF.RemoveDocument(NewDocID);
    end;
  end;

  qPdf.Free;

Back to Top
swb1 View Drop Down
Debenu Quick PDF Library Expert
Debenu Quick PDF Library Expert
Avatar

Joined: 05 Dec 05
Location: United States
Status: Offline
Points: 100
Post Options Post Options   Thanks (0) Thanks(0)   Quote swb1 Quote  Post ReplyReply Direct Link To This Post Posted: 16 May 06 at 1:16PM

Quicker,

  

I suspect that for practical purposes the document capacity of a TiSEDQuickPDF object is unlimited. Memory and processing time are probably the only factors you will need to be concerned with.

 

As far as your code is concerned; my understanding of how QuickPDF works is largely due to trial and error. Your code looks like it ought to work. Try it. If it works - how wrong can it be? If it does not work you may want to try separating the split page and extract images functions into different operations.

 

sb

 

Back to Top
Quicker View Drop Down
Beginner
Beginner


Joined: 27 Apr 06
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote Quicker Quote  Post ReplyReply Direct Link To This Post Posted: 18 May 06 at 5:28AM
Steve, am I right thinking that when I call qPDF.RemoveDocument(NewDocID), I release the memory?
Back to Top
swb1 View Drop Down
Debenu Quick PDF Library Expert
Debenu Quick PDF Library Expert
Avatar

Joined: 05 Dec 05
Location: United States
Status: Offline
Points: 100
Post Options Post Options   Thanks (0) Thanks(0)   Quote swb1 Quote  Post ReplyReply Direct Link To This Post Posted: 18 May 06 at 12:20PM

Yes. That I think that is a safe assumption. I have not inspected this code carefully however it appears to be doing the right thing as far cleaning up after itself.

 

sb

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. About — Contact — Blog — Support — Online Store