We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Set Paper size by default

Hi, 

By default, the paper size of document editor is set to 'Letter' by default. There is any method to change the paper size default size value ? I only success to display the Page Setup dialog. 

Regards. 

7 Replies

RT Ramya Thirugnanam Syncfusion Team March 18, 2019 02:49 AM

Hi Thibault, 
Thanks for contacting Syncfusion support. 
Please refer to the below help documentation link for paper size in document editor. 
Regards,  
Ramya T  



TH Thibault March 18, 2019 06:25 AM

Thanks for your answer, but it doesn't work, my page stay with the Letter dimension (612*792). I want to instantiate my documentEditor with the A4 dimension. When i change pageWidth and pageHeight, and print a 2 pages doc with header and footer, the second page's header is cut. There is any method looks like documentEditor.setPageSize('A4'); ? 

You will find my JS code in attachement. 

Regards,. 



Attachment: document.js_69e97dd8.zip


RT Ramya Thirugnanam Syncfusion Team March 19, 2019 12:42 AM

Hi Thibault,  
  
Thanks for your update.  
 
Queries   
Response   
Regarding "Page width and height"  
  
In DocumentEditor, width and height of the pages are updated based on the section format value present the document which we are loading in document editor.   
 
And in a word document, we can have more than one section and different page setting for each of them. So, if you load a document in DocumentEditor using 'open' method page size are reset to the values defined in sfdt or word document’s section format.  
Regarding "it doesn't work, my page stays with the Letter dimension (612*792)"  
  
We have validated the JS code you have provided in the attachment.  As we mention above, you are using ‘open’ method after setting page size which mark page size reset to the value present in the section format.  
 
So, please change the page size after opening the document as shown in the below sample to initialize DocumentEditor with A4 dimension.  
   
Regarding "2 pages doc with header and footer, the second page's header is cut"  
  
We are not able to reproduce the reported issue from our side. Could you please provide us an input document (sfdt or word document) to replicate the issue? So that we will investigate on it and provide you the appropriate solution at the earliest.  
 
Regards, 
Ramya T 



TH Thibault March 19, 2019 01:10 AM

Thanks for your answer, it's work now ! 

The header cut problem is also solved with your solution. it was when trying to print a doc with Letter dimension with the titlebar Print functionality, when I open the preview before printing. Preview is A4 and Doc is Letter dimension. So now, it's solved. 

Thank you again (and sorry for my bad english, ahah) 

Regards
 


RT Ramya Thirugnanam Syncfusion Team March 19, 2019 01:21 AM

Hi Thibault,   
 
Thanks for your update. 
 
Regards, 
Ramya T 



GE Grant EFive replied to Ramya Thirugnanam October 30, 2019 09:29 PM

Hi Thibault,  
  
Thanks for your update.  
 
Queries   
Response   
Regarding "Page width and height"  
  
In DocumentEditor, width and height of the pages are updated based on the section format value present the document which we are loading in document editor.   
 
And in a word document, we can have more than one section and different page setting for each of them. So, if you load a document in DocumentEditor using 'open' method page size are reset to the values defined in sfdt or word document’s section format.  
Regarding "it doesn't work, my page stays with the Letter dimension (612*792)"  
  
We have validated the JS code you have provided in the attachment.  As we mention above, you are using ‘open’ method after setting page size which mark page size reset to the value present in the section format.  
 
So, please change the page size after opening the document as shown in the below sample to initialize DocumentEditor with A4 dimension.  
   
Regarding "2 pages doc with header and footer, the second page's header is cut"  
  
We are not able to reproduce the reported issue from our side. Could you please provide us an input document (sfdt or word document) to replicate the issue? So that we will investigate on it and provide you the appropriate solution at the earliest.  
 
Regards, 
Ramya T 


I'm also having trouble with pageSize being set incorrectly, the issue can be seen in the above linked: https://www.syncfusion.com/downloads/support/forum/143383/ze/Insert-Text2020201566  

When you run that sample: 

Even after setting the sectionFormat.pageHeight and sectionFormat.pageWidth properties to those which align with A4 size, if you click on the 'Page setup' tool, and then go to the 'Paper' tab - the Page size dropdown shows 'Letter', selecting 'A4' in this drop down does not change the width/height, but selecting 'Letter' again updates the values

In the source file: @syncfusion\ej2-documenteditor\src\document-editor\implementation\dialogs\page-setup-dialog.js on lines 453 to 466 (version 17.3.19),  it seems there's no calculation of the paper size, and the default is always 'Letter'


HC Harini Chellappa Syncfusion Team November 1, 2019 05:02 AM

Hi Thibault, 

You can set the default page size of the document editor using setDefaultSectionFormat API. 

Please refer the below code snippet. 

let defaultSectionFormatSectionFormatProperties = {   
    pageWidth: 595,  
    pageHeight: 842,  
}   
   
// Set default Section format   
container.documentEditor.setDefaultSectionFormat(defaultSectionFormat);   

Please try the above API and let us know whether this satisfies your requirement. 

Also we have logged the 'paper size dropdown not updating' as a bug and will be included in our upcoming EJ2 patch release which tentatively scheduled on November 20, 2019.

Regards, 
Harini C 


Loader.
Live Chat Icon For mobile
Up arrow icon