Page 1 of 1

Converting from PDF to JPEG bad quality

Posted: Thu Jan 22, 2009 9:55 am
by HoldThem
Hi there,

I'm using the GFlax object in my ASP code to convert a PDF file into JPG files. I am finding that the JPEg conversions are a lot worse quality than the original file. My code is as follows:

Code: Select all

    'Sub to chop up PDF file
    sub chopPDF(strPDFLocation, strJPGSaveLocation)
    
        with graphicsCom
            .EpsDpi = 72
            .page = 1
            .LoadBitmap(strPDFLocation)
            
            'Loop through each page in the pdf and save it
            for i = 1 to .NumberOfPages

                .Page = i
                .Saveformat = 1
                .SaveJPEGProgressive = true
                .SaveJPEGQuality = 100  
                .saveBitmap(strJPGSaveLocation & "/" & GetFileName(strPDFLocation) & "_Page" & i & ".jpg")
       
                'Detect width and height
                lngDetectedWidth = .width
                lngDetectedHeight = .height

                'Create the thumbnail               
                .resize THUMB_WIDTH, lngDetectedHeight * (THUMB_WIDTH/lngDetectedWidth)
                .saveBitmap(strJPGSaveLocation & "/thumbnails/" & GetFileName(strPDFLocation) & "_Page" & i & ".jpg")
                
            next                    

        end with 
        
    end sub
An example of the input PDF and output JPG file can be found below:
http://rapidshare.com/files/187557996/PDFJPEG.zip.html

Thanks for any assistance.

Tom

Re: Converting from PDF to JPEG bad quality

Posted: Thu Jan 22, 2009 10:10 am
by xnview
And if you change EpsDPI?

Posted: Thu Jan 22, 2009 10:30 am
by HoldThem
Thanks for the prompt reply.

Setting the epsdpi to 500 seems to bring it out losslessly, I don't have much idea what epsdpi is, what is it's maximum value? And what does it mean?

(Sorry, I really did look for documentation but couldn't find much!)

Thanks for your help

Posted: Thu Jan 22, 2009 12:27 pm
by xnview
HoldThem wrote:Thanks for the prompt reply.

Setting the epsdpi to 500 seems to bring it out losslessly, I don't have much idea what epsdpi is, what is it's maximum value? And what does it mean?
It's the dpi used to load pdf

Posted: Thu Jan 22, 2009 12:29 pm
by HoldThem
Anyway to detect the DPI from the PDF when you load it? And also, if I specify a DPI over the DPI of the pdf, will it create any problems (ie pointless larger file sizes etc)