ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Scan to PDF

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
mdgodfrey Posted - Dec 03 2024 : 17:05:56
Our application scans documents to PDF using Twain drivers. The document size has been good.
Now we are forced to move to WIA drivers and I am having problems getting the documents to a similar size. The WIA documents are at a minimum at least twice as large.
Can you suggest the optimum settings for the WIA driver to get to PDF?

Thanks
5   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Dec 09 2024 : 23:22:09
It sounds like you are using the correct method, but perhaps you should change the compression.

Sorry, I see you mentioned earlier that your documents are scanned in monochrome, so rather than ioPDF_JPEG, please try the monochrome options to see which gives the best compression:
e.g.
ImageEnMView1.MIO.Params[0].PDF_Compression := ioPDF_G4FAX;
ImageEnMView1.MIO.DuplicateCompressionInfo();

Nigel
Xequte Software
www.imageen.com
mdgodfrey Posted - Dec 09 2024 : 16:37:45
After adding the code you suggested to the sample code, the result was that the resulting document was enlarged from 2817K to 42842K.

I added the suggested code (IEGlobalSettings().PDFEngine := ieenDLL) before the sample code I sent previously and then the ieenNative change before the scanned document was saved. But not sure that is how I should have done it as it was scanned and then saved.

I have also been hoping the the demo: \ImageEn\Demos\ImageAcquisition\WIAScanner would help but it doesn't save the selected scanner and only seems to with the first scanner in the list.



xequte Posted - Dec 05 2024 : 16:49:57
Hi

You are probably using PDFium for your saving (ActivePDFEngine = ieenDLL), which does not support compression options:

http://www.imageen.com/help/TIEGlobalSettings.PDFEngine.html

To use compression set:

IEGlobalSettings().PDFEngine := ieenNative;

e.g.

// Load a PDF as a rasterized bitmap (using PDFium), add a watermark, and then save (natively)
IEGlobalSettings().PDFEngine := ieenDLL;
bmp.LoadFromFile( 'D:\document.pdf' );
bmp.Proc.TextOut( Align_Text_Horz_Center, Align_Text_Near_Bottom, 'www.ImageEn.com', 'Arial', 32, clRed, [fsBold] );
IEGlobalSettings().PDFEngine := ieenNative;
bmp.Params.Params.PDF_Compression := ioPDF_JPEG;
bmp.SaveToFile( 'D:\document_WM.pdf' );


Nigel
Xequte Software
www.imageen.com
mdgodfrey Posted - Dec 05 2024 : 15:35:29
Thanks for your reply

By finding code in various places I have created the code below.
This has busy pages being scanned to the size of about 130K.
The issue I have is that PDFCompression has no effect on the size of the PDF.
I was originally applying the Params[0] found at the bottom in for FOR LOOP with Params[i].
But changing this has no effect.
The only document size change happerns with the AcquireParams at the top being modified.

The actual question I have is why does compression make no change in the PDF Size?

ImageEnMView1.MIO.AcquireParams.XResolution := 200;
ImageEnMView1.MIO.AcquireParams.YResolution := 200;
ImageEnMView1.MIO.AcquireParams.PixelType := ieapMonochrome;;
if ImageENMView1.MIO.Acquire then
   begin
   for i := 0 to ImageEnMView1.ImageCount - 1 do
     begin
     bmp := ImageEnMView1.GetTIEBitmap(i);
     ImageEnMView1.Proc.AttachedIEBitmap := bmp;
     ImageEnMView1.Proc.SkewDetection( 100, 20, 0.1, True);
     ImageEnMView1.Proc.AutoCrop2(StrToFloat(edtCropRate.Text), True); 
     ImageEnMView1.ReleaseBitmap(i);
     ImageEnMView1.UpdateImage(i);
     ImageEnMView1.MIO.Params[i].PDF_PaperSize := iepLetter; //iepAuto
     end;
   end;
ImageENMView1.MIO.Params[0].PDF_Compression := ioPDF_G4FAX;  //Changing or removing this line does not affect PDF size
ImageENMView1.MIO.Params[0].BitsPerSample := 1;
ImageENMView1.MIO.Params[0].SamplesPerPixel := 1;
ImageENMView1.MIO.DuplicateCompressionInfo(); 
ImageEnMView1.MIO.SaveToFilePDF(FileName);


Thanks

xequte Posted - Dec 03 2024 : 17:32:50
Hi

It really comes down to your desired DPI. For instance, if you are outputting your PDF as A4 with a DPI of 144 (200% of the standard PDF DPI) then you need scan at no more than 1190 x 1684 (i.e. 595 x 2 and 842 x 2).

But you really need to do some tests to see what DPI gives you the optimal results.

You can see the standard page sizes at:

https://www.imageen.com/help/TIOParams.PDF_PaperWidth.html

Nigel
Xequte Software
www.imageen.com