Thanks for your request. Size of PDF documents can be reduced only by doing the following:
1. Decreasing size of images inside PDF (this can be done only be decreasing quality).
2. Subsetting fonts, which are embedded into the PDF documents. (Aspose.Words does this by default).
3. Compression of text (Usually decreasing of size is not very big)
4. Using “Core fonts”. “Core fonts” are 14 fonts, which are supported by PDF viewers by default. We can optionally get rid embedding of these fonts into PDF. But, unfortunately, this feature is not supported by Aspsoe.Words at the moment. I will let you know once it is available.
Difference in side of PDF document generated by Aspose.Words and MS Word can be explained by different way of subsetting fonts. For example, if you try to convert a larger document to PDF the size different will be unnoticeable.
As a variant, you can try using TextCompression and JpegQuality options. But you should note if you change JpegQuality you can reduce the quality of images in the document. See the following code:
// Open source document.
Document doc = new Document("in.doc");
// Set PdfSaveOptions
PdfSaveOptions pdfOptions = new PdfSaveOptions();
pdfOptions.TextCompression = PdfTextCompression.Flate;
pdfOptions.JpegQuality = 60;
Hope this helps.
Thank you. This did not help to much extent. I am trying some more on this and will comeback with questions.
Meanwhile, one more question.
I am trying to get the character count from a word document and itseems wrong. Actual document attached.
Document doc = new Document("C:\\test.doc");
// Update the word, character and paragraph count of the document.
// Display the updated document properties.
int cnt= doc.BuiltInDocumentProperties.Characters;
int cnt2= doc.BuiltInDocumentProperties.Words;
I expect the output of cnt to be 4 but it is showing as 74.
Same is the case with No. of words. Supposed to be 1 while it returns 11
Am I doing anything wrong?
Thanks for your inquiry.
I cannot reproduce the issue using the latest version of Aspose.Words. You can download it from here.
On my side the counts were as expected - Words:1 and Characters:4
Thanks you for additional information. If you do not call UpdateWordCount you will get the same result as MS Word shows. Please see the attached screenshot.
Thanks this additional information.
The screenshot that Andrey posted shows the word and character count which is stored within the document. This is the same values that Aspose.Words reads when you don't call doc.UpdateWordCount(). For some reason MS Word did not update the proper word count when it was last saved which lead to these incorrect values to be stored in the document.
However if try to look at the word count from inside Microsoft Word it will update these values before displaying them which is why you see the correct values in your screenshot.
From my tests, Aspose.Words updates the correct word count after calling doc.UpdateWordCount. Are you having any troubles with that on your side?