2

Having an issue where I'm using DevExpress RichEditDocument server and the .HtmlText property being used to convert HTML to a PDF document. The base html and some styles get applied, however styles like width, padding, margins are not being applied. I have tried putting the styles in the HTML tags and using a separate style tag with classes as well.

Are there adjustments I can make to the DevExpress page itself for margins so the HTML will start at the edge of the PDF?

jhughes
  • 21
  • 2

1 Answers1

0

To setup page margins you can use Section.Margins property of a document:

document.Sections[0].Margins.Top = 0;
document.Sections[0].Margins.Bottom = 0;
document.Sections[0].Margins.Left = 0.2f;
document.Sections[0].Margins.Right = 0.2f;

Full example is shown on DevExpress documentation page: https://docs.devexpress.com/OfficeFileAPI/402993/word-processing-document-api/html-import-and-export?p=netstandard#example-1-convert-html-to-pdf

PS: HTML support in RichEditDocumentServer appears to be very limited. All supported/unsupported tags with attributes are listed here: https://docs.devexpress.com/OfficeFileAPI/15684/word-processing-document-api/html-import-and-export/html-support-limitations