Hi, Does the Viewer support pagination of docx files? If so, what element can I use in the docx header to display the current page number?
Hi John,
GroupDocs.Viewer of course supports the pagination of all WordProcessing formats, including DOC, DOCX, DOCM etc. When you render them to the HTML, PDF, PNG or JPEG, their content is converted in paginated way. In other words, when the some DOCX content is splitted onto 3 pages, when you view it in MS Word, the GroupDocs.Viewer splits it on exact 3 pages and on the same split positions, when converting to output formats. For HTML, PNG and JPEG it will be a set of multiple files, one file per one page. For PDF it will be a single PDF file, where each PDF page represents the exact page from input DOCX.
Now about your 2nd question. As I understand, the input DOCX has no page numbering in the header, and you want to add page number into the header, that will be present on every page of the rendered document. If I understand you corectly, and this is what you actually need, the GroupDocs.Viewer does not support such a feature, because the GroupDocs.Viewer is intended to view the documents by converting them to web-compatible formats, while what you ask is actually modifying the document, so the produced output document will be different from input document.
If I understood you incorrectly, please clarify your needs.
With best regards,
Denis Gvardionov
Yes, you understand correctly. Unfortunately we required a pagination field to be updated by the renderer. Do you have any plans to add this feature?
What you’re asking is actually a new feature. Before making a decision whether we will implement it or not, planning, estimating and so on, we need to ask you some questions regarding what exactly you need:
- Is it required only when rendering the WordProcessing (DOC, DOCX, DOCM,…) formats family or some other?
- Is it required when rendering DOCX to the raster images only, or also to the HTML and/or PDF?
- What should the Group.Docs.Viewer do, when the particular loaded DOCX file already has the page numbers, and this feature is enabled? Ignore this particular document and leave untouched? Or remove the existing numbering and apply the new one?
- How exactly you need to control the page numbering? Ability to specify the location (top-center-bottom-left-right), font, number format?
Anyway, if and when this feature will be implemented and enabled, you must take into account that it may change the layout of the rendered document, because the headers-footers occupy some page area and thus can trigger the content shifting.
Waiting for your reply.
With best regards,
Denis Gvardionov
Hi Denis,
I think that adding this feature would really make your product stand out amongst competitors.
- I am only interested in docx
- I would expect that if I loaded a docx with pagination (or page numbering) enabled and exported that document to PDF, the page numbers would show in the PDF. That assumes the layout would result in the same placement of page breaks.
To answer 3, 4. From my research, it appears that DOCX allows for the implementation of page numbering using two elements:
<w:lastRenderedPageBreak/>
<w:fldSimple w:instr=“PAGE”>
I’m not sure how simple fields are implemented, but I believe it is up to the renderer to insert a <w:lastRenderedPageBreak/> element every time it renders a new page.
3) I think you would remove all <w:lastRenderedPageBreak/> elements and reinsert them each rendering (or saving).
4) That is governed by the simplefield with instruction code “PAGE”, where the current page number is placed in the rendered page at that location. How it is calculated from the <w:lastRenderedPageBreak/> elements, I don’t know how you would do that.
Thanks very much for considering this feature request.
Hi John,
We will make our internal R&D for this feature request and come back to you later (in this forum thread).
With best regards,
Denis Gvardionov
Hi John,
We will implement this page numbering feature with new option in public API and it will be present in the nearest GroupDocs.Viewer version 26.7, that is planned to be released in the end of this or beginning of the next month.
With best regards,
Denis Gvardionov