Page 1 of 2
the size of save files in too big
Posted: Thu Apr 10, 2014 3:04 pm
by resilux
Hi again Sergey
I have another issue. I have small document with some pictures in it, not too big. between 40kb and 100 kb each one. When I save this document to rvf file, the filesize is 3249 kb. If I copy the document content and I paste it in Word, and then Isave this file, the file size is 365 kb, which is normal according with the size of the pictures stored.
What can be wrong?
if you want I can send you the generate rvf file.
Regards
Jesus
Posted: Sat Apr 12, 2014 10:15 am
by Sergey Tkachenko
Try calling
Code: Select all
SRV.RichViewEdit.DeleteUnusedStyles(True, True, True);
SRV.RVHeader.DeleteUnusedStyles(True, True, True);
SRV.RVFooter.DeleteUnusedStyles(True, True, True);
before saving.
If it does not help, send a sample rtf to me to richviewgmailcom.
Posted: Mon Apr 14, 2014 8:22 am
by resilux
Sergey, it did not work.
I have already sent to you an email with the generated files.
Thanks..
Posted: Mon Apr 14, 2014 2:21 pm
by Sergey Tkachenko
I received your files.
You have a jpeg picture, but in RVF and RTF it is stored as a metafile containing a bitmap. Of course, a bitmap size is greater than a jpeg size.
How could it happen?
For RTF, it may happen if you excluded rvrtfSaveJpegAsJpeg from SRV.RTFOptions.
For RVF, image formats are not converted, so jpeg cannot be converted to a metafile or any other format when saving RVF.
So I believe this RVF is created after loading RTF file containing a metafile.
Posted: Mon Apr 14, 2014 2:37 pm
by resilux
Hi Sergey
Thanks for answering. I store all documents in RTF format.
rvrtfSaveJpegAsJpeg was inlcuded in SRV.RTFOptions.
Any other clue why this is happening? Since I store the documents in database these ones becomes slower because of its size.
Please let me know...
Regards
Posted: Tue Apr 15, 2014 7:23 am
by Sergey Tkachenko
Another possibility of not saving Jpegs is Jpegs is using another class for Jpegs instead of TJpegImage.
Can you save RVF file immediately after inserting Jpeg?
Posted: Tue Apr 15, 2014 9:56 am
by resilux
Hi Sergey
I do not use another class for Jpeg.
This is what I do, maybe this can helps you to find out what is happening.
1) I create a new empty document
2) Insert the image I sent to you 45 kb.
3) Export to RVF file then I get 49 kb. Good.
4) Instead of Export I sabe the document in RTF Format stored in a stream. using these lines of code.
SRichViewEdit1.RichViewEdit.Modified := False;
FDataStream.Clear;
FDataStream.Position := 0;
SRichViewEdit1.RichViewEdit.SaveRTFToStream( FDataStream,False );
5) Close the document, and I reopen it but this time loading its content from the stream.
6) I try to export the document in RVF Format and then I get a file wiht 243 kb, which is not good.
I think the problem is when I store the document in the stream. Can be?
Please let me know...
Regards
Jesus
Posted: Tue Apr 15, 2014 4:14 pm
by Sergey Tkachenko
Please send me the first RVF (49 kb).
Posted: Wed Apr 16, 2014 6:26 am
by resilux
Hi Sergey
I already sent to you by mail.
Regards
Posted: Wed Apr 16, 2014 9:04 am
by Sergey Tkachenko
I received it. As I expected, this jpeg was loaded not in TJPEGImage but in another class, TdxSmartImage.
TRichView knows nothing about TdxSmartImage, so it cannot save it to RTF as Jpeg.
Solution:
1) Compile your application without DXREGISTERPNGIMAGE define. If it is not defined, DevExpress code does not register TdxPNGImage for PNG, and TdxSmartImage for TIF GIF PNG JPG JPEG, so standard VCL classes will be used.
or
2) You can subclass TRVGraphicHandler to support DevExpress classes. I can explain how to do it, if you need.
Posted: Wed Apr 16, 2014 9:13 am
by resilux
Sergey
First of all, thanks a lot for your help
1) I have bough and installed Devpress Components, but I do use them in my application, so DXREGISTERPNGIMAGE is no defined. So I do not find any explanation why my application is using TdxSmartImage instead. This is something that I have to figure out.
2) About subclass TRVGraphicHandler to support DevExpress classes. Can you tell how to do it.
Once more, thanks
Regards
Jesus
Posted: Wed Apr 16, 2014 9:42 am
by resilux
Sergey
Another question about this. I have disabled for the moment the Dev components. So I did a test, and you were right. But this is fine for new documents, What can I do for already store documents?
I am afraid, nothing, isnĀ“t it?
Regards
Posted: Wed Apr 16, 2014 10:26 am
by Sergey Tkachenko
RVGraphicHandler already supports TdxPngImage (if RVUSEDXPNGIMAGE is defined in RV_Defs.inc), so it makes sense to expand it for TdxSmartImage).
Also, I added a new method RVGraphicHandler.RegisterJpegGraphic allowing to change the default class for JPEGS (it will be used, for example, when loading RTF with jpegs).
It will be included in the next update.
PS: I reopened private forums for your account.
Posted: Wed Apr 16, 2014 10:31 am
by Sergey Tkachenko
In your existing documents, images are stored as metafiles.
You can convert all images in documents to jpegs (
http://www.trichview.com/forums/viewtopic.php?t=761 - example for C++Builder, I can convert it to Delphi, if you need).
However, JPEGs are good only for photos. If you have screenshots of schemes containing clear lines or text, converting them to JPEG will noticeable decrease quality.
Posted: Wed Apr 16, 2014 11:00 am
by resilux
Thanks a lot.
Please let me know when you release the update.
Regards