Suppress Page 1 of X using document editor API in .NET

To reproduce, you can drop the attached file into the live demo - Online Document Editor | Free GroupDocs Apps
I need to get rid of the Page 1 of 2 that is put into the document. How can I do that?

GENERIC_MEDICATION_FORM_NO_Med_Policy_eff_11-02-2017.zip (36.9 KB)

1 Like

@CLQcflowers,

Can you please further elaborate your use-case? Do you want to remove a page from a document (e.g. remove first page from a document of 2 pages)?

When I open the .docx in WORD, it does not show the text “Page 1 of 2”. Your software is adding that text to the html content of the document. Does that make sense?
Steps:

  1. open up .docx in WORD - note that the test “Page 1 of 2” is not in document.
  2. drop the same .docx into your demo of GroupDocs.Editor - Online Document Editor | Free GroupDocs Apps
    Note that “Page 1 of 2” has been added to the document.

image.png (1.4 KB)

@CLQcflowers,

Please have a look at this screenshot.JPG (80.1 KB). We opened the provided document in Word and it shows “Page 1 of 2”.

@atirtahir3 Here’s a screen shot from my machine… no Page 1 of 2
image.png (173.6 KB)

@CLQcflowers,

Please have a look at this image.JPG (176.1 KB). Can you please share your machine details (e.g. OS and its version, MS Word version). Make sure you sent me same copy of the document that you are opening in Word.

I apologize, I was viewing in Word in Web Layout. There are page numbers on the original just as you showed.
HOWEVER, when I run the “Origional.docx” file through my test application which has been modified this morning, I get documents that have issues.

  1. Saved document does not have page 1 of 2 in results in docx and pdf
  2. Saved document adds increased left margin to document in docx and pdf
  3. Saved document as html or GetEmbeddedHTML does not have page 1 of 2.
  • Original document viewed in word
    image.png (95.4 KB)
  • Exported using GroupDocs as docx - viewing in word
    image.png (210.1 KB)
  • Exported using GroupDocs as pdf - viewing in Adobe Reader
    image.png (248.6 KB)
    *Exported using GroupDocs as html - viewing in Edge
    image.png (73.9 KB)

You can find the original docx and exported files (docx, pdf, html) at the bottom of this ticket.

Here is the code… that is in git - GitHub - cindyflowers/GroupDocs.Editor-for.NET-WebForms: GroupDocs.Editor-for.NET-WebForms

if (fileupload.HasFile)
{
try
{
string myDate = DateTime.Now.ToString(“MM-dd-yyyy–H-mm-ss–”);
string filename = Path.GetFileName(fileupload.FileName);
string fullpath = Server.MapPath(“/Uploaded/”) +myDate + filename;
string fullpathExportDocX = fullpath.Replace(“.docx”, “-GroupDocsExport.docx”);
string fullpathExportEmbeddedHTML = fullpath.Replace(“.docx”, “-GroupDocsExportEmbedded.html”);
string fullpathExportHTML = fullpath.Replace(“.docx”, “-GroupDocsExport.html”);
string fullpathExportPDF = fullpath.Replace(“.docx”, “-GroupDocsExport.pdf”);
fullpathExportDocX = fullpathExportDocX.Replace(“Uploaded”, “Exported”);
fullpathExportHTML = fullpathExportHTML.Replace(“Uploaded”, “Exported”);
fullpathExportPDF = fullpathExportPDF.Replace(“Uploaded”, “Exported”);
fullpathExportEmbeddedHTML = fullpathExportEmbeddedHTML.Replace(“Uploaded”, “Exported”);
fileupload.SaveAs(fullpath);
using (Editor editor = new Editor(fullpath))
{
WordProcessingEditOptions editOptions = new WordProcessingEditOptions();
editOptions.EnablePagination = false;
EditableDocument readyToSave = editor.Edit(editOptions);

                    if (!string.IsNullOrEmpty(fullpathExportDocX))
                        editor.Save(readyToSave, fullpathExportDocX, new WordProcessingSaveOptions(WordProcessingFormats.Docx));
                    if (!string.IsNullOrEmpty(fullpathExportPDF))
                        editor.Save(readyToSave, fullpathExportPDF, new PdfSaveOptions());
                    if (!string.IsNullOrEmpty(fullpathExportHTML))
                        readyToSave.Save(fullpathExportHTML);
                    if (!string.IsNullOrEmpty(fullpathExportEmbeddedHTML))
                    {
                        var html = readyToSave.GetEmbeddedHtml();
                        File.WriteAllText(fullpathExportEmbeddedHTML, html);
                    }

                    readyToSave.Dispose();
                    editor.Dispose();
                }
                lblStatus.Text = "Upload status: File uploaded and converted!";
            }
            catch (Exception ex)
            {
                lblStatus.Text = "Upload status: The file could not be uploaded. The following error occured: " + ex.Message;
            }
        }

04-07-2020–9-26-32–Original.zip (34.0 KB)
04-07-2020–9-26-32–Original-GroupDocsExport.zip (120.8 KB)

1 Like

@CLQcflowers,

This is the output - Exported.zip (78.5 KB) we got using your application. There are two issues that we observed:

  1. Text “Page 1 of 2” is missing
  2. PDF output layout is disturbed (it’s kind of landscape)

Please let us know if there’s any other issue except these two. We’ll then investigate them.

Yes…
3. saving as DOCX output layout is disturbed.
4. if you run the following .docx file that is landscape, the output layout is also disburbed.Landscape.zip (26.4 KB)
5. if you run the following .docx file the layout is disturbed in the other direction.checkbox-oldstyle.zip (27.7 KB)

Thanks for all your help! Cindy

1 Like

@CLQcflowers,

Thanks for the details. We are investigating these issues. Your investigation ticket ID is EDITORNET-1587. As there’s any update, you’ll be notified.

1 Like

@CLQcflowers

Please download latest version of the API that is 20.6.
Using 20.6 the layout issue is fixed in all the problematic files, except checkbox-oldstyle.docx and we’re still investigating that.