Print Page | Close Window

Problems in extracting Images from PDF

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=1174
Printed Date: 04 Apr 26 at 10:24AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Problems in extracting Images from PDF
Posted By: Ruturaaj
Subject: Problems in extracting Images from PDF
Date Posted: 14 Aug 09 at 5:59AM
Hi All!!

How are you all doing?! I need your help regarding one highlighted feature of QuickPDF library ... "Extracting Images from PDF". I attempted to extract images from PDF file using QuickPDF, but I noticed that it slices some of the images into parts while extracting. I don't know why it happens so. For your testing purpose, I've created a small project; please download it from following URL:

http://www.mediafire.com/file/tjyi3owmnzn/Ruturaaj_ExtractImages.zip - http://www.mediafire.com/file/tjyi3owmnzn/Ruturaaj_ExtractImages.zip

Here is the function that I've written for extracting images:

Private Function ExtractImagesFromPDF(ByVal sPDFFile As String, ByVal sFolderToSave As String) As Long
    Dim iCnt As Integer, lTotal As Long
    Dim lRet As Long
    Dim lImgID As Long, sImgExt As String
   
    Set oPDF = New PDFLibrary
   
    With oPDF
   
        lRet = .LoadFromFile(sPDFFile)
       
        If lRet = 0 Then
            ExtractImagesFromPDF = -1
            Exit Function
        End If
       
        If lRet = 0 Then
            ExtractImagesFromPDF = 0
            Exit Function
        End If
       
        lTotal = 0
       
        lRet = .FindImages
       
        For iCnt = 1 To lRet

            lImgID = .GetImageID(iCnt)

            If .SelectImage(lImgID) = 1 Then
               
                Select Case .ImageType
               
                    Case 1: sImgExt = ".jpg"
                    Case 2: sImgExt = ".bmp"
                    Case 3: sImgExt = ".tiff"
                    Case Else: sImgExt = ".unknown"
                   
                End Select
               
                .SaveImageToFile AddBackSlash(sFolderToSave) & FileNameFromPath(sPDFFile, False) & "_img_" & iCnt & sImgExt
                DoEvents
               
                lTotal = lTotal + 1
               
            End If
           
            DoEvents
           
        Next iCnt
           
        ExtractImagesFromPDF = lTotal
       
    End With
   
End Function


Can you please tell me what additional stuff is needed to add to this function in order to make it to extract images correctly?

Eagerly waiting for your reply ...

Best Regards,

Ruturaaj.




Replies:
Posted By: Ruturaaj
Date Posted: 17 Aug 09 at 8:36PM
I'm really surprised to see no response to this thread! :(
Guys, I need your help to make this thing to work.
Please come forward and share your thoughts on this issue.
Waiting ...


Posted By: Ingo
Date Posted: 17 Aug 09 at 9:31PM
Hi!
 
I think you don't get an answer 'cause there are probs starting your exe (probs with activex-creation...). But anyway...
Where are these sliced images on the pages?
More at the bottom and at the top of the pages... and not in the middle of the pages?
How are they implemented?
I've loaded your test.pdf with adobe reader and clicked on the small image in the middle to select it -> I see ONE frame.
When i click on the bigger iimage at the top of the page it depends on where i'm clicking... i see THREE frames.
So i assume that the big image will be extracted as three parts?
So i assume the creation/insertion of the big image is the problem?
 
Am i write right ;-)
 
Cheers, Ingo
 
 (Edit from Michel: corrected small typo for legibility reasons)


-------------
Cheers,
Ingo




Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk