Editing a DOCX document and saving it to PDF adds margins in the PDF using .NET

I am displaying a docx document in a word editing control (Telerik Editor for asp.net aspx) by using GroupDocs.Editor to convert the docx to html. Here’s a screen shot…
image.png (56.1 KB)

I then use GroupDocs.Editor to save that file as pdf. It’s adding margins to my document. Here’s a screen shot.
image.png (65.6 KB)

I’ve attached the docx file.
GENERIC_MEDICATION_FORM_NO_Med_Policy_eff_11-02-2017.zip (36.9 KB)

1 Like

@CLQcflowers,

Please share following details and we’ll investigate this behavior of the API:

  • Sample code or project
  • API version that you integrated in the project (e.g. 19.8, 20.1)

Version 20.3.0.0 - Maybe my issue is in the fixContent() function that I had to do because I was trying to work around errors I was getting in GroupDocs.

private void saveFiles(Document document, string newDocxFullPath, string newPDFFullPath, string content)
{
var newContent = fixContent(content);
var oldContent = File.ReadAllBytes(document.fullPath);
MemoryStream inputStream = new MemoryStream(oldContent);
using (Editor editor = new Editor(delegate { return inputStream; }, delegate { return new WordProcessingLoadOptions(); }))
{
EditableDocument readyToSave = EditableDocument.FromMarkup(newContent, null);
if (!string.IsNullOrEmpty(newDocxFullPath))
editor.Save(readyToSave, newDocxFullPath, new WordProcessingSaveOptions(WordProcessingFormats.Docx));
if (!string.IsNullOrEmpty(newPDFFullPath))
editor.Save(readyToSave, newPDFFullPath, new PdfSaveOptions());
readyToSave.Dispose();
editor.Dispose();
}
inputStream.Close();
}

    private string fixContent(string content) // CLF - I do this or I get errors with GroupDocs
    {
        var newContent = content;
        newContent = newContent.Replace(@"<colgroup>", ""); //CLF TODO - getting errors if content contains colgroup report to GroupDocs
        newContent = newContent.Replace(@"</colgroup>", "");
        newContent = newContent.Replace(@"<col />", "");
        newContent = newContent.Replace(@"placeholder", "value");
        return newContent;
    }
1 Like

@CLQcflowers,

We’re investigating this issue. Your investigation ticket ID is EDITORNET-1585. As there’s any further update, you’ll be notified.

1 Like

@atirtahir3 I’ve created a small test project in GitHub - GitHub - cindyflowers/GroupDocs.Editor-for.NET-WebForms: GroupDocs.Editor-for.NET-WebForms

1 Like

@CLQcflowers,

We’ll further investigate the project and let you know about the outcomes.

@CLQcflowers,

This is a back-end API related issue, we’ve reproduced it. We are working on the fix. As there’s any update, you’ll be notified.

1 Like

@CLQcflowers,

EDITORNET-1585 is now fixed in API version 20.5.