Page 1 of 1

get Filesize during building up a OCR-PDF

Posted: Wed Sep 12, 2012 8:05 am
by OLager
Hi,

with multiple TIF files I'm generate a OCR PDF with "PdfAddGdPictureImageToPdfOCR". Everthing works fine.
One condition is that no file has to become bigger then 10MB. Therefore I always have to know what is the actual filesize of the PDF. If the limit of 10MB is reached, I create a new PDF (01, 02, 03...)

Is there any property which I can use to get the file length or where can I find the temporary PDF?

Thanks Olaf

Re: get Filesize during building up a OCR-PDF

Posted: Wed Sep 12, 2012 9:23 am
by Loïc
Hello Olaf,

The only way is to save the current PDF into a memory stream and get the stream size.

Kind regards,

Loïc

Re: get Filesize during building up a OCR-PDF

Posted: Wed Sep 12, 2012 10:21 am
by OLager
Hello Loïc,

thanks a lot for fast response.

Stream... OK. But how can I save the hole PDF to a stream? I set the jpg quality to a low level. Therefore a have to know the size of the hole pdf and not the sum of all the images.
I only find the possibility to save one image to a stream, not for a PDF.

maybe you have an example for me?

Thanks Olaf

Re: get Filesize during building up a OCR-PDF

Posted: Thu Sep 13, 2012 6:34 am
by OLager
Maybe at least a short hint?
Can i Use gdpicture to save the stream or have I to use system.io? In gdpicture I only find methods to save ONE Image...

Re: get Filesize during building up a OCR-PDF

Posted: Fri Sep 14, 2012 7:56 am
by OLager
Hi Loïc,

I realised, that I have posted in the wrong topic. Maybe you can move this thread in the topic "GdPicture Tesseract OCR Engine Plugin". Maybe someone else than help me.

Re: get Filesize during building up a OCR-PDF

Posted: Mon Sep 17, 2012 2:01 pm
by Loïc
Hello Olaf,

After further investigations I realized that it was not really accurate way to anticipate the actual PDF size.

The only workaround I can see is:

- Create one PDF/OCR by page.
- With the GdPicturePDF class, merge a number of created files to do not exceed your limitation.

This looks a little messy but unfortunately I have no other workaround in mind.

Kind regards,

Loïc