For example, one three page scan came out at 4.1mb although, when I resized the document in acrobat, it came down to 501k.
I have looked but cannot find a way to control the compression rate and therby reduce the file size.
Can you help me solve this please?
You have several way to optimize the file size:
- Reducing the bit depth of the scanner image using color reduction function such as ConvertTo1bpp(), Convertto8bppQ()...
- Resizing the image using the ResizeImage() function.
Also, on GdPicture Pro, you can control the JPEG compression rate using the PdfGetJpegQuality() function.
With best regards,
My code is below, have I done something wrong?
Code: Select all
Private Sub Command12_Click() 'Here we will scan in a 24bpp in multiple page pdf file Dim nImageID As Long Dim nCpt As Long Filename2 = "W:\" & RTrim(Text1.Text) & docno & ".pdf" 'Filename3 = "X:\" & RTrim(Left(lineoftext, 10)) & docno & ".pdf" 'Twain1.TwainSelectSource If Twain1.TwainOpenDefaultSource() Then InitScanConfig ' Twain1.CropBorders ' Twain1.SetContrast (20) Twain1.TwainSetCurrentImageFileFormat TWPT_PDF Twain1.TwainSetHideUI (False) Twain1.TwainSetAutoFeed (True) 'Set AutoFeed Enabled Twain1.TwainSetAutoScan (True) 'To achieve the maximum scanning rate Twain1.TwainSetAutoSize (True) Twain1.TwainSetCurrentResolution (120) Twain1.TwainSetCurrentPixelType (TWPT_GRAY) Twain1.TwainSetAutomaticBorderDetection (True) Twain1.TwainSetPaperSize (1) ' Twain1.TwainSetCurrentPixelType (TWPT_RGB) 'RGB Twain1.TwainSetCurrentBitDepth (1) ' 24 bpp Twain1.TwainPdfStart (Filename2) Twain1.ConvertTo1Bpp Do nImageID = Twain1.TwainAcquireToGdPictureImage(Me.hWnd) ' Call ApplyImageFilters(nImageID) ' If chkPreview.Value = 1 Then Call DisplayNativeImage Call Twain1.TwainAddGdPictureImageToPdf(nImageID) Twain1.CloseImage (nImageID) Loop While Twain1.TwainGetState > TWAIN_SOURCE_OPEN Twain1.TwainPdfStop Call Twain1.TwainCloseSource ' MsgBox "Done !" ' Dim fso ' Set fso = CreateObject("Scripting.FileSystemObject") ' fso.COPYFILE Filename2, Filename3, True Else MsgBox "can't open default source, twain state is: " & Trim(Str(Twain1.TwainGetState)) End If End Sub
I have tried with PdfSetJpegquality (25) also 50 and 75 and 100 but the file size does not change.
I have tride that line in several different places but still no change.
I am sure that I am doing something wrong but cannot find what.
Can you help please?
Code: Select all
'Twain1.TwainSelectSource If twain1.TwainOpenDefaultSource() Then InitScanConfig ' Twain1.CropBorders ' Twain1.SetContrast (20) twain1.TwainSetCurrentImageFileFormat TWPT_PDF twain1.TwainSetHideUI (False) twain1.TwainSetAutoFeed (True) 'Set AutoFeed Enabled twain1.TwainSetAutoScan (True) 'To achieve the maximum scanning rate twain1.TwainSetAutoSize (True) twain1.TwainSetCurrentResolution (120) twain1.TwainSetCurrentPixelType (TWPT_GRAY) twain1.TwainSetAutomaticBorderDetection (True) twain1.TwainSetPaperSize (1) ' Twain1.TwainSetCurrentPixelType (TWPT_RGB) 'RGB twain1.TwainSetCurrentBitDepth (4) ' 24 bpp twain1.PdfSetJpegQuality (50) twain1.TwainPdfStart (Filename2) Do nImageID = twain1.TwainAcquireToGdPictureImage(Me.hWnd) ' twain1.ConvertTo4Bpp ' Call ApplyImageFilters(nImageID) ' If chkPreview.Value = 1 Then Call DisplayNativeImage Call twain1.TwainAddGdPictureImageToPdf(nImageID) twain1.CloseImage (nImageID) Loop While twain1.TwainGetState > TWAIN_SOURCE_OPEN twain1.TwainPdfStop Call twain1.TwainCloseSource ' MsgBox "Done !" ' Dim fso ' Set fso = CreateObject("Scripting.FileSystemObject") ' fso.COPYFILE Filename2, Filename3, True Else MsgBox "can't open default source, twain state is: " & Trim(Str(twain1.TwainGetState)) End If
It works fine apart from the file size which varies depending what scanner I am using.
On three particular machines the file is about 4.5mb and I have tried reducing to 4 bpp without it making a significant difference.
I then tried gdpicturepro so that I could use the PdfSetJpegQuality method but I cannot get that to make a difference either!!
I realise it must be me but I have tried moving the commands etc but with no success.
Any ideas would be appreciated.
im an encvountering the same problem. Besides this issue the ActiveX works fine for me.
Bought only the standard version of gdTwain, because i thought picture compression would be pdf standard. But it seems not to be...
In my case an uncompressed pdf is especially tragic, because the company I'm developing for sometimes uses veeery slow WAN lines (in one case only 512 kbit/s !!!!).
They insist on pdfs so scanning and storing as jpg is no option.
Do you have an suggestions?
* is there any possibilty with the standard version to solve the problem?
* is it possible to upgrade to the gdTwain PRO on a special price?
* is there any (cheap) external tool to compress the picture in the pdf after the creation?
Thanks in advance,
You are wrong, we use compression for any kind of image embed in PDF.i thought picture compression would be pdf standard. But it seems not to be...
I suggest you to download the latest version available on our website.
Then, if you consider your PDF as "not compressed enough" you can send us a copy of the file to esupport (at) gdpicture (dot) com to investigate on your problem.
thanks for all the help.
After my tests on different PCs in my environment (it worked correctly on all machines) I did the Installation of the latest version of the ocx at my customers site by myself - and now it works fine.
Seems they didn't install the software properly...
Who is online
Users browsing this forum: No registered users and 1 guest