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

Free Support Forum - aspose.com

Save to PDF: Bug with ParagraphFormat.Shading.BackgroundPatternColor and ParagraphFormat.SpaceBefore

Hi,

Using v9.1.0.0 (and previous versions), there is a PDF rendering bug when you have a colored background using the SpaceBefore and/or SpaceAfter properties. Space between the two paragraphs of the same style is not shaded.

See the attached for the Word and PDF version of the same document generated with the following code:

Thanks,

Dominic.

Aspose.Words.Document wordDocument = new Aspose.Words.Document();
wordDocument.RemoveAllChildren();

Aspose.Words.Style style;

// Normal
style = wordDocument.Styles[Aspose.Words.StyleIdentifier.Normal];
style.Font.Size = 10;

// ShadedBackground
style = wordDocument.Styles.Add(Aspose.Words.StyleType.Paragraph, “ShadedBackground”);
style.BaseStyle = wordDocument.Styles[Aspose.Words.StyleIdentifier.Normal].Name;

style.ParagraphFormat.Shading.BackgroundPatternColor = System.Drawing.Color.FromArgb(254,239,171); //

// This line is the only part flowing from one paragraph to the other
style.ParagraphFormat.Borders.LineStyle = Aspose.Words.LineStyle.Single;
style.ParagraphFormat.Borders.Color = System.Drawing.Color.FromArgb(254,239,171); //

style.ParagraphFormat.Borders.LineWidth = 1;
style.ParagraphFormat.Borders.DistanceFromText = 0;
style.ParagraphFormat.Borders.Top.DistanceFromText = 3;
style.ParagraphFormat.Borders.Bottom.DistanceFromText = 3;

style.ParagraphFormat.SpaceBefore = 12;
style.ParagraphFormat.SpaceAfter = 12;


Aspose.Words.DocumentBuilder builder = new Aspose.Words.DocumentBuilder(wordDocument);

builder.ParagraphFormat.Style = builder.Document.Styles[“ShadedBackground”];
builder.Writeln(“Line 1”);
builder.Writeln(“Line 2”);
builder.ParagraphFormat.ClearFormatting();

string asmVersion = typeof(Aspose.Words.Document).Assembly.GetName().Version.ToString();
wordDocument.Save(“c:\temp\asposeWords07-v” + asmVersion + “.doc”);
wordDocument.Save(“c:\temp\asposeWords07-v” + asmVersion + “.pdf”, Aspose.Words.SaveFormat.Pdf);

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. This problem is already resolved in the current codebase. The fix will be included into the next hotfix, which will be released in a week. You will be notified.

Best regards,

The issues you have found earlier (filed as 7452) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(31)