We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Saving Word file as PDF create very large file

In Aspose word I’ve created a doc file of 7MB. This file is a mail merge doc with about 140 copies of a letter with different names, addresses, etc. When it is saved as a PDF the size 40MB using version 16. With an older version it was 60MB so there has been some improvement. If I saved the output as a doc file and then convert it using MS Word the PDF is about 9MB. Could someone explain why the file is so large and how to generate a 9MB file?

here’s the code i’ve tried
outputDoc.Save(fn) where fn ext = doc results in 7MB doc file
outputDoc.Save(fn) where fn ext = pdf results in 40MB pdf file
Dim options As New Aspose.Words.Saving.PdfSaveOptions()
options.TextCompression = Aspose.Words.Saving.PdfTextCompression.None
outputDoc.Save(fn, options) where fn ext = pdf results in 125MB file

Hi there,

Thanks for your inquiry. To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word document
  • Please create a standalone console application (source code without compilation errors) that helps us reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we'll start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip them and Click 'Reply' button that will bring you to the 'reply page' and there at the bottom you can include any attachments with that post by clicking the 'Add/Update' button.
We found that adding watermark makes the file size become very large
I attach you a sample project with sample file to test (SampleProject.zip)

The source document is source.doc, and you can try to generate 4 things:
#1 a document with output type word file without watermark
#2 a document with output type pdf file without watermark
#3 a document with output type word file with watermark
#4 a document with output type pdf file with watermark

You should able to see that the size of documents #1 and #3 are nearly same (no big difference)
but the size of documents #2 and #4 are 5 times bigger differences.

and you can try to open document #3 with your MS Office, and save it as PDF. The file size is very small which is I would like to have when generate pdf using aspose.

Could you please give any advice how to get that small size pdf document with aspose?
Hi there,

Thanks for sharing the detail. We have tested the scenario and have noticed that saving document to Pdf with watermark generates big size Pdf file. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-13166. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Is there any update or hotfix for this reported issue?

Hi there,

Thanks for your inquiry. We regret to share with you that this issue (WORDSNET-13166) has been postponed. We will inform you via this forum thread as soon as there are any further developments.

We apologize for your inconvenience.

Dear happiness

You are not making me happy since this bug causes very large files to be created that can’t be emailed since the aid exceeds the maximum allowed by most email systems. Go back and rethink your response.

One unhappy customer

Hi there,

Please accept my apologies for your inconvenience.

As a workaround of this issue, please generate WordArt shape with expected text, render it to image using ShapeRender, insert image instead of WordArt as watermark. Please check following highlighted code snippet. We have attached the output Pdf with this post for your kind reference. Hope this helps you.

Thanks for your patience.

Private Sub InsertWatermarkText(ByVal doc As Document, ByVal watermarkText As String)

' Create a watermark shape. This will be a shape.

' You are free to try other shape types as watermarks.

Dim shape As Shape = New Shape(doc, ShapeType.TextPlainText)

' Set up the the watermark.

shape.TextPath.Text = watermarkText

shape.TextPath.FontFamily = "Arial"

shape.Width = 500

shape.Height = 100

'from bottom left to top right

shape.Rotation = -40

Dim Color_Converter As New ColorConverter

Dim ActualColor As Color = CType(Color_Converter.ConvertFromString("gray"), Color)

shape.Fill.Color = ActualColor

shape.StrokeColor = ActualColor

Dim stream As New MemoryStream()

shape.GetShapeRenderer().Save(stream, New Aspose.Words.Saving.ImageSaveOptions(SaveFormat.Jpeg))

Dim watermark As Shape = New Shape(doc, ShapeType.Image)


' Place the watermark in the page center.

watermark.RelativeHorizontalPosition = RelativeHorizontalPosition.Page

watermark.RelativeVerticalPosition = RelativeVerticalPosition.Page

watermark.WrapType = WrapType.None

watermark.VerticalAlignment = VerticalAlignment.Center

watermark.HorizontalAlignment = HorizontalAlignment.Center

'insert the watermark into all headers of each document section

For Each sect As Section In doc.Sections

'there could be up to three different headers in each section

InsertWatermarkIntoHeader(watermark, sect, HeaderFooterType.HeaderPrimary)

InsertWatermarkIntoHeader(watermark, sect, HeaderFooterType.HeaderFirst)

InsertWatermarkIntoHeader(watermark, sect, HeaderFooterType.HeaderEven)


End Sub