View Issue Details

IDProjectCategoryView StatusLast Update
0017476ScribusGeneralpublic2025-03-27 18:24
Reporternitramr Assigned Tonitramr  
PrioritynormalSeverityfeatureReproducibilityN/A
Status assignedResolutionopen 
PlatformDesktop PCOSUbuntuOS Version24.10 64-bit
Product Version1.7.1.svn 
Target Version1.7 milestone 
Summary0017476: Automatic detection of page size format
DescriptionCurrently, all page size presets are hard-coded into the page size class. In Scribus, the page size ID (page name) is primarily used to "recognize" a page. Actually, only a page dimension (height + width) is required to identify a page format.

The ID-based implementation makes it nearly impossible or very hard to load a page preset library outside Scribus. IDs may change or be missing there.

The following patch largely replaces the ID-based implementation and recognizes a page format based on its size dimensions. If a preset is found, the page is "recognized" as such; otherwise, the page format is "custom."

This change is the basis for a page size preset library that can be managed outside Scribus, similar to color palettes. Users can thus also create and share their own presets.

Note: You may need to save your page preset again in the preferences. In the prefs files, we only store page height and width with a precision of 3 decimal places, while in the sla files, we store them with 12 decimal places. Automatic detection has no tolerance yet.
TagsNo tags attached.
PatchYes

Activities

nitramr

2025-03-27 17:04

developer  

autopagesize_2025-03-27_01.diff (85,386 bytes)   
diff --git a/scribus/pagesize.cpp b/scribus/pagesize.cpp
index 4d5aebc..5ca4e42 100644
--- a/scribus/pagesize.cpp
+++ b/scribus/pagesize.cpp
@@ -27,24 +27,49 @@ for which a new license (GPL+exception) is in place.
 
 PageSize::PageSize(const QString& sizeName)
 {
-	init(sizeName);
+	initByName(sizeName);
 }
 
 PageSize::PageSize(double w, double h)
-        : m_width(w),
-          m_height(h)
 {
-	m_pageSizeName = CommonStrings::customPageSize;
-	m_trPageSizeName = CommonStrings::trCustomPageSize;
+	initByDimensions(QSizeF(w, h));
 }
 
 PageSize& PageSize::operator=(const PageSize& other)
 {
-	init(other.name());
+	initByDimensions(QSizeF(other.width(), other.height()));
 	return *this;
 }
 
-void PageSize::init(const QString& sizeName)
+void PageSize::initByDimensions(QSizeF sizePt)
+{
+	generateSizeList();
+
+	PageSizeInfo page = pageInfoByDimensions(sizePt);
+	if (page.sizeName.isEmpty())
+	{
+		// qDebug() << Q_FUNC_INFO << "Don't found page" << sizePt;
+		m_width = sizePt.width();
+		m_height = sizePt.height();
+		m_pageUnitIndex = -1;
+		m_pageSizeName = CommonStrings::customPageSize;
+		m_trPageSizeName = CommonStrings::trCustomPageSize;
+		m_category = PageSizeInfo::Custom;
+		return;
+	}
+
+	// qDebug() << Q_FUNC_INFO << "Found page" << page.sizeName << sizePt;
+
+	m_width = page.width;
+	m_height = page.height;
+	m_pageUnitIndex = page.pageUnitIndex;
+	m_pageSizeName = page.sizeName;
+	m_trPageSizeName = page.trSizeName;
+	m_category = page.category;
+
+}
+
+void PageSize::initByName(const QString& sizeName)
 {
 	m_width = 0.0;
 	m_height = 0.0;
@@ -124,19 +149,27 @@ PageSizeInfoMap PageSize::sizesByCategory(PageSizeInfo::Category category) const
 	return map;
 }
 
-PageSizeInfoMap PageSize::sizesByDimensions(QSize sizePt) const
+PageSizeInfoMap PageSize::sizesByDimensions(QSizeF sizePt) const
 {
 	PageSizeInfoMap map;
 
 	for (auto it = m_pageSizeList.begin(); it != m_pageSizeList.end(); ++it)
 	{
-		if (it.value().width == sizePt.width() && it.value().height == sizePt.height())
+		if ((qFuzzyCompare(it.value().width, sizePt.width()) && qFuzzyCompare(it.value().height, sizePt.height())) // portrait
+			|| (qFuzzyCompare(it.value().width, sizePt.height()) && qFuzzyCompare(it.value().height, sizePt.width()))) // landscape
 			map.insert(it.value().sizeName, it.value());
 	}
 
 	return map;
 }
 
+PageSizeInfo PageSize::pageInfoByDimensions(QSizeF sizePt) const
+{
+	PageSizeInfoMap list = sizesByDimensions(sizePt);
+	return (list.empty()) ? PageSizeInfo() : list.first();
+}
+
+
 PageSizeInfoMap PageSize::activePageSizes() const
 {
 	PageSizeInfoMap map;
diff --git a/scribus/pagesize.h b/scribus/pagesize.h
index 1507212..f758f37 100644
--- a/scribus/pagesize.h
+++ b/scribus/pagesize.h
@@ -61,13 +61,13 @@ struct PageSizeInfo
 		Swedish = 57,
 	};
 
-	double width;
-	double height;
+	double width {0.0};
+	double height {0.0};
 	QString trSizeName;
 	QString sizeName;
 	QString sizeLabel;
-	int pageUnitIndex;
-	Category category;
+	int pageUnitIndex {-1};
+	Category category {PageSizeInfo::Custom};
 };
 
 using PageSizeInfoMap = QMap<QString, PageSizeInfo>;
@@ -80,7 +80,6 @@ public:
 	PageSize(double, double);
 	PageSize& operator=(const PageSize& other);
 
-	void init(const QString&);
 	const QString& name() const { return m_pageSizeName; }
 	const QString& nameTR() const { return m_trPageSizeName; }
 	PageSizeInfo::Category category() const { return m_category; };
@@ -93,9 +92,11 @@ public:
 	static QStringList defaultSizesList();
 	PageSizeCategoriesMap categories() const;
 	PageSizeInfoMap sizesByCategory(PageSizeInfo::Category category) const;
-	PageSizeInfoMap sizesByDimensions(QSize sizePt) const;
+	PageSizeInfoMap sizesByDimensions(QSizeF sizePt) const;
 	PageSizeInfoMap activePageSizes() const;
-	const PageSizeInfoMap& pageSizes() const { return m_pageSizeList; };
+	const PageSizeInfoMap& pageSizes() const { return m_pageSizeList; }
+	PageSizeInfo pageInfoByDimensions(double width, double height) const { return pageInfoByDimensions(QSizeF(width, height));}
+	PageSizeInfo pageInfoByDimensions(QSizeF sizePt) const;
 	void printSizeList() const;
 
 private:
@@ -107,6 +108,8 @@ private:
 	QString m_trPageSizeName;
 	PageSizeInfo::Category m_category {PageSizeInfo::Custom};
 
+	void initByName(const QString&); // legacy support for < 1.7.1
+	void initByDimensions(QSizeF sizePt);
 	void generateSizeList();
 	void addPageSize(const QString id, double width, double height, int unitIndex, PageSizeInfo::Category category);
 	void addPageSize(const QString id, const QString name, double width, double height, int unitIndex, PageSizeInfo::Category category);
diff --git a/scribus/plugins/fileloader/scribus171format/scribus171format.cpp b/scribus/plugins/fileloader/scribus171format/scribus171format.cpp
index e8e2c2a..0d70a95 100644
--- a/scribus/plugins/fileloader/scribus171format/scribus171format.cpp
+++ b/scribus/plugins/fileloader/scribus171format/scribus171format.cpp
@@ -2438,7 +2438,6 @@ namespace {
 
 void Scribus171Format::readDocAttributes(ScribusDoc* doc, const ScXmlStreamAttributes& attrs) const
 {
-	m_Doc->setPageSize(attrs.valueAsString("PAGESIZE"));
 	m_Doc->setPageOrientation(attrs.valueAsInt("ORIENTATION", 0));
 	m_Doc->FirstPnum = attrs.valueAsInt("FIRSTNUM", 1);
 	m_Doc->setPagePositioning(attrs.valueAsInt("BOOK", 0));
@@ -2481,6 +2480,9 @@ void Scribus171Format::readDocAttributes(ScribusDoc* doc, const ScXmlStreamAttri
 	m_Doc->setHyphAutoCheck(attrs.valueAsBool("AUTOCHECK", false));
 	m_Doc->GuideLock = attrs.valueAsBool("GUIDELOCK", false);
 
+	PageSize ps = PageSize(m_Doc->pageWidth(), m_Doc->pageHeight());
+	m_Doc->setPageSize(ps.name());
+
 	m_Doc->rulerXoffset = attrs.valueAsDouble("rulerXoffset", 0.0);
 	m_Doc->rulerYoffset = attrs.valueAsDouble("rulerYoffset", 0.0);
 	m_Doc->SnapGuides = attrs.valueAsBool("SnapToGuides", false);
@@ -4329,8 +4331,6 @@ bool Scribus171Format::readPage(ScribusDoc* doc, ScXmlStreamReader& reader)
 	newPage->LeftPg = attrs.valueAsInt("LEFT", 0);
 	QString mpName = attrs.valueAsString("MNAM", "Normal");
 	newPage->setMasterPageName(m_Doc->masterPageMode() ? QString() : mpName);
-	if (attrs.hasAttribute("Size"))
-		newPage->setSize(attrs.valueAsString("Size"));
 	if (attrs.hasAttribute("Orientation"))
 		newPage->setOrientation(attrs.valueAsInt("Orientation"));
 	newPage->setXOffset(attrs.valueAsDouble("PAGEXPOS"));
@@ -4341,16 +4341,8 @@ bool Scribus171Format::readPage(ScribusDoc* doc, ScXmlStreamReader& reader)
 		newPage->setWidth(attrs.valueAsDouble("PAGEWITH"));
 	newPage->setHeight(attrs.valueAsDouble("PAGEHEIGHT"));
 
-	//14704: Double check the page size should not be Custom in case the size doesn't match a standard size
-	if (attrs.hasAttribute("Size"))
-	{
-		QString pageSize(attrs.valueAsString("Size"));
-		PageSize ps(pageSize);
-		if (!compareDouble(ps.width(), newPage->width()) || !compareDouble(ps.height(), newPage->height()))
-			newPage->setSize(CommonStrings::customPageSize);
-		else
-			newPage->setSize(pageSize);
-	}
+	PageSize ps(newPage->width(), newPage->height());
+	newPage->setSize(ps.name());
 
 	newPage->setInitialHeight(newPage->height());
 	newPage->setInitialWidth(newPage->width());
diff --git a/scribus/plugins/fileloader/scribus171format/scribus171format_save.cpp b/scribus/plugins/fileloader/scribus171format/scribus171format_save.cpp
index e6e1551..9fb80f5 100644
--- a/scribus/plugins/fileloader/scribus171format/scribus171format_save.cpp
+++ b/scribus/plugins/fileloader/scribus171format/scribus171format_save.cpp
@@ -336,7 +336,6 @@ bool Scribus171Format::saveFile(const QString & fileName, const FileFormat & /*
 	docu.writeAttribute("BleedRight"  , m_Doc->bleeds()->right());
 	docu.writeAttribute("BleedBottom" , m_Doc->bleeds()->bottom());
 	docu.writeAttribute("ORIENTATION" , m_Doc->pageOrientation());
-	docu.writeAttribute("PAGESIZE"    , m_Doc->pageSize());
 	docu.writeAttribute("FIRSTNUM"    , m_Doc->FirstPnum);
 	docu.writeAttribute("BOOK"        , m_Doc->pagePositioning());
 	if (m_Doc->usesAutomaticTextFrames())
@@ -1819,7 +1818,6 @@ void Scribus171Format::WritePages(ScribusDoc *doc, ScXmlStreamWriter& docu, QPro
 		docu.writeAttribute("NUM",page->pageNr());
 		docu.writeAttribute("NAM",page->pageName());
 		docu.writeAttribute("MNAM",page->masterPageName());
-		docu.writeAttribute("Size", page->size());
 		docu.writeAttribute("Orientation", page->orientation());
 		docu.writeAttribute("LEFT", page->LeftPg);
 		docu.writeAttribute("PRESET", page->marginPreset);
diff --git a/scribus/plugins/import/ai/importai.cpp b/scribus/plugins/import/ai/importai.cpp
index 24f5464..8ba9f33 100644
--- a/scribus/plugins/import/ai/importai.cpp
+++ b/scribus/plugins/import/ai/importai.cpp
@@ -136,7 +136,7 @@ QImage AIPlug::readThumbnail(const QString& fNameIn)
 	baseX = 0;
 	baseY = 0;
 	m_Doc = new ScribusDoc();
-	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 	m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
 	m_Doc->addPage(0);
 	m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
@@ -241,7 +241,7 @@ bool AIPlug::readColors(const QString& fileName, ColorList & colors)
 	docWidth = b - x;
 	docHeight = h - y;
 	m_Doc = new ScribusDoc();
-	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 	m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
 	m_Doc->addPage(0);
 	m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
@@ -379,7 +379,7 @@ bool AIPlug::import(const QString& fNameIn, const TransactionSettings& trSetting
 	{
 		if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 		{
-			m_Doc = ScCore->primaryMainWindow()->doFileNew(b - x, h - y, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+			m_Doc = ScCore->primaryMainWindow()->doFileNew(b - x, h - y, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 			ScCore->primaryMainWindow()->HaveNewDoc();
 			ret = true;
 			baseX = 0;
diff --git a/scribus/plugins/import/cdr/importcdr.cpp b/scribus/plugins/import/cdr/importcdr.cpp
index deaf5d2..9c9704f 100644
--- a/scribus/plugins/import/cdr/importcdr.cpp
+++ b/scribus/plugins/import/cdr/importcdr.cpp
@@ -49,7 +49,7 @@ QImage CdrPlug::readThumbnail(const QString& fName)
 	docHeight = PrefsManager::instance().appPrefs.docSetupPrefs.pageHeight;
 	progressDialog = nullptr;
 	m_Doc = new ScribusDoc();
-	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 	m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
 	m_Doc->addPage(0);
 	m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
@@ -155,7 +155,7 @@ bool CdrPlug::import(const QString& fNameIn, const TransactionSettings& trSettin
 	}
 	else if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 	{
-		m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+		m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 		ScCore->primaryMainWindow()->HaveNewDoc();
 		ret = true;
 		baseX = 0;
diff --git a/scribus/plugins/import/cgm/importcgm.cpp b/scribus/plugins/import/cgm/importcgm.cpp
index de60aec..2e26ccf 100644
--- a/scribus/plugins/import/cgm/importcgm.cpp
+++ b/scribus/plugins/import/cgm/importcgm.cpp
@@ -101,7 +101,7 @@ QImage CgmPlug::readThumbnail(const QString& fName)
 	docHeight = h;
 	progressDialog = nullptr;
 	m_Doc = new ScribusDoc();
-	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 	m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
 	m_Doc->addPage(0);
 	m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
@@ -206,7 +206,7 @@ bool CgmPlug::import(const QString& fNameIn, const TransactionSettings& trSettin
 	{
 		if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 		{
-			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 			ScCore->primaryMainWindow()->HaveNewDoc();
 			ret = true;
 			baseX = 0;
diff --git a/scribus/plugins/import/cvg/importcvg.cpp b/scribus/plugins/import/cvg/importcvg.cpp
index cdbe569..be484e3 100644
--- a/scribus/plugins/import/cvg/importcvg.cpp
+++ b/scribus/plugins/import/cvg/importcvg.cpp
@@ -55,7 +55,7 @@ QImage CvgPlug::readThumbnail(const QString& fName)
 	docHeight = h;
 	progressDialog = nullptr;
 	m_Doc = new ScribusDoc();
-	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 	m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
 	m_Doc->addPage(0);
 	m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
@@ -165,7 +165,7 @@ bool CvgPlug::import(const QString& fNameIn, const TransactionSettings& trSettin
 	{
 		if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 		{
-			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 			ScCore->primaryMainWindow()->HaveNewDoc();
 			ret = true;
 			baseX = 0;
diff --git a/scribus/plugins/import/drw/importdrw.cpp b/scribus/plugins/import/drw/importdrw.cpp
index b470855..215cc31 100644
--- a/scribus/plugins/import/drw/importdrw.cpp
+++ b/scribus/plugins/import/drw/importdrw.cpp
@@ -62,7 +62,7 @@ QImage DrwPlug::readThumbnail(const QString& fName)
 	docHeight = h;
 	progressDialog = nullptr;
 	m_Doc = new ScribusDoc();
-	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 	m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
 	m_Doc->addPage(0);
 	m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
@@ -180,7 +180,7 @@ bool DrwPlug::import(const QString& fNameIn, const TransactionSettings& trSettin
 	{
 		if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 		{
-			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 			ScCore->primaryMainWindow()->HaveNewDoc();
 			ret = true;
 			baseX = 0;
diff --git a/scribus/plugins/import/emf/importemf.cpp b/scribus/plugins/import/emf/importemf.cpp
index bc37acf..77b62b6 100644
--- a/scribus/plugins/import/emf/importemf.cpp
+++ b/scribus/plugins/import/emf/importemf.cpp
@@ -438,7 +438,7 @@ QImage EmfPlug::readThumbnail(const QString& fName)
 	baseY = 0;
 	progressDialog = nullptr;
 	m_Doc = new ScribusDoc();
-	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 	m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
 	m_Doc->addPage(0);
 	m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
@@ -586,7 +586,7 @@ bool EmfPlug::import(const QString& fNameIn, const TransactionSettings& trSettin
 	}
 	else if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 	{
-		m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+		m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 		ScCore->primaryMainWindow()->HaveNewDoc();
 		m_Doc->setPageHeight(docHeight);
 		m_Doc->setPageWidth(docWidth);
diff --git a/scribus/plugins/import/fh/importfh.cpp b/scribus/plugins/import/fh/importfh.cpp
index 6b3b859..43cedaf 100644
--- a/scribus/plugins/import/fh/importfh.cpp
+++ b/scribus/plugins/import/fh/importfh.cpp
@@ -56,7 +56,7 @@ QImage FhPlug::readThumbnail(const QString& fName)
 	docHeight = h;
 	progressDialog = nullptr;
 	m_Doc = new ScribusDoc();
-	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 	m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
 	m_Doc->addPage(0);
 	m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
@@ -163,7 +163,7 @@ bool FhPlug::import(const QString& fNameIn, const TransactionSettings& trSetting
 	{
 		if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 		{
-			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 			ScCore->primaryMainWindow()->HaveNewDoc();
 			ret = true;
 			baseX = 0;
diff --git a/scribus/plugins/import/idml/importidml.cpp b/scribus/plugins/import/idml/importidml.cpp
index 1b1d62e..fc8a520 100644
--- a/scribus/plugins/import/idml/importidml.cpp
+++ b/scribus/plugins/import/idml/importidml.cpp
@@ -154,7 +154,7 @@ QImage IdmlPlug::readThumbnail(const QString& fName)
 		docWidth = PrefsManager::instance().appPrefs.docSetupPrefs.pageWidth;
 		docHeight = PrefsManager::instance().appPrefs.docSetupPrefs.pageHeight;
 		m_Doc = new ScribusDoc();
-		m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+		m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 		m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
 		m_Doc->addPage(0);
 		m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
@@ -242,7 +242,7 @@ bool IdmlPlug::readColors(const QString& fileName, ColorList & colors)
 	}
 
 	m_Doc = new ScribusDoc();
-	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 	m_Doc->setPage(1, 1, 0, 0, 0, 0, 0, 0, false, false);
 	m_Doc->addPage(0);
 	m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
@@ -340,7 +340,7 @@ bool IdmlPlug::import(const QString& fNameIn, const TransactionSettings& trSetti
 	{
 		if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 		{
-			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 			ScCore->primaryMainWindow()->HaveNewDoc();
 			ret = true;
 			baseX = 0;
diff --git a/scribus/plugins/import/odg/importodg.cpp b/scribus/plugins/import/odg/importodg.cpp
index be7a3fc..f60d285 100644
--- a/scribus/plugins/import/odg/importodg.cpp
+++ b/scribus/plugins/import/odg/importodg.cpp
@@ -172,7 +172,7 @@ bool OdgPlug::import(const QString& fNameIn, const TransactionSettings& trSettin
 	{
 		if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 		{
-			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 			ScCore->primaryMainWindow()->HaveNewDoc();
 			ret = true;
 			baseX = 0;
diff --git a/scribus/plugins/import/oodraw/oodrawimp.cpp b/scribus/plugins/import/oodraw/oodrawimp.cpp
index 177d90b..d59b91f 100644
--- a/scribus/plugins/import/oodraw/oodrawimp.cpp
+++ b/scribus/plugins/import/oodraw/oodrawimp.cpp
@@ -308,7 +308,7 @@ QImage OODPlug::readThumbnail(const QString& fileName)
 	double width = !properties.attribute( "fo:page-width" ).isEmpty() ? parseUnit(properties.attribute( "fo:page-width" ) ) : 550.0;
 	double height = !properties.attribute( "fo:page-height" ).isEmpty() ? parseUnit(properties.attribute( "fo:page-height" ) ) : 841.0;
 	m_Doc = new ScribusDoc();
-	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 	m_Doc->setPage(width, height, 0, 0, 0, 0, 0, 0, false, false);
 	m_Doc->addPage(0);
 	m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
@@ -456,7 +456,7 @@ bool OODPlug::convert(const TransactionSettings& trSettings, int flags)
 	{
 		if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 		{
-			m_Doc = ScCore->primaryMainWindow()->doFileNew(width, height, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+			m_Doc = ScCore->primaryMainWindow()->doFileNew(width, height, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 			ScCore->primaryMainWindow()->HaveNewDoc();
 			ret = true;
 		}
diff --git a/scribus/plugins/import/pages/importpages.cpp b/scribus/plugins/import/pages/importpages.cpp
index b62a4f2..67367e1 100644
--- a/scribus/plugins/import/pages/importpages.cpp
+++ b/scribus/plugins/import/pages/importpages.cpp
@@ -239,7 +239,7 @@ bool PagesPlug::import(const QString& fNameIn, const TransactionSettings& trSett
 	{
 		if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 		{
-			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 			ScCore->primaryMainWindow()->HaveNewDoc();
 			ret = true;
 			baseX = 0;
diff --git a/scribus/plugins/import/pct/importpct.cpp b/scribus/plugins/import/pct/importpct.cpp
index de9e097..6dcb4a6 100644
--- a/scribus/plugins/import/pct/importpct.cpp
+++ b/scribus/plugins/import/pct/importpct.cpp
@@ -62,7 +62,7 @@ QImage PctPlug::readThumbnail(const QString& fName)
 	docHeight = h;
 	progressDialog = nullptr;
 	m_Doc = new ScribusDoc();
-	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 	m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
 	m_Doc->addPage(0);
 	m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
@@ -181,7 +181,7 @@ bool PctPlug::import(const QString& fNameIn, const TransactionSettings& trSettin
 	{
 		if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 		{
-			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 			ScCore->primaryMainWindow()->HaveNewDoc();
 			m_Doc->setPageHeight(docHeight);
 			m_Doc->setPageWidth(docWidth);
diff --git a/scribus/plugins/import/pdf/importpdf.cpp b/scribus/plugins/import/pdf/importpdf.cpp
index 596d89e..26ba5fa 100644
--- a/scribus/plugins/import/pdf/importpdf.cpp
+++ b/scribus/plugins/import/pdf/importpdf.cpp
@@ -164,7 +164,7 @@ bool PdfPlug::import(const QString& fNameIn, const TransactionSettings& trSettin
 	{
 		if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 		{
-			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, 0, 0, 0, 0, 1, "Custom", true);
+			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, 0, 0, 0, 0, 1, QSizeF(), true);
 			ScCore->primaryMainWindow()->HaveNewDoc();
 			ret = true;
 		}
diff --git a/scribus/plugins/import/pm/importpm.cpp b/scribus/plugins/import/pm/importpm.cpp
index 1da62d3..bbe984b 100644
--- a/scribus/plugins/import/pm/importpm.cpp
+++ b/scribus/plugins/import/pm/importpm.cpp
@@ -54,7 +54,7 @@ QImage PmPlug::readThumbnail(const QString& fName)
 	docHeight = PrefsManager::instance().appPrefs.docSetupPrefs.pageHeight;
 	progressDialog = nullptr;
 	m_Doc = new ScribusDoc();
-	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 	m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
 	m_Doc->addPage(0);
 	m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
@@ -161,7 +161,7 @@ bool PmPlug::import(const QString& fNameIn, const TransactionSettings& trSetting
 	{
 		if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 		{
-			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 			ScCore->primaryMainWindow()->HaveNewDoc();
 			ret = true;
 			baseX = 0;
diff --git a/scribus/plugins/import/pub/importpub.cpp b/scribus/plugins/import/pub/importpub.cpp
index 9c731f8..451a5b3 100644
--- a/scribus/plugins/import/pub/importpub.cpp
+++ b/scribus/plugins/import/pub/importpub.cpp
@@ -57,7 +57,7 @@ QImage PubPlug::readThumbnail(const QString& fName)
 	docHeight = PrefsManager::instance().appPrefs.docSetupPrefs.pageHeight;
 	progressDialog = nullptr;
 	m_Doc = new ScribusDoc();
-	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 	m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
 	m_Doc->addPage(0);
 	m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
@@ -164,7 +164,7 @@ bool PubPlug::import(const QString& fNameIn, const TransactionSettings& trSettin
 	{
 		if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 		{
-			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 			ScCore->primaryMainWindow()->HaveNewDoc();
 			ret = true;
 			baseX = 0;
diff --git a/scribus/plugins/import/qxp/importqxp.cpp b/scribus/plugins/import/qxp/importqxp.cpp
index 006ba13..b5dab47 100644
--- a/scribus/plugins/import/qxp/importqxp.cpp
+++ b/scribus/plugins/import/qxp/importqxp.cpp
@@ -74,7 +74,7 @@ QImage QxpPlug::readThumbnail(const QString& fName)
 	docHeight = h;
 	progressDialog = nullptr;
 	m_Doc = new ScribusDoc();
-	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 	m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
 	m_Doc->addPage(0);
 	m_Doc->setGUI(false, ScCore->primaryMainWindow(), 0);
@@ -184,7 +184,7 @@ bool QxpPlug::import(const QString& fNameIn, const TransactionSettings& trSettin
 	{
 		if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 		{
-			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 			ScCore->primaryMainWindow()->HaveNewDoc();
 			ret = true;
 			baseX = 0;
diff --git a/scribus/plugins/import/shape/importshape.cpp b/scribus/plugins/import/shape/importshape.cpp
index 01a0c34..51573dc 100644
--- a/scribus/plugins/import/shape/importshape.cpp
+++ b/scribus/plugins/import/shape/importshape.cpp
@@ -72,7 +72,7 @@ QImage ShapePlug::readThumbnail(const QString& fName)
 	docHeight = h;
 	progressDialog = nullptr;
 	m_Doc = new ScribusDoc();
-	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 	m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
 	m_Doc->addPage(0);
 	m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
@@ -181,7 +181,7 @@ bool ShapePlug::import(const QString& fNameIn, const TransactionSettings& trSett
 	{
 		if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 		{
-			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 			ScCore->primaryMainWindow()->HaveNewDoc();
 			ret = true;
 			baseX = 0;
diff --git a/scribus/plugins/import/sml/importsml.cpp b/scribus/plugins/import/sml/importsml.cpp
index adb666c..1b0414b 100644
--- a/scribus/plugins/import/sml/importsml.cpp
+++ b/scribus/plugins/import/sml/importsml.cpp
@@ -70,7 +70,7 @@ QImage SmlPlug::readThumbnail(const QString& fName)
 	docHeight = h;
 	progressDialog = nullptr;
 	m_Doc = new ScribusDoc();
-	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 	m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
 	m_Doc->addPage(0);
 	m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
@@ -179,7 +179,7 @@ bool SmlPlug::import(const QString& fNameIn, const TransactionSettings& trSettin
 	{
 		if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 		{
-			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 			ScCore->primaryMainWindow()->HaveNewDoc();
 			ret = true;
 			baseX = 0;
diff --git a/scribus/plugins/import/svg/svgplugin.cpp b/scribus/plugins/import/svg/svgplugin.cpp
index 5babddd..af8b609 100644
--- a/scribus/plugins/import/svg/svgplugin.cpp
+++ b/scribus/plugins/import/svg/svgplugin.cpp
@@ -237,7 +237,7 @@ QImage SVGPlug::readThumbnail(const QString& fName)
 	QDomElement docElem = inpdoc.documentElement();
 	QSizeF wh = parseWidthHeight(docElem);
 	m_Doc = new ScribusDoc();
-	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 	m_Doc->setPage(wh.width(), wh.height(), 0, 0, 0, 0, 0, 0, false, false);
 	m_Doc->addPage(0);
 	m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
@@ -411,7 +411,7 @@ void SVGPlug::convert(const TransactionSettings& trSettings, int flags)
 	{
 		if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 		{
-			m_Doc = ScCore->primaryMainWindow()->doFileNew(width, height, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+			m_Doc = ScCore->primaryMainWindow()->doFileNew(width, height, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 			ScCore->primaryMainWindow()->HaveNewDoc();
 			ret = true;
 		}
diff --git a/scribus/plugins/import/svm/importsvm.cpp b/scribus/plugins/import/svm/importsvm.cpp
index 811db77..5168851 100644
--- a/scribus/plugins/import/svm/importsvm.cpp
+++ b/scribus/plugins/import/svm/importsvm.cpp
@@ -308,7 +308,7 @@ QImage SvmPlug::readThumbnail(const QString& fName)
 	baseY = 0;
 	progressDialog = nullptr;
 	m_Doc = new ScribusDoc();
-	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 	m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
 	m_Doc->addPage(0);
 	m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
@@ -457,7 +457,7 @@ bool SvmPlug::import(const QString& fNameIn, const TransactionSettings& trSettin
 	{
 		if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 		{
-			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 			ScCore->primaryMainWindow()->HaveNewDoc();
 			m_Doc->setPageHeight(docHeight);
 			m_Doc->setPageWidth(docWidth);
diff --git a/scribus/plugins/import/viva/importviva.cpp b/scribus/plugins/import/viva/importviva.cpp
index e52a8e2..494745e 100644
--- a/scribus/plugins/import/viva/importviva.cpp
+++ b/scribus/plugins/import/viva/importviva.cpp
@@ -115,7 +115,7 @@ QImage VivaPlug::readThumbnail(const QString& fName)
 	docWidth = PrefsManager::instance().appPrefs.docSetupPrefs.pageWidth;
 	docHeight = PrefsManager::instance().appPrefs.docSetupPrefs.pageHeight;
 	m_Doc = new ScribusDoc();
-	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 	m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
 	m_Doc->addPage(0);
 	m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
@@ -166,7 +166,7 @@ bool VivaPlug::readColors(const QString& fileName, ColorList & colors)
 {
 	bool success = false;
 	m_Doc = new ScribusDoc();
-	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 	m_Doc->setPage(1, 1, 0, 0, 0, 0, 0, 0, false, false);
 	m_Doc->addPage(0);
 	m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
@@ -252,7 +252,7 @@ bool VivaPlug::import(const QString& fNameIn, const TransactionSettings& trSetti
 	{
 		if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 		{
-			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 			ScCore->primaryMainWindow()->HaveNewDoc();
 			ret = true;
 			baseX = 0;
diff --git a/scribus/plugins/import/vsd/importvsd.cpp b/scribus/plugins/import/vsd/importvsd.cpp
index 9a85eef..57ca66c 100644
--- a/scribus/plugins/import/vsd/importvsd.cpp
+++ b/scribus/plugins/import/vsd/importvsd.cpp
@@ -67,7 +67,7 @@ QImage VsdPlug::readThumbnail(const QString& fName)
 	docHeight = h;
 	progressDialog = nullptr;
 	m_Doc = new ScribusDoc();
-	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 	m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
 	m_Doc->addPage(0);
 	m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
@@ -174,7 +174,7 @@ bool VsdPlug::import(const QString& fNameIn, const TransactionSettings& trSettin
 	{
 		if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 		{
-			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 			ScCore->primaryMainWindow()->HaveNewDoc();
 			ret = true;
 			baseX = 0;
diff --git a/scribus/plugins/import/wmf/wmfimport.cpp b/scribus/plugins/import/wmf/wmfimport.cpp
index 3316ede..c345ec4 100644
--- a/scribus/plugins/import/wmf/wmfimport.cpp
+++ b/scribus/plugins/import/wmf/wmfimport.cpp
@@ -301,7 +301,7 @@ QImage WMFImport::readThumbnail(const QString& fname)
 	double width  = m_BBox.width() * scale;
 	double height = m_BBox.height() * scale;
 	m_Doc = new ScribusDoc();
-	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 	m_Doc->setPage(width, height, 0, 0, 0, 0, 0, 0, false, false);
 	m_Doc->addPage(0);
 	m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
@@ -566,7 +566,7 @@ bool WMFImport::importWMF(const TransactionSettings& trSettings, int flags)
 	{
 		if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 		{
-			m_Doc = ScCore->primaryMainWindow()->doFileNew(fabs(width), fabs(height), 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+			m_Doc = ScCore->primaryMainWindow()->doFileNew(fabs(width), fabs(height), 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 			ScCore->primaryMainWindow()->HaveNewDoc();
 			ret = true;
 		}
diff --git a/scribus/plugins/import/wpg/importwpg.cpp b/scribus/plugins/import/wpg/importwpg.cpp
index 5116050..2fa2160 100644
--- a/scribus/plugins/import/wpg/importwpg.cpp
+++ b/scribus/plugins/import/wpg/importwpg.cpp
@@ -418,7 +418,7 @@ QImage WpgPlug::readThumbnail(const QString& fName)
 	docHeight = h;
 	progressDialog = nullptr;
 	m_Doc = new ScribusDoc();
-	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 	m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
 	m_Doc->addPage(0);
 	m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
@@ -525,7 +525,7 @@ bool WpgPlug::import(const QString& fNameIn, const TransactionSettings& trSettin
 	{
 		if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 		{
-			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 			ScCore->primaryMainWindow()->HaveNewDoc();
 			ret = true;
 			baseX = 0;
diff --git a/scribus/plugins/import/xar/importxar.cpp b/scribus/plugins/import/xar/importxar.cpp
index 005eb6d..7f935ec 100644
--- a/scribus/plugins/import/xar/importxar.cpp
+++ b/scribus/plugins/import/xar/importxar.cpp
@@ -70,7 +70,7 @@ bool XarPlug::readColors(const QString& fileName, ColorList & colors)
 		if (id != 0x0A0DA3A3)
 			return false;
 		m_Doc = new ScribusDoc();
-		m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+		m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 		m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
 		m_Doc->addPage(0);
 		m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
@@ -276,7 +276,7 @@ bool XarPlug::import(const QString& fNameIn, const TransactionSettings& trSettin
 	{
 		if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 		{
-			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 			ScCore->primaryMainWindow()->HaveNewDoc();
 			ret = true;
 			baseX = m_Doc->currentPage()->xOffset() - x;
diff --git a/scribus/plugins/import/xfig/importxfig.cpp b/scribus/plugins/import/xfig/importxfig.cpp
index 9f5b031..7ea69d9 100644
--- a/scribus/plugins/import/xfig/importxfig.cpp
+++ b/scribus/plugins/import/xfig/importxfig.cpp
@@ -63,7 +63,7 @@ QImage XfigPlug::readThumbnail(const QString& fName)
 	docHeight = h - y;
 	progressDialog = nullptr;
 	m_Doc = new ScribusDoc();
-	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 	m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
 	m_Doc->addPage(0);
 	m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
@@ -303,7 +303,7 @@ bool XfigPlug::import(const QString& fNameIn, const TransactionSettings& trSetti
 	{
 		if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 		{
-			m_Doc = ScCore->primaryMainWindow()->doFileNew(b - x, h - y, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+			m_Doc = ScCore->primaryMainWindow()->doFileNew(b - x, h - y, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 			ScCore->primaryMainWindow()->HaveNewDoc();
 			ret = true;
 			baseX = 0;
@@ -1176,8 +1176,8 @@ void XfigPlug::processEllipse(const QString& data)
 		if (line_style > 0)
 			ite->setDashes(getDashValues(LineW, line_style));
 		ite->setTextFlowMode(PageItem::TextFlowDisabled);
-		AnchorPoint rot = m_Doc->rotationMode();
-		m_Doc->setRotationMode ( AnchorPoint::Center);
+		AnchorPoint rot = m_Doc->rotationMode();
+		m_Doc->setRotationMode ( AnchorPoint::Center);
 		m_Doc->rotateItem(-angle * 180.0 / M_PI, ite);
 		m_Doc->setRotationMode( rot);
 		depthMap.insert(999 - depth, currentItemNr);
diff --git a/scribus/plugins/import/xps/importxps.cpp b/scribus/plugins/import/xps/importxps.cpp
index 3861ce7..8331a0b 100644
--- a/scribus/plugins/import/xps/importxps.cpp
+++ b/scribus/plugins/import/xps/importxps.cpp
@@ -112,7 +112,7 @@ QImage XpsPlug::readThumbnail(const QString& fName)
 		docWidth = PrefsManager::instance().appPrefs.docSetupPrefs.pageWidth;
 		docHeight = PrefsManager::instance().appPrefs.docSetupPrefs.pageHeight;
 		m_Doc = new ScribusDoc();
-		m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+		m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 		m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
 		m_Doc->addPage(0);
 		m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
@@ -231,7 +231,7 @@ bool XpsPlug::import(const QString& fNameIn, const TransactionSettings& trSettin
 	{
 		if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 		{
-			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 			ScCore->primaryMainWindow()->HaveNewDoc();
 			ret = true;
 			baseX = 0;
diff --git a/scribus/plugins/import/zmf/importzmf.cpp b/scribus/plugins/import/zmf/importzmf.cpp
index 622fc01..cf63e63 100644
--- a/scribus/plugins/import/zmf/importzmf.cpp
+++ b/scribus/plugins/import/zmf/importzmf.cpp
@@ -53,7 +53,7 @@ QImage ZmfPlug::readThumbnail(const QString& fName)
 	docHeight = h;
 	progressDialog = nullptr;
 	m_Doc = new ScribusDoc();
-	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 	m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
 	m_Doc->addPage(0);
 	m_Doc->setGUI(false, ScCore->primaryMainWindow(), 0);
@@ -163,7 +163,7 @@ bool ZmfPlug::import(const QString& fNameIn, const TransactionSettings& trSettin
 	{
 		if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 		{
-			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 			ScCore->primaryMainWindow()->HaveNewDoc();
 			ret = true;
 			baseX = 0;
diff --git a/scribus/plugins/scriptplugin/cmddoc.cpp b/scribus/plugins/scriptplugin/cmddoc.cpp
index a36b0ff..7455c6d 100644
--- a/scribus/plugins/scriptplugin/cmddoc.cpp
+++ b/scribus/plugins/scriptplugin/cmddoc.cpp
@@ -71,7 +71,7 @@ PyObject *scribus_newdocument(PyObject* /* self */, PyObject* args)
 								// columnDistance, numberCols, autoframes,
 								0, 1, false,
 								pagesType, unit, firstPageOrder,
-								orientation, firstPageNr, "Custom", true, numPages);
+								orientation, firstPageNr, QSizeF(), true, numPages);
 	ScCore->primaryMainWindow()->doc->setPageSetFirstPage(pagesType, firstPageOrder);
 
 	return PyLong_FromLong(static_cast<long>(ret));
@@ -107,7 +107,7 @@ PyObject *scribus_newdoc(PyObject* /* self */, PyObject* args)
 	lr  = value2pts(lr, unit);
 	rr  = value2pts(rr, unit);
 	btr = value2pts(btr, unit);
-	bool ret = ScCore->primaryMainWindow()->doFileNew(b, h, tpr, lr, rr, btr, 0, 1, false, ds, unit, fsl, ori, fNr, "Custom", true);
+	bool ret = ScCore->primaryMainWindow()->doFileNew(b, h, tpr, lr, rr, btr, 0, 1, false, ds, unit, fsl, ori, fNr, QSizeF(), true);
 	//	qApp->processEvents();
 	return PyLong_FromLong(static_cast<long>(ret));
 }
diff --git a/scribus/plugins/shapes/shapepalette.cpp b/scribus/plugins/shapes/shapepalette.cpp
index 671d55a..f7cc703 100644
--- a/scribus/plugins/shapes/shapepalette.cpp
+++ b/scribus/plugins/shapes/shapepalette.cpp
@@ -217,7 +217,7 @@ void ShapeView::startDrag(Qt::DropActions supportedActions)
 		int w = shapes[key].width;
 		int h = shapes[key].height;
 		ScribusDoc *m_Doc = new ScribusDoc();
-		m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+		m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 		m_Doc->setPage(w, h, 0, 0, 0, 0, 0, 0, false, false);
 		m_Doc->addPage(0);
 		m_Doc->setGUI(false, scMW, nullptr);
diff --git a/scribus/prefsmanager.cpp b/scribus/prefsmanager.cpp
index eccd2aa..5aee556 100644
--- a/scribus/prefsmanager.cpp
+++ b/scribus/prefsmanager.cpp
@@ -1377,8 +1377,8 @@ bool PrefsManager::writePref(const QString& filePath)
 	deDocumentSetup.setAttribute("UnitIndex", appPrefs.docSetupPrefs.docUnitIndex);
 	deDocumentSetup.setAttribute("PageSize", appPrefs.docSetupPrefs.pageSize);
 	deDocumentSetup.setAttribute("PageOrientation", appPrefs.docSetupPrefs.pageOrientation);
-	deDocumentSetup.setAttribute("PageWidth", ScCLocale::toQStringC(appPrefs.docSetupPrefs.pageWidth));
-	deDocumentSetup.setAttribute("PageHeight", ScCLocale::toQStringC(appPrefs.docSetupPrefs.pageHeight));
+	deDocumentSetup.setAttribute("PageWidth", appPrefs.docSetupPrefs.pageWidth);
+	deDocumentSetup.setAttribute("PageHeight", appPrefs.docSetupPrefs.pageHeight);
 	deDocumentSetup.setAttribute("MarginTop", ScCLocale::toQStringC(appPrefs.docSetupPrefs.margins.top()));
 	deDocumentSetup.setAttribute("MarginBottom", ScCLocale::toQStringC(appPrefs.docSetupPrefs.margins.bottom()));
 	deDocumentSetup.setAttribute("MarginLeft", ScCLocale::toQStringC(appPrefs.docSetupPrefs.margins.left()));
@@ -2072,8 +2072,8 @@ bool PrefsManager::readPref(const QString& filePath)
 			PageSize ps( dc.attribute("PageSize", PageSize::defaultSizesList().at(1)) );
 			appPrefs.docSetupPrefs.pageSize = (ps.name() == CommonStrings::customPageSize ) ? PageSize::defaultSizesList().at(1) : ps.name();
 			appPrefs.docSetupPrefs.pageOrientation = dc.attribute("PageOrientation", "0").toInt();
-			appPrefs.docSetupPrefs.pageWidth   = ScCLocale::toDoubleC(dc.attribute("PageWidth"), 595.0);
-			appPrefs.docSetupPrefs.pageHeight  = ScCLocale::toDoubleC(dc.attribute("PageHeight"), 842.0);
+			appPrefs.docSetupPrefs.pageWidth   = ScCLocale::toDoubleC(dc.attribute("PageWidth"), mm2pts(210));
+			appPrefs.docSetupPrefs.pageHeight  = ScCLocale::toDoubleC(dc.attribute("PageHeight"), mm2pts(297));
 			appPrefs.docSetupPrefs.margins.setTop(ScCLocale::toDoubleC(dc.attribute("MarginTop"), 9.0));
 			appPrefs.docSetupPrefs.margins.setBottom(ScCLocale::toDoubleC(dc.attribute("MarginBottom"), 40.0));
 			appPrefs.docSetupPrefs.margins.setLeft(ScCLocale::toDoubleC(dc.attribute("MarginLeft"), 9.0));
diff --git a/scribus/sampleitem.cpp b/scribus/sampleitem.cpp
index 691994b..807b34f 100644
--- a/scribus/sampleitem.cpp
+++ b/scribus/sampleitem.cpp
@@ -28,7 +28,7 @@ SampleItem::SampleItem()
 	if (!m_Doc)
 		return;
 
-	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 	m_Doc->setPage(1, 1, 0, 0, 0, 0, 0, 0, false, false);
 	m_Doc->addPage(0);
 	m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
diff --git a/scribus/scpreview.cpp b/scribus/scpreview.cpp
index aaae572..af035a7 100644
--- a/scribus/scpreview.cpp
+++ b/scribus/scpreview.cpp
@@ -43,7 +43,7 @@ QImage ScPreview::createPreview(const QString& data)
 		}
 
 		ScribusDoc *m_Doc = new ScribusDoc();
-		m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+		m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 		m_Doc->setPage(gw, gh, 0, 0, 0, 0, 0, 0, false, false);
 		m_Doc->addPage(0);
 		m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
diff --git a/scribus/scribus.cpp b/scribus/scribus.cpp
index d892b72..ece5239 100644
--- a/scribus/scribus.cpp
+++ b/scribus/scribus.cpp
@@ -333,7 +333,7 @@ int ScribusMainWindow::initScMW(bool primaryMainWindow)
 	internalCopy = false;
 	internalCopyBuffer.clear();
 	m_doc = new ScribusDoc();
-	m_doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 	m_doc->setPage(100, 100, 0, 0, 0, 0, 0, 0, false, false);
 	m_doc->addPage(0);
 	m_doc->setGUI(false, this, nullptr);
@@ -2021,7 +2021,7 @@ void ScribusMainWindow::startUpDialog()
 			bool autoframes = dia->autoTextFrame->isChecked();
 			int orientation = dia->orientation();
 			int pageCount = dia->pageCountSpinBox->value();
-			QString pagesize = dia->pageSizeName();
+			QSizeF pagesize(dia->pageWidth(), dia->pageHeight());
 			doFileNew(pageWidth, pageHeight, topMargin, leftMargin, rightMargin, bottomMargin, columnDistance, numberCols, autoframes, facingPages, dia->unitOfMeasureComboBox->currentIndex(), firstPage, orientation, 1, pagesize, true, pageCount, true, dia->marginGroup->marginPreset());
 			doc->setPageSetFirstPage(facingPages, firstPage);
 			doc->bleeds()->set(dia->bleedTop(), dia->bleedLeft(), dia->bleedBottom(), dia->bleedRight());
@@ -2097,7 +2097,7 @@ bool ScribusMainWindow::slotFileNew()
 	bool autoframes = dia->autoTextFrame->isChecked();
 	int orientation = dia->orientation();
 	int pageCount = dia->pageCountSpinBox->value();
-	QString pagesize = dia->pageSizeName();
+	QSizeF pagesize(dia->pageWidth(), dia->pageHeight());
 
 	if (doFileNew(pageWidth, pageHeight, topMargin, leftMargin, rightMargin, bottomMargin, columnDistance, numberCols, autoframes, facingPages, dia->unitOfMeasureComboBox->currentIndex(), firstPage, orientation, 1, pagesize, true, pageCount, true, dia->marginGroup->marginPreset()))
 	{
@@ -2119,12 +2119,12 @@ bool ScribusMainWindow::slotFileNew()
 }
 
 //TODO move to core, assign doc to doc list, optionally create gui for it
-ScribusDoc *ScribusMainWindow::newDoc(double width, double height, double topMargin, double leftMargin, double rightMargin, double bottomMargin, double columnDistance, double columnCount, bool autoTextFrames, int pageArrangement, int unitIndex, int firstPageLocation, int orientation, int firstPageNumber, const QString& defaultPageSize, bool requiresGUI, int pageCount, bool showView, int marginPreset)
+ScribusDoc *ScribusMainWindow::newDoc(double width, double height, double topMargin, double leftMargin, double rightMargin, double bottomMargin, double columnDistance, double columnCount, bool autoTextFrames, int pageArrangement, int unitIndex, int firstPageLocation, int orientation, int firstPageNumber, QSizeF defaultPageSize, bool requiresGUI, int pageCount, bool showView, int marginPreset)
 {
 	return doFileNew(width, height, topMargin, leftMargin, rightMargin, bottomMargin, columnDistance, columnCount, autoTextFrames, pageArrangement, unitIndex, firstPageLocation, orientation, firstPageNumber, defaultPageSize, requiresGUI, pageCount, showView, marginPreset);
 }
 
-ScribusDoc *ScribusMainWindow::doFileNew(double width, double height, double topMargin, double leftMargin, double rightMargin, double bottomMargin, double columnDistance, double columnCount, bool autoTextFrames, int pageArrangement, int unitIndex, int firstPageLocation, int orientation, int firstPageNumber, const QString& defaultPageSize, bool requiresGUI, int pageCount, bool showView, int marginPreset)
+ScribusDoc *ScribusMainWindow::doFileNew(double width, double height, double topMargin, double leftMargin, double rightMargin, double bottomMargin, double columnDistance, double columnCount, bool autoTextFrames, int pageArrangement, int unitIndex, int firstPageLocation, int orientation, int firstPageNumber, QSizeF defaultPageSize, bool requiresGUI, int pageCount, bool showView, int marginPreset)
 {
 	if (HaveDoc)
 		outlinePalette->buildReopenVals();
@@ -8640,7 +8640,7 @@ void ScribusMainWindow::dropEvent ( QDropEvent * e)
 					ScriXmlDoc ss;
 					if (ss.readElemHeader(data, false, &gx, &gy, &gw, &gh))
 					{
-						doFileNew(gw, gh, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+						doFileNew(gw, gh, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 						HaveNewDoc();
 						doc->reformPages(true);
 						slotElemRead(data, doc->currentPage()->xOffset(), doc->currentPage()->yOffset(), false, false, doc, view);
@@ -8678,7 +8678,7 @@ void ScribusMainWindow::dropEvent ( QDropEvent * e)
 				ScriXmlDoc ss;
 				if (ss.readElemHeader(text, false, &gx, &gy, &gw, &gh))
 				{
-					doFileNew(gw, gh, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+					doFileNew(gw, gh, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 					HaveNewDoc();
 					doc->reformPages(true);
 					slotElemRead(text, doc->currentPage()->xOffset(), doc->currentPage()->yOffset(), false, false, doc, view);
@@ -9192,7 +9192,7 @@ void ScribusMainWindow::manageColorsAndFills()
 			if (fmt)
 			{
 				ScribusDoc *s_doc = new ScribusDoc();
-				s_doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+				s_doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 				s_doc->setPage(100, 100, 0, 0, 0, 0, 0, 0, false, false);
 				s_doc->addPage(0);
 				s_doc->setGUI(false, this, nullptr);
diff --git a/scribus/scribus.h b/scribus/scribus.h
index 566c4eb..7102ea0 100644
--- a/scribus/scribus.h
+++ b/scribus/scribus.h
@@ -152,8 +152,8 @@ public:
 	inline bool scriptIsRunning(void) const { return (m_ScriptRunning > 0); }
 	inline void setScriptRunning(bool value) { m_ScriptRunning += (value ? 1 : -1); }
 
-	ScribusDoc* doFileNew(double width, double height, double topMargin, double leftMargin, double rightMargin, double bottomMargin, double columnDistance, double columnCount, bool autoTextFrames, int pageArrangement, int unitIndex, int firstPageLocation, int orientation, int firstPageNumber, const QString& defaultPageSize, bool requiresGUI, int pageCount = 1, bool showView = true, int marginPreset = 0);
-	ScribusDoc* newDoc(double width, double height, double topMargin, double leftMargin, double rightMargin, double bottomMargin, double columnDistance, double columnCount, bool autoTextFrames, int pageArrangement, int unitIndex, int firstPageLocation, int orientation, int firstPageNumber, const QString& defaultPageSize, bool requiresGUI, int pageCount = 1, bool showView = true, int marginPreset = 0);
+	ScribusDoc* doFileNew(double width, double height, double topMargin, double leftMargin, double rightMargin, double bottomMargin, double columnDistance, double columnCount, bool autoTextFrames, int pageArrangement, int unitIndex, int firstPageLocation, int orientation, int firstPageNumber, QSizeF defaultPageSize, bool requiresGUI, int pageCount = 1, bool showView = true, int marginPreset = 0);
+	ScribusDoc* newDoc(double width, double height, double topMargin, double leftMargin, double rightMargin, double bottomMargin, double columnDistance, double columnCount, bool autoTextFrames, int pageArrangement, int unitIndex, int firstPageLocation, int orientation, int firstPageNumber, QSizeF defaultPageSize, bool requiresGUI, int pageCount = 1, bool showView = true, int marginPreset = 0);
 	bool DoFileSave(const QString& fileName, QString* savedFileName = nullptr, uint formatID = FORMATID_CURRENTEXPORT);
 
 	void changeEvent(QEvent *e) override;
diff --git a/scribus/scribusdoc.cpp b/scribus/scribusdoc.cpp
index c885c92..35c5d35 100644
--- a/scribus/scribusdoc.cpp
+++ b/scribus/scribusdoc.cpp
@@ -678,12 +678,13 @@ QList<PageItem*> *ScribusDoc::parentGroup(PageItem* item, QList<PageItem*> *list
 	return retList;
 }
 
-void ScribusDoc::setup(int unitIndex, int fp, int firstLeft, int orientation, int firstPageNumber, const QString& defaultPageSize, const QString& documentName)
+void ScribusDoc::setup(int unitIndex, int fp, int firstLeft, int orientation, int firstPageNumber, QSizeF pageSize, const QString& documentName)
 {
 	m_docPrefsData.docSetupPrefs.docUnitIndex = unitIndex;
 	setPageSetFirstPage(fp, firstLeft);
 	m_docPrefsData.docSetupPrefs.pageOrientation = orientation;
-	m_docPrefsData.docSetupPrefs.pageSize = defaultPageSize;
+	PageSize ps(pageSize.width(), pageSize.height());
+	m_docPrefsData.docSetupPrefs.pageSize = ps.name();
 	FirstPnum = firstPageNumber;
 	m_docPrefsData.docSetupPrefs.pagePositioning = fp;
 	setDocumentFileName(documentName);
diff --git a/scribus/scribusdoc.h b/scribus/scribusdoc.h
index 14d2874..af8db19 100644
--- a/scribus/scribusdoc.h
+++ b/scribus/scribusdoc.h
@@ -105,7 +105,7 @@ public:
 	bool inASpecialEditMode() const;
 	QList<PageItem*> getAllItems(const QList<PageItem*> &items) const;
 	QList<PageItem*> *parentGroup(PageItem* item, QList<PageItem*> *list);
-	void setup(int, int, int, int, int, const QString&, const QString&);
+	void setup(int, int, int, int, int, QSizeF pageSize, const QString&);
 	void setLoading(bool);
 	bool isLoading() const;
 	void setModified(bool);
@@ -220,10 +220,10 @@ public:
 
 	double pageHeight() const { return m_docPrefsData.docSetupPrefs.pageHeight; }
 	double pageWidth() const { return m_docPrefsData.docSetupPrefs.pageWidth; }
-	const QString& pageSize() const { return m_docPrefsData.docSetupPrefs.pageSize; }
+	const QString& pageSize() const { return m_docPrefsData.docSetupPrefs.pageSize; } // legacy support for < 1.7.1
 	void setPageHeight(double h) { m_docPrefsData.docSetupPrefs.pageHeight = h; }
 	void setPageWidth(double w) { m_docPrefsData.docSetupPrefs.pageWidth = w; }
-	void setPageSize(const QString& s) { m_docPrefsData.docSetupPrefs.pageSize = s; }
+	void setPageSize(const QString& s) { m_docPrefsData.docSetupPrefs.pageSize = s; } // legacy support for < 1.7.1
 
 	int marginPreset() const { return m_docPrefsData.docSetupPrefs.marginPreset; }
 	void setMarginPreset(int mp) { m_docPrefsData.docSetupPrefs.marginPreset = mp; }
diff --git a/scribus/ui/colorsandfills.cpp b/scribus/ui/colorsandfills.cpp
index 85b5377..196044f 100644
--- a/scribus/ui/colorsandfills.cpp
+++ b/scribus/ui/colorsandfills.cpp
@@ -1951,7 +1951,7 @@ void ColorsAndFillsDialog::doSaveDefaults(const QString& name, bool changed)
 	if (fmt)
 	{
 		std::unique_ptr<ScribusDoc> s_doc(new ScribusDoc());
-		s_doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+		s_doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 		s_doc->setPage(100, 100, 0, 0, 0, 0, 0, 0, false, false);
 		s_doc->addPage(0);
 		s_doc->setGUI(false, mainWin, nullptr);
diff --git a/scribus/ui/inspage.cpp b/scribus/ui/inspage.cpp
index cd9d652..ac60517 100644
--- a/scribus/ui/inspage.cpp
+++ b/scribus/ui/inspage.cpp
@@ -248,7 +248,7 @@ InsPage::InsPage( QWidget* parent, ScribusDoc* currentDoc, int currentPage, int
 	textLabel1 = new QLabel( tr( "&Size:" ), dsGroupBox7);
 	dsGroupBox7Layout->addWidget(textLabel1, 0, 0, Qt::AlignTop | Qt::AlignRight);
 	pageSizeSelector = new PageSizeSelector(dsGroupBox7);
-	pageSizeSelector->setPageSize(m_doc->pageSize());
+	pageSizeSelector->setPageSize(m_doc->pageWidth(), pageHeight());
 	textLabel1->setBuddy(pageSizeSelector);
 	dsGroupBox7Layout->addWidget(pageSizeSelector, 0, 1);
 	textLabel2 = new QLabel( tr( "Orie&ntation:" ), dsGroupBox7);
diff --git a/scribus/ui/newdocdialog.cpp b/scribus/ui/newdocdialog.cpp
index 3b0486d..c71ef70 100644
--- a/scribus/ui/newdocdialog.cpp
+++ b/scribus/ui/newdocdialog.cpp
@@ -133,7 +133,6 @@ void NewDocDialog::createNewDocPage()
 {
 	int orientation = prefsManager.appPrefs.docSetupPrefs.pageOrientation;
 	int pagePositioning = prefsManager.appPrefs.docSetupPrefs.pagePositioning;
-	QString pageSize = prefsManager.appPrefs.docSetupPrefs.pageSize;
 	double pageHeight = prefsManager.appPrefs.docSetupPrefs.pageHeight;
 	double pageWidth = prefsManager.appPrefs.docSetupPrefs.pageWidth;
 
@@ -165,11 +164,11 @@ void NewDocDialog::createNewDocPage()
 		pageLayoutButtons->button(2)->setChecked(true);
 	}
 
-	listPageFormats->setValues(pageSize, orientation, PageSizeInfo::Preferred, PageSizeList::NameAsc);
+	listPageFormats->setValues(QSizeF(pageWidth, pageHeight), orientation, PageSizeInfo::Preferred, PageSizeList::NameAsc);
 
 	pageSizeSelector->setHasFormatSelector(false);
 	pageSizeSelector->setHasCustom(false);
-	pageSizeSelector->setPageSize(pageSize);
+	pageSizeSelector->setPageSize(pageWidth, pageHeight);
 	pageSizeSelector->setCurrentCategory(PageSizeInfo::Preferred);
 
 	widthSpinBox->setMinimum(pts2value(1.0, m_unitIndex));
@@ -194,7 +193,6 @@ void NewDocDialog::createNewDocPage()
 	marginGroup->setPageHeight(pageHeight);
 	marginGroup->setPageWidth(pageWidth);
 	marginGroup->setFacingPages(!(pagePositioning == singlePage));
-	marginGroup->setPageSize(pageSize);
 	marginGroup->setMarginPreset(prefsManager.appPrefs.docSetupPrefs.marginPreset);
 
 	MarginStruct bleed;
@@ -204,7 +202,6 @@ void NewDocDialog::createNewDocPage()
 	bleedGroup->setPageHeight(pageHeight);
 	bleedGroup->setPageWidth(pageWidth);
 	bleedGroup->setFacingPages(!(pagePositioning == singlePage));
-	bleedGroup->setPageSize(pageSize);
 	bleedGroup->setMarginPreset(prefsManager.appPrefs.docSetupPrefs.marginPreset);
 
 	pageCountSpinBox->setMaximum( 10000 );
@@ -214,7 +211,7 @@ void NewDocDialog::createNewDocPage()
 	pageCountLabel->setPixmap(iconManager.loadPixmap("panel-page"));
 
 	setDocLayout(pagePositioning);
-	setSize(pageSize);
+	setSize(QSizeF(pageWidth, pageHeight));
 	setOrientation(orientation);
 
 	numberOfCols->setButtonSymbols( QSpinBox::UpDownArrows );
@@ -341,8 +338,8 @@ void NewDocDialog::setWidth(double)
 	marginGroup->setPageWidth(m_pageWidth);
 	bleedGroup->setPageWidth(m_pageWidth);
 	listPageFormats->clearSelection();
-	m_pageSize = CommonStrings::customPageSize;
-	pagePreview->setPage(m_pageHeight, m_pageWidth, marginGroup->margins(), bleedGroup->margins(), m_pageSize, m_choosenLayout, m_layoutFirstPage);
+	listPageFormats->setDimensions(m_pageWidth, m_pageHeight);
+	pagePreview->setPage(m_pageHeight, m_pageWidth, marginGroup->margins(), bleedGroup->margins(), m_choosenLayout, m_layoutFirstPage);
 
 	int newOrientation = (widthSpinBox->value() > heightSpinBox->value()) ? landscapePage : portraitPage;
 	if (newOrientation != m_orientation)
@@ -363,8 +360,8 @@ void NewDocDialog::setHeight(double)
 	marginGroup->setPageHeight(m_pageHeight);
 	bleedGroup->setPageHeight(m_pageHeight);	
 	listPageFormats->clearSelection();
-	m_pageSize = CommonStrings::customPageSize;
-	pagePreview->setPage(m_pageHeight, m_pageWidth, marginGroup->margins(), bleedGroup->margins(), m_pageSize, m_choosenLayout, m_layoutFirstPage);
+	listPageFormats->setDimensions(m_pageWidth, m_pageHeight);
+	pagePreview->setPage(m_pageHeight, m_pageWidth, marginGroup->margins(), bleedGroup->margins(), m_choosenLayout, m_layoutFirstPage);
 
 	int newOrientation = (widthSpinBox->value() > heightSpinBox->value()) ? landscapePage : portraitPage;
 	if (newOrientation != m_orientation)
@@ -381,10 +378,11 @@ void NewDocDialog::setHeight(double)
 void NewDocDialog::changePageSize(const QModelIndex &ic)
 {
 	int unit = ic.data(PageSizeList::Unit).toInt();
-	QString sizeName = ic.data(PageSizeList::Name).toString();
+	double width = ic.data(PageSizeList::Width).toDouble();
+	double height = ic.data(PageSizeList::Height).toDouble();
 
 	setUnit(unit);
-	setPageSize(sizeName);
+	setPageSize(QSizeF(width, height));
 
 	QSignalBlocker sig(unitOfMeasureComboBox);
 	unitOfMeasureComboBox->setCurrentIndex(unit);
@@ -504,7 +502,9 @@ void NewDocDialog::setOrientation(int ori)
 		heightSpinBox->setValue((ori == portraitPage) ? qMax(w, h) : qMin(w, h));
 		m_pageWidth  = (ori == portraitPage) ? qMin(pw, ph) : qMax(pw, ph);
 		m_pageHeight = (ori == portraitPage) ? qMax(pw, ph) : qMin(pw, ph);
-		listPageFormats->setOrientation(ori);
+		// listPageFormats->setDimensions(pw, ph);
+		// listPageFormats->setOrientation(ori);
+		listPageFormats->setValues(QSizeF(pw, ph), ori, listPageFormats->category(), listPageFormats->sortMode());
 	}
 	// #869 pv - defined constants added + code repeat (check w/h)
 	(ori == portraitPage) ? m_orientation = portraitPage : m_orientation = landscapePage;
@@ -513,7 +513,7 @@ void NewDocDialog::setOrientation(int ori)
 	marginGroup->setPageWidth(m_pageWidth);
 	bleedGroup->setPageHeight(m_pageHeight);
 	bleedGroup->setPageWidth(m_pageWidth);
-	pagePreview->setPage(m_pageHeight, m_pageWidth, marginGroup->margins(), bleedGroup->margins(), m_pageSize, m_choosenLayout, m_layoutFirstPage);
+	pagePreview->setPage(m_pageHeight, m_pageWidth, marginGroup->margins(), bleedGroup->margins(), m_choosenLayout, m_layoutFirstPage);
 
 	connect(widthSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setWidth(double)));
 	connect(heightSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setHeight(double)));
@@ -539,43 +539,37 @@ void NewDocDialog::setLayout(int layoutId)
 	}
 }
 
-void NewDocDialog::setPageSize(const QString &size)
+void NewDocDialog::setPageSize(QSizeF size)
 {
 	setSize(size);
-
-	if (size != CommonStrings::customPageSize)
-		setOrientation(pageOrientationButtons->checkedId());
-
-	marginGroup->setPageSize(size);
-	bleedGroup->setPageSize(size);
-
+	setOrientation(pageOrientationButtons->checkedId());
 }
 
-void NewDocDialog::setSize(const QString& gr)
+void NewDocDialog::setSize(QSizeF size)
 {
 	m_pageWidth = widthSpinBox->value() / m_unitRatio;
 	m_pageHeight = heightSpinBox->value() / m_unitRatio;
-	m_pageSize = gr;
+
+	PageSize ps(size.width(), size.height());
 
 	disconnect(widthSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setWidth(double)));
 	disconnect(heightSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setHeight(double)));
-	if (m_pageSize == CommonStrings::trCustomPageSize || m_pageSize == CommonStrings::customPageSize)
+	if (ps.name() == CommonStrings::customPageSize)
 	{
 		widthSpinBox->setEnabled(true);
 		heightSpinBox->setEnabled(true);
 	}
 	else
 	{
-		PageSize ps2(m_pageSize);
 		if (pageOrientationButtons->checkedId() == portraitPage)
 		{
-			m_pageWidth = ps2.width();
-			m_pageHeight = ps2.height();
+			m_pageWidth = ps.width();
+			m_pageHeight = ps.height();
 		}
 		else
 		{
-			m_pageWidth = ps2.height();
-			m_pageHeight = ps2.width();
+			m_pageWidth = ps.height();
+			m_pageHeight = ps.width();
 		}
 	}
 	widthSpinBox->setValue(m_pageWidth * m_unitRatio);
@@ -584,7 +578,7 @@ void NewDocDialog::setSize(const QString& gr)
 	marginGroup->setPageWidth(m_pageWidth);
 	bleedGroup->setPageHeight(m_pageHeight);
 	bleedGroup->setPageWidth(m_pageWidth);
-	pagePreview->setPage(m_pageHeight, m_pageWidth, marginGroup->margins(), bleedGroup->margins(), m_pageSize, m_choosenLayout, m_layoutFirstPage);
+	pagePreview->setPage(m_pageHeight, m_pageWidth, marginGroup->margins(), bleedGroup->margins(), m_choosenLayout, m_layoutFirstPage);
 
 	connect(widthSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setWidth(double)));
 	connect(heightSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setHeight(double)));
@@ -597,7 +591,7 @@ void NewDocDialog::setDocLayout(int layout)
 	bleedGroup->setFacingPages(layout != singlePage);
 	m_choosenLayout = layout;
 	m_layoutFirstPage = prefsManager.appPrefs.pageSets[m_choosenLayout].FirstPage;
-	pagePreview->setPage(m_pageHeight, m_pageWidth, marginGroup->margins(), bleedGroup->margins(), m_pageSize, m_choosenLayout, m_layoutFirstPage);
+	pagePreview->setPage(m_pageHeight, m_pageWidth, marginGroup->margins(), bleedGroup->margins(), m_choosenLayout, m_layoutFirstPage);
 }
 
 void NewDocDialog::setDocFirstPage(int firstPage)
@@ -694,6 +688,5 @@ void NewDocDialog::changeCategory(PageSizeInfo::Category category)
 	if (listPageFormats->category() == category)
 		return;
 
-	listPageFormats->setFormat(m_pageSize);
-	listPageFormats->setCategory(category);
+	listPageFormats->setValues(QSizeF(m_pageWidth, m_pageHeight), listPageFormats->orientation(), category, listPageFormats->sortMode());
 }
diff --git a/scribus/ui/newdocdialog.h b/scribus/ui/newdocdialog.h
index a65550f..50e9c95 100644
--- a/scribus/ui/newdocdialog.h
+++ b/scribus/ui/newdocdialog.h
@@ -61,8 +61,7 @@ public:
 	void createNewDocPage();
 	void createOpenDocPage();
 	void createRecentDocPage();
-	void setSize(const QString& gr);
-	QString pageSizeName() const { return m_pageSize; };
+	void setSize(QSizeF size);
 
 	QFileDialog *fileDialog {nullptr};
 
@@ -94,7 +93,7 @@ public slots:
 	void ExitOK();
 	void setOrientation(int ori);
 	void setLayout(int layoutId);
-	void setPageSize(const QString &);
+	void setPageSize(QSizeF size);
 	void setDocLayout(int layout);
 	void setDocFirstPage(int firstPage);
 	/*! Opens document on doubleclick
@@ -132,7 +131,6 @@ protected:
 	double m_distance { 11.0 };
 	QString m_unitSuffix;
 	QString m_selectedFile;
-	QString m_pageSize;
 	int m_unitIndex { 0 };
 	int m_tabSelected { 0 };
 	bool m_onStartup { false };
diff --git a/scribus/ui/newmarginwidget.cpp b/scribus/ui/newmarginwidget.cpp
index deffc8f..43144ea 100644
--- a/scribus/ui/newmarginwidget.cpp
+++ b/scribus/ui/newmarginwidget.cpp
@@ -7,11 +7,12 @@ for which a new license (GPL+exception) is in place.
 
 #include "newmarginwidget.h"
 #include "iconmanager.h"
+#include "pagesize.h"
+#include "scribusapp.h"
 #include "scrspinbox.h"
-#include "units.h"
 #include "ui/marginpresetlayout.h"
 #include "ui/useprintermarginsdialog.h"
-#include "scribusapp.h"
+#include "units.h"
 
 NewMarginWidget::NewMarginWidget(QWidget* parent)
 	: QWidget(parent)
@@ -314,12 +315,6 @@ void NewMarginWidget::setPreset()
 	emit marginChanged(m_marginData);
 }
 
-void NewMarginWidget::setPageSize(const QString& pageSize)
-{
-	m_pageSize = pageSize;
-}
-
-
 void NewMarginWidget::updateMarginSpinValues()
 {
 	QSignalBlocker leftBlocked(leftMarginSpinBox);
@@ -424,7 +419,9 @@ void NewMarginWidget::setFacingPages(bool facing, int pageType)
 void NewMarginWidget::setMarginsToPrinterMargins()
 {
 	QSizeF pageDimensions(m_pageWidth, m_pageHeight);
-	UsePrinterMarginsDialog upm(parentWidget(), pageDimensions, m_pageSize, unitGetRatioFromIndex(m_unitIndex), unitGetSuffixFromIndex(m_unitIndex));
+	PageSize ps(m_pageWidth, m_pageHeight);
+
+	UsePrinterMarginsDialog upm(parentWidget(), pageDimensions, ps.nameTR(), unitGetRatioFromIndex(m_unitIndex), unitGetSuffixFromIndex(m_unitIndex));
 	if (upm.exec() != QDialog::Accepted)
 		return;
 
diff --git a/scribus/ui/newmarginwidget.h b/scribus/ui/newmarginwidget.h
index df098d2..7c45b85 100644
--- a/scribus/ui/newmarginwidget.h
+++ b/scribus/ui/newmarginwidget.h
@@ -36,8 +36,6 @@ class SCRIBUS_API NewMarginWidget : public QWidget, Ui::NewMarginWidget
 		void setPageWidth(double);
 		/*! \brief Setup the spinboxes properties (min/max value etc.) by height */
 		void setPageHeight(double);
-		/*! \brief Set the page size for margin getting from cups */
-		void setPageSize(const QString&);
 		void setNewUnit(int unitIndex);
 		void setNewValues(const MarginStruct& margs);
 		/*! \brief Setup the presetCombo without changing the margin values, only used by tabdocument */
@@ -67,7 +65,6 @@ class SCRIBUS_API NewMarginWidget : public QWidget, Ui::NewMarginWidget
 
 		MarginStruct m_marginData;
 		MarginStruct m_savedMarginData;
-		QString m_pageSize;
 		bool   m_facingPages {false};
 		bool   m_isSingle {false};
 		double m_pageHeight {0.0};
diff --git a/scribus/ui/pagepropertiesdialog.cpp b/scribus/ui/pagepropertiesdialog.cpp
index 32f5216..2fbde75 100644
--- a/scribus/ui/pagepropertiesdialog.cpp
+++ b/scribus/ui/pagepropertiesdialog.cpp
@@ -59,7 +59,7 @@ PagePropertiesDialog::PagePropertiesDialog( QWidget* parent, ScribusDoc* doc )
 	TextLabel1 = new QLabel( tr( "&Size:" ), dsGroupBox7 );
 	dsGroupBox7Layout->addWidget( TextLabel1, 0, 0, Qt::AlignTop | Qt::AlignRight);
 	pageSizeSelector = new PageSizeSelector(dsGroupBox7);
-	pageSizeSelector->setPageSize(doc->currentPage()->size());
+	pageSizeSelector->setPageSize(doc->currentPage()->width(), doc->currentPage()->height());
 	TextLabel1->setBuddy(pageSizeSelector);
 	dsGroupBox7Layout->addWidget(pageSizeSelector, 0, 1);
 	TextLabel2 = new QLabel( tr( "Orie&ntation:" ), dsGroupBox7 );
@@ -249,7 +249,6 @@ void PagePropertiesDialog::setSize(const QString & gr)
 	heightSpinBox->setValue(m_pageHeight * m_unitRatio);
 	marginWidget->setPageHeight(m_pageHeight);
 	marginWidget->setPageWidth(m_pageWidth);
-	marginWidget->setPageSize(gr);
 	connect(widthSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setPageWidth(double)));
 	connect(heightSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setPageHeight(double)));
 }
diff --git a/scribus/ui/prefs_documentsetup.cpp b/scribus/ui/prefs_documentsetup.cpp
index f5fc66b..f0dee06 100644
--- a/scribus/ui/prefs_documentsetup.cpp
+++ b/scribus/ui/prefs_documentsetup.cpp
@@ -184,12 +184,10 @@ void Prefs_DocumentSetup::restoreDefaults(struct ApplicationPrefs *prefsData)
 	marginsWidget->setup(prefsData->docSetupPrefs.margins, prefsData->docSetupPrefs.pagePositioning, prefsData->docSetupPrefs.docUnitIndex, NewMarginWidget::MarginWidgetFlags);
 	marginsWidget->setPageWidth(prefsData->docSetupPrefs.pageWidth);
 	marginsWidget->setPageHeight(prefsData->docSetupPrefs.pageHeight);
-//	marginsWidget->setPageSize(prefsPageSizeName);
 	marginsWidget->setMarginPreset(prefsData->docSetupPrefs.marginPreset);
 	bleedsWidget->setup(prefsData->docSetupPrefs.bleeds, prefsData->docSetupPrefs.pagePositioning, prefsData->docSetupPrefs.docUnitIndex, NewMarginWidget::BleedWidgetFlags);
 	bleedsWidget->setPageWidth(prefsData->docSetupPrefs.pageWidth);
 	bleedsWidget->setPageHeight(prefsData->docSetupPrefs.pageHeight);
-//	bleedsWidget->setPageSize(prefsPageSizeName);
 	bleedsWidget->setMarginPreset(prefsData->docSetupPrefs.marginPreset);
 	saveCompressedCheckBox->setChecked(prefsData->docSetupPrefs.saveCompressed);
 	emergencyCheckBox->setChecked(prefsData->miscPrefs.saveEmergencyFile);
@@ -271,21 +269,12 @@ void Prefs_DocumentSetup::setupPageSets()
 
 void Prefs_DocumentSetup::setupPageSizes(struct ApplicationPrefs *prefsData)
 {
-	prefsPageSizeName = prefsData->docSetupPrefs.pageSize;
+	double width = prefsData->docSetupPrefs.pageWidth;
+	double height = prefsData->docSetupPrefs.pageHeight;
 
-	PageSize ps(prefsPageSizeName);
+	pageSizeSelector->setPageSize(width, height);
+	prefsPageSizeName = pageSizeSelector->pageSize();
 
-	// try to find coresponding page size by dimensions
-	if (ps.name() == CommonStrings::customPageSize)
-	{
-		PageSizeInfoMap pages = ps.sizesByDimensions(QSize(prefsData->docSetupPrefs.pageWidth, prefsData->docSetupPrefs.pageHeight));
-		if (pages.count() > 0)
-			prefsPageSizeName = pages.firstKey();
-	}
-
-	pageSizeSelector->setPageSize(prefsPageSizeName);
-	marginsWidget->setPageSize(prefsPageSizeName);
-	bleedsWidget->setPageSize(prefsPageSizeName);
 }
 
 void Prefs_DocumentSetup::pageLayoutChanged(int i)
@@ -299,9 +288,9 @@ void Prefs_DocumentSetup::setPageWidth(double w)
 {
 	pageW = pageWidthSpinBox->value() / unitRatio;
 	marginsWidget->setPageWidth(pageW);
-	QString psText = pageSizeSelector->pageSizeTR();
-	if (psText != CommonStrings::trCustomPageSize && psText != CommonStrings::customPageSize)
-		pageSizeSelector->setPageSize(CommonStrings::customPageSize);
+
+	pageSizeSelector->setPageSize(pageW, pageH);
+
 	int newOrientation = (pageWidthSpinBox->value() > pageHeightSpinBox->value()) ? landscapePage : portraitPage;
 	if (newOrientation != pageOrientationComboBox->currentIndex())
 	{
@@ -315,9 +304,9 @@ void Prefs_DocumentSetup::setPageHeight(double h)
 {
 	pageH = pageHeightSpinBox->value() / unitRatio;
 	marginsWidget->setPageHeight(pageH);
-	QString psText = pageSizeSelector->pageSizeTR();
-	if (psText != CommonStrings::trCustomPageSize && psText != CommonStrings::customPageSize)
-		pageSizeSelector->setPageSize(CommonStrings::customPageSize);
+
+	pageSizeSelector->setPageSize(pageW, pageH);
+
 	int newOrientation = (pageWidthSpinBox->value() > pageHeightSpinBox->value()) ? landscapePage : portraitPage;
 	if (newOrientation != pageOrientationComboBox->currentIndex())
 	{
@@ -370,7 +359,6 @@ void Prefs_DocumentSetup::setSize(const QString &newSize)
 	pageHeightSpinBox->setValue(pageH * unitRatio);
 	marginsWidget->setPageHeight(pageH);
 	marginsWidget->setPageWidth(pageW);
-	marginsWidget->setPageSize(newSize);
 	pageWidthSpinBox->blockSignals(false);
 	pageHeightSpinBox->blockSignals(false);
 }
diff --git a/scribus/ui/prefs_pdfexport.cpp b/scribus/ui/prefs_pdfexport.cpp
index abe3fcf..8734921 100644
--- a/scribus/ui/prefs_pdfexport.cpp
+++ b/scribus/ui/prefs_pdfexport.cpp
@@ -413,7 +413,6 @@ void Prefs_PDFExport::restoreDefaults(struct ApplicationPrefs *prefsData, const
 	bleedsWidget->setup(prefsData->pdfPrefs.bleeds, prefsData->docSetupPrefs.pagePositioning, prefsData->docSetupPrefs.docUnitIndex, NewMarginWidget::BleedWidgetFlags);
 	bleedsWidget->setPageWidth(prefsData->docSetupPrefs.pageWidth);
 	bleedsWidget->setPageHeight(prefsData->docSetupPrefs.pageHeight);
-	bleedsWidget->setPageSize(prefsData->docSetupPrefs.pageSize);
 	bleedsWidget->setMarginPreset(prefsData->docSetupPrefs.marginPreset);
 //
 	useCustomRenderingCheckBox->setChecked(prefsData->pdfPrefs.UseLPI);
diff --git a/scribus/ui/widgets/pagesizelist.cpp b/scribus/ui/widgets/pagesizelist.cpp
index cf40f71..1226c12 100644
--- a/scribus/ui/widgets/pagesizelist.cpp
+++ b/scribus/ui/widgets/pagesizelist.cpp
@@ -39,23 +39,23 @@ PageSizeList::PageSizeList(QWidget* parent) :
 	setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
 }
 
-void PageSizeList::setFormat(QString format)
+void PageSizeList::setDimensions(double width, double height)
 {
-	loadPageSizes(format, m_orientation, m_category);
-	m_name = format;
+	loadPageSizes(QSizeF(width, height), m_orientation, m_category);
+	m_dimensions = QSizeF(width, height);
 	setSortMode(m_sortMode);
 }
 
 void PageSizeList::setOrientation(int orientation)
 {
-	loadPageSizes(m_name, orientation, m_category);
+	loadPageSizes(m_dimensions, orientation, m_category);
 	m_orientation = orientation;
 	setSortMode(m_sortMode);
 }
 
 void PageSizeList::setCategory(PageSizeInfo::Category category)
 {
-	loadPageSizes(m_name, m_orientation, category);
+	loadPageSizes(m_dimensions, m_orientation, category);
 	m_category = category;
 	setSortMode(m_sortMode);
 }
@@ -87,21 +87,21 @@ void PageSizeList::setSortMode(SortMode sortMode)
 	}
 }
 
-void PageSizeList::setValues(QString format, int orientation, PageSizeInfo::Category category, SortMode sortMode)
+void PageSizeList::setValues(QSizeF dimensions, int orientation, PageSizeInfo::Category category, SortMode sortMode)
 {
-	loadPageSizes(format, orientation, category);
-	m_name = format;
+	loadPageSizes(dimensions, orientation, category);
+	m_dimensions = dimensions;
 	m_orientation = orientation;
 	m_category = category;
 	setSortMode(sortMode);
 }
 
-void PageSizeList::loadPageSizes(QString name, int orientation, PageSizeInfo::Category category)
+void PageSizeList::loadPageSizes(QSizeF dimensions, int orientation, PageSizeInfo::Category category)
 {
 	QSignalBlocker sig(this);
 
-	PageSize ps(name);
-	PageSize pref(PrefsManager::instance().appPrefs.docSetupPrefs.pageSize);
+	PageSize pref(PrefsManager::instance().appPrefs.docSetupPrefs.pageWidth, PrefsManager::instance().appPrefs.docSetupPrefs.pageHeight);
+	PageSize ps(dimensions.width(), dimensions.height());
 
 	int sel = -1;
 
@@ -109,8 +109,9 @@ void PageSizeList::loadPageSizes(QString name, int orientation, PageSizeInfo::Ca
 	m_model->setSortRole(ItemData::Name);
 	m_model->sort(0, Qt::AscendingOrder);
 
-	if (m_category == category && this->selectionModel()->currentIndex().isValid())
-		sel = this->selectionModel()->currentIndex().row();
+	// enable if list selection should be remembered
+	// if (m_category == category && this->selectionModel()->currentIndex().isValid())
+	// 	sel = this->selectionModel()->currentIndex().row();
 
 	m_model->clear();
 
@@ -134,10 +135,14 @@ void PageSizeList::loadPageSizes(QString name, int orientation, PageSizeInfo::Ca
 			itemA->setData(QVariant(item.category), ItemData::Category);
 			itemA->setData(QVariant(item.sizeName), ItemData::Name);
 			itemA->setData(QVariant(item.width * item.height), ItemData::Dimension);
+			itemA->setData(QVariant(item.width), ItemData::Width);
+			itemA->setData(QVariant(item.height), ItemData::Height);
 			m_model->appendRow(itemA);
 
-			if (sel == -1 && item.sizeName == ps.name())
+			// select item with name match OR equal size
+			if (sel == -1 && (item.sizeName == ps.name() || (item.width == ps.width() && item.height == ps.height())))
 				sel = itemA->row();
+
 		}
 	}
 
diff --git a/scribus/ui/widgets/pagesizelist.h b/scribus/ui/widgets/pagesizelist.h
index 8f2bd8b..065c33f 100644
--- a/scribus/ui/widgets/pagesizelist.h
+++ b/scribus/ui/widgets/pagesizelist.h
@@ -33,13 +33,14 @@ public:
 		Category = Qt::UserRole + 2,
 		Name = Qt::UserRole + 3,
 		Dimension = Qt::UserRole + 4,
+		Width = Qt::UserRole + 5,
+		Height = Qt::UserRole + 6
 	};
 
 	PageSizeList(QWidget* parent);
 	~PageSizeList() = default;
 
-	void setFormat(QString format);
-	const QString& format() const { return m_name; };
+	void setDimensions(double width, double height);
 
 	void setOrientation(int orientation);
 	int orientation() const { return m_orientation; };
@@ -50,19 +51,19 @@ public:
 	void setSortMode(SortMode sortMode);
 	SortMode sortMode() const { return m_sortMode; };
 
-	void setValues(QString format, int orientation, PageSizeInfo::Category category, SortMode sortMode);
+	void setValues(QSizeF dimensions, int orientation, PageSizeInfo::Category category, SortMode sortMode);
 
 	void updateGeometries() override;
 
 private:
-	QString m_name {PageSize::defaultSizesList().at(1)};
+	QSizeF m_dimensions;
 	int m_orientation {0};
 	PageSizeInfo::Category m_category {PageSizeInfo::Preferred};
 	SortMode m_sortMode {SortMode::NameAsc};
 	QStandardItemModel* m_model { nullptr };
 
 	QIcon sizePreview(QSize iconSize, QSize pageSize) const;
-	void loadPageSizes(QString name, int orientation, PageSizeInfo::Category category);
+	void loadPageSizes(QSizeF dimensions, int orientation, PageSizeInfo::Category category);
 };
 
 
diff --git a/scribus/ui/widgets/pagesizepreview.h b/scribus/ui/widgets/pagesizepreview.h
index 665f39d..3e0e53c 100644
--- a/scribus/ui/widgets/pagesizepreview.h
+++ b/scribus/ui/widgets/pagesizepreview.h
@@ -13,20 +13,26 @@ class PageSizePreview : public QWidget
 public:
 	explicit PageSizePreview(QWidget *parent = nullptr);
 
-	void setPageHeight(double height) { m_height = height; update(); };
-	void setPageWidth(double width) { m_width = width; update(); };
-	void setMargins(const MarginStruct& margins) { m_margins = margins; update(); };
-	void setBleeds(const MarginStruct& bleeds) { m_bleeds = bleeds; update(); };
-	void setPageName(const QString& name) {
-		PageSize ps(name);
+	void setPageHeight(double height)
+	{
+		PageSize ps(m_width, height);
 		m_name = ps.nameTR();
+		m_height = height;
 		update();
 	};
+	void setPageWidth(double width)
+	{
+		PageSize ps(width, m_height);
+		m_width = width;
+		update();
+	};
+	void setMargins(const MarginStruct& margins) { m_margins = margins; update(); };
+	void setBleeds(const MarginStruct& bleeds) { m_bleeds = bleeds; update(); };
 	void setLayout(int layout) { m_layout = layout; update(); };
 	void setFirstPage(int firstPage) { m_firstPage = firstPage; update(); };
-	void setPage(double height, double width, const MarginStruct& margins, const MarginStruct& bleeds, QString name, int layout, int firstPage)
+	void setPage(double height, double width, const MarginStruct& margins, const MarginStruct& bleeds, int layout, int firstPage)
 	{
-		PageSize ps(name);
+		PageSize ps(width, height);
 
 		m_height = height;
 		m_width = width;
diff --git a/scribus/ui/widgets/pagesizeselector.cpp b/scribus/ui/widgets/pagesizeselector.cpp
index 5ca25c5..f9e0507 100644
--- a/scribus/ui/widgets/pagesizeselector.cpp
+++ b/scribus/ui/widgets/pagesizeselector.cpp
@@ -49,7 +49,7 @@ void PageSizeSelector::setHasCustom(bool hasCustom)
 	m_hasCustom = hasCustom;
 
 	if (!m_sizeName.isEmpty())
-		setPageSize(m_sizeName);
+		setPageSize(m_size.width(), m_size.height());
 }
 
 void PageSizeSelector::setCurrentCategory(PageSizeInfo::Category category)
@@ -59,10 +59,8 @@ void PageSizeSelector::setCurrentCategory(PageSizeInfo::Category category)
 		comboCategory->setCurrentIndex(index);
 }
 
-void PageSizeSelector::setPageSize(QString name)
+void PageSizeSelector::setup(PageSize ps)
 {
-	PageSize ps(name);
-
 	m_sizeName = ps.name();
 	m_sizeCategory = ps.category();
 	m_trSizeName = ps.nameTR();
@@ -89,7 +87,7 @@ void PageSizeSelector::setPageSize(QString name)
 	{
 		comboCategory->addItem(it.value(), it.key());
 		if (it.key() == m_sizeCategory)
-			index = comboCategory->count() - 1;			
+			index = comboCategory->count() - 1;
 	}
 
 	comboCategory->setCurrentIndex(index);
@@ -102,6 +100,13 @@ void PageSizeSelector::setPageSize(QString name)
 	setFormat(m_sizeCategory, m_sizeName);
 }
 
+void PageSizeSelector::setPageSize(double width, double height)
+{
+	m_size = QSizeF(width, height);
+	PageSize ps(width, height);
+	setup(ps);
+}
+
 void PageSizeSelector::setFormat(PageSizeInfo::Category category, QString name)
 {
 	if (!hasFormatSelector())
diff --git a/scribus/ui/widgets/pagesizeselector.h b/scribus/ui/widgets/pagesizeselector.h
index 8c9b996..f73f162 100644
--- a/scribus/ui/widgets/pagesizeselector.h
+++ b/scribus/ui/widgets/pagesizeselector.h
@@ -29,7 +29,7 @@ class PageSizeSelector : public QWidget
 public:
 	explicit PageSizeSelector(QWidget *parent = nullptr);
 
-	void setPageSize(QString name);
+	void setPageSize(double width, double height);
 	void setHasFormatSelector(bool isVisble );
 	void setHasCustom(bool hasCustom);
 	bool hasCustom() const { return m_hasCustom; };
@@ -46,10 +46,12 @@ private:
 
 	QString m_sizeName;
 	QString m_trSizeName;
+	QSizeF m_size;
 	PageSizeInfo::Category m_sizeCategory;
 	bool m_hasFormatSelector {true};
 	bool m_hasCustom {true};
 
+	void setup(PageSize ps);
 	void setFormat(PageSizeInfo::Category category, QString name);
 
 signals:
autopagesize_2025-03-27_01.diff (85,386 bytes)   

nitramr

2025-03-27 17:06

developer   ~0052353

For quick code review: https://codeberg.org/Scribus/scribus/commit/32dc69fdf0127efec446f9be77f7d913df57d71c

nitramr

2025-03-27 18:24

developer   ~0052354

Last patch had an issue and Scribus crashes when you create a new page.
autopagesize_2025-03-27_02.diff (84,850 bytes)   
diff --git a/scribus/pagesize.cpp b/scribus/pagesize.cpp
index 4d5aebc..5ca4e42 100644
--- a/scribus/pagesize.cpp
+++ b/scribus/pagesize.cpp
@@ -27,24 +27,49 @@ for which a new license (GPL+exception) is in place.
 
 PageSize::PageSize(const QString& sizeName)
 {
-	init(sizeName);
+	initByName(sizeName);
 }
 
 PageSize::PageSize(double w, double h)
-        : m_width(w),
-          m_height(h)
 {
-	m_pageSizeName = CommonStrings::customPageSize;
-	m_trPageSizeName = CommonStrings::trCustomPageSize;
+	initByDimensions(QSizeF(w, h));
 }
 
 PageSize& PageSize::operator=(const PageSize& other)
 {
-	init(other.name());
+	initByDimensions(QSizeF(other.width(), other.height()));
 	return *this;
 }
 
-void PageSize::init(const QString& sizeName)
+void PageSize::initByDimensions(QSizeF sizePt)
+{
+	generateSizeList();
+
+	PageSizeInfo page = pageInfoByDimensions(sizePt);
+	if (page.sizeName.isEmpty())
+	{
+		// qDebug() << Q_FUNC_INFO << "Don't found page" << sizePt;
+		m_width = sizePt.width();
+		m_height = sizePt.height();
+		m_pageUnitIndex = -1;
+		m_pageSizeName = CommonStrings::customPageSize;
+		m_trPageSizeName = CommonStrings::trCustomPageSize;
+		m_category = PageSizeInfo::Custom;
+		return;
+	}
+
+	// qDebug() << Q_FUNC_INFO << "Found page" << page.sizeName << sizePt;
+
+	m_width = page.width;
+	m_height = page.height;
+	m_pageUnitIndex = page.pageUnitIndex;
+	m_pageSizeName = page.sizeName;
+	m_trPageSizeName = page.trSizeName;
+	m_category = page.category;
+
+}
+
+void PageSize::initByName(const QString& sizeName)
 {
 	m_width = 0.0;
 	m_height = 0.0;
@@ -124,19 +149,27 @@ PageSizeInfoMap PageSize::sizesByCategory(PageSizeInfo::Category category) const
 	return map;
 }
 
-PageSizeInfoMap PageSize::sizesByDimensions(QSize sizePt) const
+PageSizeInfoMap PageSize::sizesByDimensions(QSizeF sizePt) const
 {
 	PageSizeInfoMap map;
 
 	for (auto it = m_pageSizeList.begin(); it != m_pageSizeList.end(); ++it)
 	{
-		if (it.value().width == sizePt.width() && it.value().height == sizePt.height())
+		if ((qFuzzyCompare(it.value().width, sizePt.width()) && qFuzzyCompare(it.value().height, sizePt.height())) // portrait
+			|| (qFuzzyCompare(it.value().width, sizePt.height()) && qFuzzyCompare(it.value().height, sizePt.width()))) // landscape
 			map.insert(it.value().sizeName, it.value());
 	}
 
 	return map;
 }
 
+PageSizeInfo PageSize::pageInfoByDimensions(QSizeF sizePt) const
+{
+	PageSizeInfoMap list = sizesByDimensions(sizePt);
+	return (list.empty()) ? PageSizeInfo() : list.first();
+}
+
+
 PageSizeInfoMap PageSize::activePageSizes() const
 {
 	PageSizeInfoMap map;
diff --git a/scribus/pagesize.h b/scribus/pagesize.h
index 1507212..f758f37 100644
--- a/scribus/pagesize.h
+++ b/scribus/pagesize.h
@@ -61,13 +61,13 @@ struct PageSizeInfo
 		Swedish = 57,
 	};
 
-	double width;
-	double height;
+	double width {0.0};
+	double height {0.0};
 	QString trSizeName;
 	QString sizeName;
 	QString sizeLabel;
-	int pageUnitIndex;
-	Category category;
+	int pageUnitIndex {-1};
+	Category category {PageSizeInfo::Custom};
 };
 
 using PageSizeInfoMap = QMap<QString, PageSizeInfo>;
@@ -80,7 +80,6 @@ public:
 	PageSize(double, double);
 	PageSize& operator=(const PageSize& other);
 
-	void init(const QString&);
 	const QString& name() const { return m_pageSizeName; }
 	const QString& nameTR() const { return m_trPageSizeName; }
 	PageSizeInfo::Category category() const { return m_category; };
@@ -93,9 +92,11 @@ public:
 	static QStringList defaultSizesList();
 	PageSizeCategoriesMap categories() const;
 	PageSizeInfoMap sizesByCategory(PageSizeInfo::Category category) const;
-	PageSizeInfoMap sizesByDimensions(QSize sizePt) const;
+	PageSizeInfoMap sizesByDimensions(QSizeF sizePt) const;
 	PageSizeInfoMap activePageSizes() const;
-	const PageSizeInfoMap& pageSizes() const { return m_pageSizeList; };
+	const PageSizeInfoMap& pageSizes() const { return m_pageSizeList; }
+	PageSizeInfo pageInfoByDimensions(double width, double height) const { return pageInfoByDimensions(QSizeF(width, height));}
+	PageSizeInfo pageInfoByDimensions(QSizeF sizePt) const;
 	void printSizeList() const;
 
 private:
@@ -107,6 +108,8 @@ private:
 	QString m_trPageSizeName;
 	PageSizeInfo::Category m_category {PageSizeInfo::Custom};
 
+	void initByName(const QString&); // legacy support for < 1.7.1
+	void initByDimensions(QSizeF sizePt);
 	void generateSizeList();
 	void addPageSize(const QString id, double width, double height, int unitIndex, PageSizeInfo::Category category);
 	void addPageSize(const QString id, const QString name, double width, double height, int unitIndex, PageSizeInfo::Category category);
diff --git a/scribus/plugins/fileloader/scribus171format/scribus171format.cpp b/scribus/plugins/fileloader/scribus171format/scribus171format.cpp
index e8e2c2a..0d70a95 100644
--- a/scribus/plugins/fileloader/scribus171format/scribus171format.cpp
+++ b/scribus/plugins/fileloader/scribus171format/scribus171format.cpp
@@ -2438,7 +2438,6 @@ namespace {
 
 void Scribus171Format::readDocAttributes(ScribusDoc* doc, const ScXmlStreamAttributes& attrs) const
 {
-	m_Doc->setPageSize(attrs.valueAsString("PAGESIZE"));
 	m_Doc->setPageOrientation(attrs.valueAsInt("ORIENTATION", 0));
 	m_Doc->FirstPnum = attrs.valueAsInt("FIRSTNUM", 1);
 	m_Doc->setPagePositioning(attrs.valueAsInt("BOOK", 0));
@@ -2481,6 +2480,9 @@ void Scribus171Format::readDocAttributes(ScribusDoc* doc, const ScXmlStreamAttri
 	m_Doc->setHyphAutoCheck(attrs.valueAsBool("AUTOCHECK", false));
 	m_Doc->GuideLock = attrs.valueAsBool("GUIDELOCK", false);
 
+	PageSize ps = PageSize(m_Doc->pageWidth(), m_Doc->pageHeight());
+	m_Doc->setPageSize(ps.name());
+
 	m_Doc->rulerXoffset = attrs.valueAsDouble("rulerXoffset", 0.0);
 	m_Doc->rulerYoffset = attrs.valueAsDouble("rulerYoffset", 0.0);
 	m_Doc->SnapGuides = attrs.valueAsBool("SnapToGuides", false);
@@ -4329,8 +4331,6 @@ bool Scribus171Format::readPage(ScribusDoc* doc, ScXmlStreamReader& reader)
 	newPage->LeftPg = attrs.valueAsInt("LEFT", 0);
 	QString mpName = attrs.valueAsString("MNAM", "Normal");
 	newPage->setMasterPageName(m_Doc->masterPageMode() ? QString() : mpName);
-	if (attrs.hasAttribute("Size"))
-		newPage->setSize(attrs.valueAsString("Size"));
 	if (attrs.hasAttribute("Orientation"))
 		newPage->setOrientation(attrs.valueAsInt("Orientation"));
 	newPage->setXOffset(attrs.valueAsDouble("PAGEXPOS"));
@@ -4341,16 +4341,8 @@ bool Scribus171Format::readPage(ScribusDoc* doc, ScXmlStreamReader& reader)
 		newPage->setWidth(attrs.valueAsDouble("PAGEWITH"));
 	newPage->setHeight(attrs.valueAsDouble("PAGEHEIGHT"));
 
-	//14704: Double check the page size should not be Custom in case the size doesn't match a standard size
-	if (attrs.hasAttribute("Size"))
-	{
-		QString pageSize(attrs.valueAsString("Size"));
-		PageSize ps(pageSize);
-		if (!compareDouble(ps.width(), newPage->width()) || !compareDouble(ps.height(), newPage->height()))
-			newPage->setSize(CommonStrings::customPageSize);
-		else
-			newPage->setSize(pageSize);
-	}
+	PageSize ps(newPage->width(), newPage->height());
+	newPage->setSize(ps.name());
 
 	newPage->setInitialHeight(newPage->height());
 	newPage->setInitialWidth(newPage->width());
diff --git a/scribus/plugins/fileloader/scribus171format/scribus171format_save.cpp b/scribus/plugins/fileloader/scribus171format/scribus171format_save.cpp
index e6e1551..9fb80f5 100644
--- a/scribus/plugins/fileloader/scribus171format/scribus171format_save.cpp
+++ b/scribus/plugins/fileloader/scribus171format/scribus171format_save.cpp
@@ -336,7 +336,6 @@ bool Scribus171Format::saveFile(const QString & fileName, const FileFormat & /*
 	docu.writeAttribute("BleedRight"  , m_Doc->bleeds()->right());
 	docu.writeAttribute("BleedBottom" , m_Doc->bleeds()->bottom());
 	docu.writeAttribute("ORIENTATION" , m_Doc->pageOrientation());
-	docu.writeAttribute("PAGESIZE"    , m_Doc->pageSize());
 	docu.writeAttribute("FIRSTNUM"    , m_Doc->FirstPnum);
 	docu.writeAttribute("BOOK"        , m_Doc->pagePositioning());
 	if (m_Doc->usesAutomaticTextFrames())
@@ -1819,7 +1818,6 @@ void Scribus171Format::WritePages(ScribusDoc *doc, ScXmlStreamWriter& docu, QPro
 		docu.writeAttribute("NUM",page->pageNr());
 		docu.writeAttribute("NAM",page->pageName());
 		docu.writeAttribute("MNAM",page->masterPageName());
-		docu.writeAttribute("Size", page->size());
 		docu.writeAttribute("Orientation", page->orientation());
 		docu.writeAttribute("LEFT", page->LeftPg);
 		docu.writeAttribute("PRESET", page->marginPreset);
diff --git a/scribus/plugins/import/ai/importai.cpp b/scribus/plugins/import/ai/importai.cpp
index 24f5464..8ba9f33 100644
--- a/scribus/plugins/import/ai/importai.cpp
+++ b/scribus/plugins/import/ai/importai.cpp
@@ -136,7 +136,7 @@ QImage AIPlug::readThumbnail(const QString& fNameIn)
 	baseX = 0;
 	baseY = 0;
 	m_Doc = new ScribusDoc();
-	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 	m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
 	m_Doc->addPage(0);
 	m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
@@ -241,7 +241,7 @@ bool AIPlug::readColors(const QString& fileName, ColorList & colors)
 	docWidth = b - x;
 	docHeight = h - y;
 	m_Doc = new ScribusDoc();
-	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 	m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
 	m_Doc->addPage(0);
 	m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
@@ -379,7 +379,7 @@ bool AIPlug::import(const QString& fNameIn, const TransactionSettings& trSetting
 	{
 		if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 		{
-			m_Doc = ScCore->primaryMainWindow()->doFileNew(b - x, h - y, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+			m_Doc = ScCore->primaryMainWindow()->doFileNew(b - x, h - y, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 			ScCore->primaryMainWindow()->HaveNewDoc();
 			ret = true;
 			baseX = 0;
diff --git a/scribus/plugins/import/cdr/importcdr.cpp b/scribus/plugins/import/cdr/importcdr.cpp
index deaf5d2..9c9704f 100644
--- a/scribus/plugins/import/cdr/importcdr.cpp
+++ b/scribus/plugins/import/cdr/importcdr.cpp
@@ -49,7 +49,7 @@ QImage CdrPlug::readThumbnail(const QString& fName)
 	docHeight = PrefsManager::instance().appPrefs.docSetupPrefs.pageHeight;
 	progressDialog = nullptr;
 	m_Doc = new ScribusDoc();
-	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 	m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
 	m_Doc->addPage(0);
 	m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
@@ -155,7 +155,7 @@ bool CdrPlug::import(const QString& fNameIn, const TransactionSettings& trSettin
 	}
 	else if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 	{
-		m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+		m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 		ScCore->primaryMainWindow()->HaveNewDoc();
 		ret = true;
 		baseX = 0;
diff --git a/scribus/plugins/import/cgm/importcgm.cpp b/scribus/plugins/import/cgm/importcgm.cpp
index de60aec..2e26ccf 100644
--- a/scribus/plugins/import/cgm/importcgm.cpp
+++ b/scribus/plugins/import/cgm/importcgm.cpp
@@ -101,7 +101,7 @@ QImage CgmPlug::readThumbnail(const QString& fName)
 	docHeight = h;
 	progressDialog = nullptr;
 	m_Doc = new ScribusDoc();
-	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 	m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
 	m_Doc->addPage(0);
 	m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
@@ -206,7 +206,7 @@ bool CgmPlug::import(const QString& fNameIn, const TransactionSettings& trSettin
 	{
 		if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 		{
-			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 			ScCore->primaryMainWindow()->HaveNewDoc();
 			ret = true;
 			baseX = 0;
diff --git a/scribus/plugins/import/cvg/importcvg.cpp b/scribus/plugins/import/cvg/importcvg.cpp
index cdbe569..be484e3 100644
--- a/scribus/plugins/import/cvg/importcvg.cpp
+++ b/scribus/plugins/import/cvg/importcvg.cpp
@@ -55,7 +55,7 @@ QImage CvgPlug::readThumbnail(const QString& fName)
 	docHeight = h;
 	progressDialog = nullptr;
 	m_Doc = new ScribusDoc();
-	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 	m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
 	m_Doc->addPage(0);
 	m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
@@ -165,7 +165,7 @@ bool CvgPlug::import(const QString& fNameIn, const TransactionSettings& trSettin
 	{
 		if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 		{
-			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 			ScCore->primaryMainWindow()->HaveNewDoc();
 			ret = true;
 			baseX = 0;
diff --git a/scribus/plugins/import/drw/importdrw.cpp b/scribus/plugins/import/drw/importdrw.cpp
index b470855..215cc31 100644
--- a/scribus/plugins/import/drw/importdrw.cpp
+++ b/scribus/plugins/import/drw/importdrw.cpp
@@ -62,7 +62,7 @@ QImage DrwPlug::readThumbnail(const QString& fName)
 	docHeight = h;
 	progressDialog = nullptr;
 	m_Doc = new ScribusDoc();
-	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 	m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
 	m_Doc->addPage(0);
 	m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
@@ -180,7 +180,7 @@ bool DrwPlug::import(const QString& fNameIn, const TransactionSettings& trSettin
 	{
 		if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 		{
-			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 			ScCore->primaryMainWindow()->HaveNewDoc();
 			ret = true;
 			baseX = 0;
diff --git a/scribus/plugins/import/emf/importemf.cpp b/scribus/plugins/import/emf/importemf.cpp
index bc37acf..77b62b6 100644
--- a/scribus/plugins/import/emf/importemf.cpp
+++ b/scribus/plugins/import/emf/importemf.cpp
@@ -438,7 +438,7 @@ QImage EmfPlug::readThumbnail(const QString& fName)
 	baseY = 0;
 	progressDialog = nullptr;
 	m_Doc = new ScribusDoc();
-	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 	m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
 	m_Doc->addPage(0);
 	m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
@@ -586,7 +586,7 @@ bool EmfPlug::import(const QString& fNameIn, const TransactionSettings& trSettin
 	}
 	else if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 	{
-		m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+		m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 		ScCore->primaryMainWindow()->HaveNewDoc();
 		m_Doc->setPageHeight(docHeight);
 		m_Doc->setPageWidth(docWidth);
diff --git a/scribus/plugins/import/fh/importfh.cpp b/scribus/plugins/import/fh/importfh.cpp
index 6b3b859..43cedaf 100644
--- a/scribus/plugins/import/fh/importfh.cpp
+++ b/scribus/plugins/import/fh/importfh.cpp
@@ -56,7 +56,7 @@ QImage FhPlug::readThumbnail(const QString& fName)
 	docHeight = h;
 	progressDialog = nullptr;
 	m_Doc = new ScribusDoc();
-	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 	m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
 	m_Doc->addPage(0);
 	m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
@@ -163,7 +163,7 @@ bool FhPlug::import(const QString& fNameIn, const TransactionSettings& trSetting
 	{
 		if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 		{
-			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 			ScCore->primaryMainWindow()->HaveNewDoc();
 			ret = true;
 			baseX = 0;
diff --git a/scribus/plugins/import/idml/importidml.cpp b/scribus/plugins/import/idml/importidml.cpp
index 1b1d62e..fc8a520 100644
--- a/scribus/plugins/import/idml/importidml.cpp
+++ b/scribus/plugins/import/idml/importidml.cpp
@@ -154,7 +154,7 @@ QImage IdmlPlug::readThumbnail(const QString& fName)
 		docWidth = PrefsManager::instance().appPrefs.docSetupPrefs.pageWidth;
 		docHeight = PrefsManager::instance().appPrefs.docSetupPrefs.pageHeight;
 		m_Doc = new ScribusDoc();
-		m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+		m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 		m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
 		m_Doc->addPage(0);
 		m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
@@ -242,7 +242,7 @@ bool IdmlPlug::readColors(const QString& fileName, ColorList & colors)
 	}
 
 	m_Doc = new ScribusDoc();
-	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 	m_Doc->setPage(1, 1, 0, 0, 0, 0, 0, 0, false, false);
 	m_Doc->addPage(0);
 	m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
@@ -340,7 +340,7 @@ bool IdmlPlug::import(const QString& fNameIn, const TransactionSettings& trSetti
 	{
 		if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 		{
-			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 			ScCore->primaryMainWindow()->HaveNewDoc();
 			ret = true;
 			baseX = 0;
diff --git a/scribus/plugins/import/odg/importodg.cpp b/scribus/plugins/import/odg/importodg.cpp
index be7a3fc..f60d285 100644
--- a/scribus/plugins/import/odg/importodg.cpp
+++ b/scribus/plugins/import/odg/importodg.cpp
@@ -172,7 +172,7 @@ bool OdgPlug::import(const QString& fNameIn, const TransactionSettings& trSettin
 	{
 		if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 		{
-			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 			ScCore->primaryMainWindow()->HaveNewDoc();
 			ret = true;
 			baseX = 0;
diff --git a/scribus/plugins/import/oodraw/oodrawimp.cpp b/scribus/plugins/import/oodraw/oodrawimp.cpp
index 177d90b..d59b91f 100644
--- a/scribus/plugins/import/oodraw/oodrawimp.cpp
+++ b/scribus/plugins/import/oodraw/oodrawimp.cpp
@@ -308,7 +308,7 @@ QImage OODPlug::readThumbnail(const QString& fileName)
 	double width = !properties.attribute( "fo:page-width" ).isEmpty() ? parseUnit(properties.attribute( "fo:page-width" ) ) : 550.0;
 	double height = !properties.attribute( "fo:page-height" ).isEmpty() ? parseUnit(properties.attribute( "fo:page-height" ) ) : 841.0;
 	m_Doc = new ScribusDoc();
-	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 	m_Doc->setPage(width, height, 0, 0, 0, 0, 0, 0, false, false);
 	m_Doc->addPage(0);
 	m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
@@ -456,7 +456,7 @@ bool OODPlug::convert(const TransactionSettings& trSettings, int flags)
 	{
 		if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 		{
-			m_Doc = ScCore->primaryMainWindow()->doFileNew(width, height, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+			m_Doc = ScCore->primaryMainWindow()->doFileNew(width, height, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 			ScCore->primaryMainWindow()->HaveNewDoc();
 			ret = true;
 		}
diff --git a/scribus/plugins/import/pages/importpages.cpp b/scribus/plugins/import/pages/importpages.cpp
index b62a4f2..67367e1 100644
--- a/scribus/plugins/import/pages/importpages.cpp
+++ b/scribus/plugins/import/pages/importpages.cpp
@@ -239,7 +239,7 @@ bool PagesPlug::import(const QString& fNameIn, const TransactionSettings& trSett
 	{
 		if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 		{
-			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 			ScCore->primaryMainWindow()->HaveNewDoc();
 			ret = true;
 			baseX = 0;
diff --git a/scribus/plugins/import/pct/importpct.cpp b/scribus/plugins/import/pct/importpct.cpp
index de9e097..6dcb4a6 100644
--- a/scribus/plugins/import/pct/importpct.cpp
+++ b/scribus/plugins/import/pct/importpct.cpp
@@ -62,7 +62,7 @@ QImage PctPlug::readThumbnail(const QString& fName)
 	docHeight = h;
 	progressDialog = nullptr;
 	m_Doc = new ScribusDoc();
-	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 	m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
 	m_Doc->addPage(0);
 	m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
@@ -181,7 +181,7 @@ bool PctPlug::import(const QString& fNameIn, const TransactionSettings& trSettin
 	{
 		if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 		{
-			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 			ScCore->primaryMainWindow()->HaveNewDoc();
 			m_Doc->setPageHeight(docHeight);
 			m_Doc->setPageWidth(docWidth);
diff --git a/scribus/plugins/import/pdf/importpdf.cpp b/scribus/plugins/import/pdf/importpdf.cpp
index 596d89e..26ba5fa 100644
--- a/scribus/plugins/import/pdf/importpdf.cpp
+++ b/scribus/plugins/import/pdf/importpdf.cpp
@@ -164,7 +164,7 @@ bool PdfPlug::import(const QString& fNameIn, const TransactionSettings& trSettin
 	{
 		if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 		{
-			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, 0, 0, 0, 0, 1, "Custom", true);
+			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, 0, 0, 0, 0, 1, QSizeF(), true);
 			ScCore->primaryMainWindow()->HaveNewDoc();
 			ret = true;
 		}
diff --git a/scribus/plugins/import/pm/importpm.cpp b/scribus/plugins/import/pm/importpm.cpp
index 1da62d3..bbe984b 100644
--- a/scribus/plugins/import/pm/importpm.cpp
+++ b/scribus/plugins/import/pm/importpm.cpp
@@ -54,7 +54,7 @@ QImage PmPlug::readThumbnail(const QString& fName)
 	docHeight = PrefsManager::instance().appPrefs.docSetupPrefs.pageHeight;
 	progressDialog = nullptr;
 	m_Doc = new ScribusDoc();
-	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 	m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
 	m_Doc->addPage(0);
 	m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
@@ -161,7 +161,7 @@ bool PmPlug::import(const QString& fNameIn, const TransactionSettings& trSetting
 	{
 		if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 		{
-			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 			ScCore->primaryMainWindow()->HaveNewDoc();
 			ret = true;
 			baseX = 0;
diff --git a/scribus/plugins/import/pub/importpub.cpp b/scribus/plugins/import/pub/importpub.cpp
index 9c731f8..451a5b3 100644
--- a/scribus/plugins/import/pub/importpub.cpp
+++ b/scribus/plugins/import/pub/importpub.cpp
@@ -57,7 +57,7 @@ QImage PubPlug::readThumbnail(const QString& fName)
 	docHeight = PrefsManager::instance().appPrefs.docSetupPrefs.pageHeight;
 	progressDialog = nullptr;
 	m_Doc = new ScribusDoc();
-	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 	m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
 	m_Doc->addPage(0);
 	m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
@@ -164,7 +164,7 @@ bool PubPlug::import(const QString& fNameIn, const TransactionSettings& trSettin
 	{
 		if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 		{
-			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 			ScCore->primaryMainWindow()->HaveNewDoc();
 			ret = true;
 			baseX = 0;
diff --git a/scribus/plugins/import/qxp/importqxp.cpp b/scribus/plugins/import/qxp/importqxp.cpp
index 006ba13..b5dab47 100644
--- a/scribus/plugins/import/qxp/importqxp.cpp
+++ b/scribus/plugins/import/qxp/importqxp.cpp
@@ -74,7 +74,7 @@ QImage QxpPlug::readThumbnail(const QString& fName)
 	docHeight = h;
 	progressDialog = nullptr;
 	m_Doc = new ScribusDoc();
-	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 	m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
 	m_Doc->addPage(0);
 	m_Doc->setGUI(false, ScCore->primaryMainWindow(), 0);
@@ -184,7 +184,7 @@ bool QxpPlug::import(const QString& fNameIn, const TransactionSettings& trSettin
 	{
 		if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 		{
-			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 			ScCore->primaryMainWindow()->HaveNewDoc();
 			ret = true;
 			baseX = 0;
diff --git a/scribus/plugins/import/shape/importshape.cpp b/scribus/plugins/import/shape/importshape.cpp
index 01a0c34..51573dc 100644
--- a/scribus/plugins/import/shape/importshape.cpp
+++ b/scribus/plugins/import/shape/importshape.cpp
@@ -72,7 +72,7 @@ QImage ShapePlug::readThumbnail(const QString& fName)
 	docHeight = h;
 	progressDialog = nullptr;
 	m_Doc = new ScribusDoc();
-	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 	m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
 	m_Doc->addPage(0);
 	m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
@@ -181,7 +181,7 @@ bool ShapePlug::import(const QString& fNameIn, const TransactionSettings& trSett
 	{
 		if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 		{
-			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 			ScCore->primaryMainWindow()->HaveNewDoc();
 			ret = true;
 			baseX = 0;
diff --git a/scribus/plugins/import/sml/importsml.cpp b/scribus/plugins/import/sml/importsml.cpp
index adb666c..1b0414b 100644
--- a/scribus/plugins/import/sml/importsml.cpp
+++ b/scribus/plugins/import/sml/importsml.cpp
@@ -70,7 +70,7 @@ QImage SmlPlug::readThumbnail(const QString& fName)
 	docHeight = h;
 	progressDialog = nullptr;
 	m_Doc = new ScribusDoc();
-	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 	m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
 	m_Doc->addPage(0);
 	m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
@@ -179,7 +179,7 @@ bool SmlPlug::import(const QString& fNameIn, const TransactionSettings& trSettin
 	{
 		if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 		{
-			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 			ScCore->primaryMainWindow()->HaveNewDoc();
 			ret = true;
 			baseX = 0;
diff --git a/scribus/plugins/import/svg/svgplugin.cpp b/scribus/plugins/import/svg/svgplugin.cpp
index 5babddd..af8b609 100644
--- a/scribus/plugins/import/svg/svgplugin.cpp
+++ b/scribus/plugins/import/svg/svgplugin.cpp
@@ -237,7 +237,7 @@ QImage SVGPlug::readThumbnail(const QString& fName)
 	QDomElement docElem = inpdoc.documentElement();
 	QSizeF wh = parseWidthHeight(docElem);
 	m_Doc = new ScribusDoc();
-	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 	m_Doc->setPage(wh.width(), wh.height(), 0, 0, 0, 0, 0, 0, false, false);
 	m_Doc->addPage(0);
 	m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
@@ -411,7 +411,7 @@ void SVGPlug::convert(const TransactionSettings& trSettings, int flags)
 	{
 		if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 		{
-			m_Doc = ScCore->primaryMainWindow()->doFileNew(width, height, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+			m_Doc = ScCore->primaryMainWindow()->doFileNew(width, height, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 			ScCore->primaryMainWindow()->HaveNewDoc();
 			ret = true;
 		}
diff --git a/scribus/plugins/import/svm/importsvm.cpp b/scribus/plugins/import/svm/importsvm.cpp
index 811db77..5168851 100644
--- a/scribus/plugins/import/svm/importsvm.cpp
+++ b/scribus/plugins/import/svm/importsvm.cpp
@@ -308,7 +308,7 @@ QImage SvmPlug::readThumbnail(const QString& fName)
 	baseY = 0;
 	progressDialog = nullptr;
 	m_Doc = new ScribusDoc();
-	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 	m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
 	m_Doc->addPage(0);
 	m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
@@ -457,7 +457,7 @@ bool SvmPlug::import(const QString& fNameIn, const TransactionSettings& trSettin
 	{
 		if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 		{
-			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 			ScCore->primaryMainWindow()->HaveNewDoc();
 			m_Doc->setPageHeight(docHeight);
 			m_Doc->setPageWidth(docWidth);
diff --git a/scribus/plugins/import/viva/importviva.cpp b/scribus/plugins/import/viva/importviva.cpp
index e52a8e2..494745e 100644
--- a/scribus/plugins/import/viva/importviva.cpp
+++ b/scribus/plugins/import/viva/importviva.cpp
@@ -115,7 +115,7 @@ QImage VivaPlug::readThumbnail(const QString& fName)
 	docWidth = PrefsManager::instance().appPrefs.docSetupPrefs.pageWidth;
 	docHeight = PrefsManager::instance().appPrefs.docSetupPrefs.pageHeight;
 	m_Doc = new ScribusDoc();
-	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 	m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
 	m_Doc->addPage(0);
 	m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
@@ -166,7 +166,7 @@ bool VivaPlug::readColors(const QString& fileName, ColorList & colors)
 {
 	bool success = false;
 	m_Doc = new ScribusDoc();
-	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 	m_Doc->setPage(1, 1, 0, 0, 0, 0, 0, 0, false, false);
 	m_Doc->addPage(0);
 	m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
@@ -252,7 +252,7 @@ bool VivaPlug::import(const QString& fNameIn, const TransactionSettings& trSetti
 	{
 		if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 		{
-			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 			ScCore->primaryMainWindow()->HaveNewDoc();
 			ret = true;
 			baseX = 0;
diff --git a/scribus/plugins/import/vsd/importvsd.cpp b/scribus/plugins/import/vsd/importvsd.cpp
index 9a85eef..57ca66c 100644
--- a/scribus/plugins/import/vsd/importvsd.cpp
+++ b/scribus/plugins/import/vsd/importvsd.cpp
@@ -67,7 +67,7 @@ QImage VsdPlug::readThumbnail(const QString& fName)
 	docHeight = h;
 	progressDialog = nullptr;
 	m_Doc = new ScribusDoc();
-	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 	m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
 	m_Doc->addPage(0);
 	m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
@@ -174,7 +174,7 @@ bool VsdPlug::import(const QString& fNameIn, const TransactionSettings& trSettin
 	{
 		if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 		{
-			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 			ScCore->primaryMainWindow()->HaveNewDoc();
 			ret = true;
 			baseX = 0;
diff --git a/scribus/plugins/import/wmf/wmfimport.cpp b/scribus/plugins/import/wmf/wmfimport.cpp
index 3316ede..c345ec4 100644
--- a/scribus/plugins/import/wmf/wmfimport.cpp
+++ b/scribus/plugins/import/wmf/wmfimport.cpp
@@ -301,7 +301,7 @@ QImage WMFImport::readThumbnail(const QString& fname)
 	double width  = m_BBox.width() * scale;
 	double height = m_BBox.height() * scale;
 	m_Doc = new ScribusDoc();
-	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 	m_Doc->setPage(width, height, 0, 0, 0, 0, 0, 0, false, false);
 	m_Doc->addPage(0);
 	m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
@@ -566,7 +566,7 @@ bool WMFImport::importWMF(const TransactionSettings& trSettings, int flags)
 	{
 		if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 		{
-			m_Doc = ScCore->primaryMainWindow()->doFileNew(fabs(width), fabs(height), 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+			m_Doc = ScCore->primaryMainWindow()->doFileNew(fabs(width), fabs(height), 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 			ScCore->primaryMainWindow()->HaveNewDoc();
 			ret = true;
 		}
diff --git a/scribus/plugins/import/wpg/importwpg.cpp b/scribus/plugins/import/wpg/importwpg.cpp
index 5116050..2fa2160 100644
--- a/scribus/plugins/import/wpg/importwpg.cpp
+++ b/scribus/plugins/import/wpg/importwpg.cpp
@@ -418,7 +418,7 @@ QImage WpgPlug::readThumbnail(const QString& fName)
 	docHeight = h;
 	progressDialog = nullptr;
 	m_Doc = new ScribusDoc();
-	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 	m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
 	m_Doc->addPage(0);
 	m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
@@ -525,7 +525,7 @@ bool WpgPlug::import(const QString& fNameIn, const TransactionSettings& trSettin
 	{
 		if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 		{
-			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 			ScCore->primaryMainWindow()->HaveNewDoc();
 			ret = true;
 			baseX = 0;
diff --git a/scribus/plugins/import/xar/importxar.cpp b/scribus/plugins/import/xar/importxar.cpp
index 005eb6d..7f935ec 100644
--- a/scribus/plugins/import/xar/importxar.cpp
+++ b/scribus/plugins/import/xar/importxar.cpp
@@ -70,7 +70,7 @@ bool XarPlug::readColors(const QString& fileName, ColorList & colors)
 		if (id != 0x0A0DA3A3)
 			return false;
 		m_Doc = new ScribusDoc();
-		m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+		m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 		m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
 		m_Doc->addPage(0);
 		m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
@@ -276,7 +276,7 @@ bool XarPlug::import(const QString& fNameIn, const TransactionSettings& trSettin
 	{
 		if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 		{
-			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 			ScCore->primaryMainWindow()->HaveNewDoc();
 			ret = true;
 			baseX = m_Doc->currentPage()->xOffset() - x;
diff --git a/scribus/plugins/import/xfig/importxfig.cpp b/scribus/plugins/import/xfig/importxfig.cpp
index 9f5b031..7ea69d9 100644
--- a/scribus/plugins/import/xfig/importxfig.cpp
+++ b/scribus/plugins/import/xfig/importxfig.cpp
@@ -63,7 +63,7 @@ QImage XfigPlug::readThumbnail(const QString& fName)
 	docHeight = h - y;
 	progressDialog = nullptr;
 	m_Doc = new ScribusDoc();
-	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 	m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
 	m_Doc->addPage(0);
 	m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
@@ -303,7 +303,7 @@ bool XfigPlug::import(const QString& fNameIn, const TransactionSettings& trSetti
 	{
 		if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 		{
-			m_Doc = ScCore->primaryMainWindow()->doFileNew(b - x, h - y, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+			m_Doc = ScCore->primaryMainWindow()->doFileNew(b - x, h - y, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 			ScCore->primaryMainWindow()->HaveNewDoc();
 			ret = true;
 			baseX = 0;
@@ -1176,8 +1176,8 @@ void XfigPlug::processEllipse(const QString& data)
 		if (line_style > 0)
 			ite->setDashes(getDashValues(LineW, line_style));
 		ite->setTextFlowMode(PageItem::TextFlowDisabled);
-		AnchorPoint rot = m_Doc->rotationMode();
-		m_Doc->setRotationMode ( AnchorPoint::Center);
+		AnchorPoint rot = m_Doc->rotationMode();
+		m_Doc->setRotationMode ( AnchorPoint::Center);
 		m_Doc->rotateItem(-angle * 180.0 / M_PI, ite);
 		m_Doc->setRotationMode( rot);
 		depthMap.insert(999 - depth, currentItemNr);
diff --git a/scribus/plugins/import/xps/importxps.cpp b/scribus/plugins/import/xps/importxps.cpp
index 3861ce7..8331a0b 100644
--- a/scribus/plugins/import/xps/importxps.cpp
+++ b/scribus/plugins/import/xps/importxps.cpp
@@ -112,7 +112,7 @@ QImage XpsPlug::readThumbnail(const QString& fName)
 		docWidth = PrefsManager::instance().appPrefs.docSetupPrefs.pageWidth;
 		docHeight = PrefsManager::instance().appPrefs.docSetupPrefs.pageHeight;
 		m_Doc = new ScribusDoc();
-		m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+		m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 		m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
 		m_Doc->addPage(0);
 		m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
@@ -231,7 +231,7 @@ bool XpsPlug::import(const QString& fNameIn, const TransactionSettings& trSettin
 	{
 		if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 		{
-			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 			ScCore->primaryMainWindow()->HaveNewDoc();
 			ret = true;
 			baseX = 0;
diff --git a/scribus/plugins/import/zmf/importzmf.cpp b/scribus/plugins/import/zmf/importzmf.cpp
index 622fc01..cf63e63 100644
--- a/scribus/plugins/import/zmf/importzmf.cpp
+++ b/scribus/plugins/import/zmf/importzmf.cpp
@@ -53,7 +53,7 @@ QImage ZmfPlug::readThumbnail(const QString& fName)
 	docHeight = h;
 	progressDialog = nullptr;
 	m_Doc = new ScribusDoc();
-	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 	m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
 	m_Doc->addPage(0);
 	m_Doc->setGUI(false, ScCore->primaryMainWindow(), 0);
@@ -163,7 +163,7 @@ bool ZmfPlug::import(const QString& fNameIn, const TransactionSettings& trSettin
 	{
 		if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
 		{
-			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+			m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 			ScCore->primaryMainWindow()->HaveNewDoc();
 			ret = true;
 			baseX = 0;
diff --git a/scribus/plugins/scriptplugin/cmddoc.cpp b/scribus/plugins/scriptplugin/cmddoc.cpp
index a36b0ff..7455c6d 100644
--- a/scribus/plugins/scriptplugin/cmddoc.cpp
+++ b/scribus/plugins/scriptplugin/cmddoc.cpp
@@ -71,7 +71,7 @@ PyObject *scribus_newdocument(PyObject* /* self */, PyObject* args)
 								// columnDistance, numberCols, autoframes,
 								0, 1, false,
 								pagesType, unit, firstPageOrder,
-								orientation, firstPageNr, "Custom", true, numPages);
+								orientation, firstPageNr, QSizeF(), true, numPages);
 	ScCore->primaryMainWindow()->doc->setPageSetFirstPage(pagesType, firstPageOrder);
 
 	return PyLong_FromLong(static_cast<long>(ret));
@@ -107,7 +107,7 @@ PyObject *scribus_newdoc(PyObject* /* self */, PyObject* args)
 	lr  = value2pts(lr, unit);
 	rr  = value2pts(rr, unit);
 	btr = value2pts(btr, unit);
-	bool ret = ScCore->primaryMainWindow()->doFileNew(b, h, tpr, lr, rr, btr, 0, 1, false, ds, unit, fsl, ori, fNr, "Custom", true);
+	bool ret = ScCore->primaryMainWindow()->doFileNew(b, h, tpr, lr, rr, btr, 0, 1, false, ds, unit, fsl, ori, fNr, QSizeF(), true);
 	//	qApp->processEvents();
 	return PyLong_FromLong(static_cast<long>(ret));
 }
diff --git a/scribus/plugins/shapes/shapepalette.cpp b/scribus/plugins/shapes/shapepalette.cpp
index 671d55a..f7cc703 100644
--- a/scribus/plugins/shapes/shapepalette.cpp
+++ b/scribus/plugins/shapes/shapepalette.cpp
@@ -217,7 +217,7 @@ void ShapeView::startDrag(Qt::DropActions supportedActions)
 		int w = shapes[key].width;
 		int h = shapes[key].height;
 		ScribusDoc *m_Doc = new ScribusDoc();
-		m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+		m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 		m_Doc->setPage(w, h, 0, 0, 0, 0, 0, 0, false, false);
 		m_Doc->addPage(0);
 		m_Doc->setGUI(false, scMW, nullptr);
diff --git a/scribus/prefsmanager.cpp b/scribus/prefsmanager.cpp
index eccd2aa..5aee556 100644
--- a/scribus/prefsmanager.cpp
+++ b/scribus/prefsmanager.cpp
@@ -1377,8 +1377,8 @@ bool PrefsManager::writePref(const QString& filePath)
 	deDocumentSetup.setAttribute("UnitIndex", appPrefs.docSetupPrefs.docUnitIndex);
 	deDocumentSetup.setAttribute("PageSize", appPrefs.docSetupPrefs.pageSize);
 	deDocumentSetup.setAttribute("PageOrientation", appPrefs.docSetupPrefs.pageOrientation);
-	deDocumentSetup.setAttribute("PageWidth", ScCLocale::toQStringC(appPrefs.docSetupPrefs.pageWidth));
-	deDocumentSetup.setAttribute("PageHeight", ScCLocale::toQStringC(appPrefs.docSetupPrefs.pageHeight));
+	deDocumentSetup.setAttribute("PageWidth", appPrefs.docSetupPrefs.pageWidth);
+	deDocumentSetup.setAttribute("PageHeight", appPrefs.docSetupPrefs.pageHeight);
 	deDocumentSetup.setAttribute("MarginTop", ScCLocale::toQStringC(appPrefs.docSetupPrefs.margins.top()));
 	deDocumentSetup.setAttribute("MarginBottom", ScCLocale::toQStringC(appPrefs.docSetupPrefs.margins.bottom()));
 	deDocumentSetup.setAttribute("MarginLeft", ScCLocale::toQStringC(appPrefs.docSetupPrefs.margins.left()));
@@ -2072,8 +2072,8 @@ bool PrefsManager::readPref(const QString& filePath)
 			PageSize ps( dc.attribute("PageSize", PageSize::defaultSizesList().at(1)) );
 			appPrefs.docSetupPrefs.pageSize = (ps.name() == CommonStrings::customPageSize ) ? PageSize::defaultSizesList().at(1) : ps.name();
 			appPrefs.docSetupPrefs.pageOrientation = dc.attribute("PageOrientation", "0").toInt();
-			appPrefs.docSetupPrefs.pageWidth   = ScCLocale::toDoubleC(dc.attribute("PageWidth"), 595.0);
-			appPrefs.docSetupPrefs.pageHeight  = ScCLocale::toDoubleC(dc.attribute("PageHeight"), 842.0);
+			appPrefs.docSetupPrefs.pageWidth   = ScCLocale::toDoubleC(dc.attribute("PageWidth"), mm2pts(210));
+			appPrefs.docSetupPrefs.pageHeight  = ScCLocale::toDoubleC(dc.attribute("PageHeight"), mm2pts(297));
 			appPrefs.docSetupPrefs.margins.setTop(ScCLocale::toDoubleC(dc.attribute("MarginTop"), 9.0));
 			appPrefs.docSetupPrefs.margins.setBottom(ScCLocale::toDoubleC(dc.attribute("MarginBottom"), 40.0));
 			appPrefs.docSetupPrefs.margins.setLeft(ScCLocale::toDoubleC(dc.attribute("MarginLeft"), 9.0));
diff --git a/scribus/sampleitem.cpp b/scribus/sampleitem.cpp
index 691994b..807b34f 100644
--- a/scribus/sampleitem.cpp
+++ b/scribus/sampleitem.cpp
@@ -28,7 +28,7 @@ SampleItem::SampleItem()
 	if (!m_Doc)
 		return;
 
-	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 	m_Doc->setPage(1, 1, 0, 0, 0, 0, 0, 0, false, false);
 	m_Doc->addPage(0);
 	m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
diff --git a/scribus/scpreview.cpp b/scribus/scpreview.cpp
index aaae572..af035a7 100644
--- a/scribus/scpreview.cpp
+++ b/scribus/scpreview.cpp
@@ -43,7 +43,7 @@ QImage ScPreview::createPreview(const QString& data)
 		}
 
 		ScribusDoc *m_Doc = new ScribusDoc();
-		m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+		m_Doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 		m_Doc->setPage(gw, gh, 0, 0, 0, 0, 0, 0, false, false);
 		m_Doc->addPage(0);
 		m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
diff --git a/scribus/scribus.cpp b/scribus/scribus.cpp
index d892b72..ece5239 100644
--- a/scribus/scribus.cpp
+++ b/scribus/scribus.cpp
@@ -333,7 +333,7 @@ int ScribusMainWindow::initScMW(bool primaryMainWindow)
 	internalCopy = false;
 	internalCopyBuffer.clear();
 	m_doc = new ScribusDoc();
-	m_doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 	m_doc->setPage(100, 100, 0, 0, 0, 0, 0, 0, false, false);
 	m_doc->addPage(0);
 	m_doc->setGUI(false, this, nullptr);
@@ -2021,7 +2021,7 @@ void ScribusMainWindow::startUpDialog()
 			bool autoframes = dia->autoTextFrame->isChecked();
 			int orientation = dia->orientation();
 			int pageCount = dia->pageCountSpinBox->value();
-			QString pagesize = dia->pageSizeName();
+			QSizeF pagesize(dia->pageWidth(), dia->pageHeight());
 			doFileNew(pageWidth, pageHeight, topMargin, leftMargin, rightMargin, bottomMargin, columnDistance, numberCols, autoframes, facingPages, dia->unitOfMeasureComboBox->currentIndex(), firstPage, orientation, 1, pagesize, true, pageCount, true, dia->marginGroup->marginPreset());
 			doc->setPageSetFirstPage(facingPages, firstPage);
 			doc->bleeds()->set(dia->bleedTop(), dia->bleedLeft(), dia->bleedBottom(), dia->bleedRight());
@@ -2097,7 +2097,7 @@ bool ScribusMainWindow::slotFileNew()
 	bool autoframes = dia->autoTextFrame->isChecked();
 	int orientation = dia->orientation();
 	int pageCount = dia->pageCountSpinBox->value();
-	QString pagesize = dia->pageSizeName();
+	QSizeF pagesize(dia->pageWidth(), dia->pageHeight());
 
 	if (doFileNew(pageWidth, pageHeight, topMargin, leftMargin, rightMargin, bottomMargin, columnDistance, numberCols, autoframes, facingPages, dia->unitOfMeasureComboBox->currentIndex(), firstPage, orientation, 1, pagesize, true, pageCount, true, dia->marginGroup->marginPreset()))
 	{
@@ -2119,12 +2119,12 @@ bool ScribusMainWindow::slotFileNew()
 }
 
 //TODO move to core, assign doc to doc list, optionally create gui for it
-ScribusDoc *ScribusMainWindow::newDoc(double width, double height, double topMargin, double leftMargin, double rightMargin, double bottomMargin, double columnDistance, double columnCount, bool autoTextFrames, int pageArrangement, int unitIndex, int firstPageLocation, int orientation, int firstPageNumber, const QString& defaultPageSize, bool requiresGUI, int pageCount, bool showView, int marginPreset)
+ScribusDoc *ScribusMainWindow::newDoc(double width, double height, double topMargin, double leftMargin, double rightMargin, double bottomMargin, double columnDistance, double columnCount, bool autoTextFrames, int pageArrangement, int unitIndex, int firstPageLocation, int orientation, int firstPageNumber, QSizeF defaultPageSize, bool requiresGUI, int pageCount, bool showView, int marginPreset)
 {
 	return doFileNew(width, height, topMargin, leftMargin, rightMargin, bottomMargin, columnDistance, columnCount, autoTextFrames, pageArrangement, unitIndex, firstPageLocation, orientation, firstPageNumber, defaultPageSize, requiresGUI, pageCount, showView, marginPreset);
 }
 
-ScribusDoc *ScribusMainWindow::doFileNew(double width, double height, double topMargin, double leftMargin, double rightMargin, double bottomMargin, double columnDistance, double columnCount, bool autoTextFrames, int pageArrangement, int unitIndex, int firstPageLocation, int orientation, int firstPageNumber, const QString& defaultPageSize, bool requiresGUI, int pageCount, bool showView, int marginPreset)
+ScribusDoc *ScribusMainWindow::doFileNew(double width, double height, double topMargin, double leftMargin, double rightMargin, double bottomMargin, double columnDistance, double columnCount, bool autoTextFrames, int pageArrangement, int unitIndex, int firstPageLocation, int orientation, int firstPageNumber, QSizeF defaultPageSize, bool requiresGUI, int pageCount, bool showView, int marginPreset)
 {
 	if (HaveDoc)
 		outlinePalette->buildReopenVals();
@@ -8640,7 +8640,7 @@ void ScribusMainWindow::dropEvent ( QDropEvent * e)
 					ScriXmlDoc ss;
 					if (ss.readElemHeader(data, false, &gx, &gy, &gw, &gh))
 					{
-						doFileNew(gw, gh, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+						doFileNew(gw, gh, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 						HaveNewDoc();
 						doc->reformPages(true);
 						slotElemRead(data, doc->currentPage()->xOffset(), doc->currentPage()->yOffset(), false, false, doc, view);
@@ -8678,7 +8678,7 @@ void ScribusMainWindow::dropEvent ( QDropEvent * e)
 				ScriXmlDoc ss;
 				if (ss.readElemHeader(text, false, &gx, &gy, &gw, &gh))
 				{
-					doFileNew(gw, gh, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+					doFileNew(gw, gh, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, QSizeF(), true);
 					HaveNewDoc();
 					doc->reformPages(true);
 					slotElemRead(text, doc->currentPage()->xOffset(), doc->currentPage()->yOffset(), false, false, doc, view);
@@ -9192,7 +9192,7 @@ void ScribusMainWindow::manageColorsAndFills()
 			if (fmt)
 			{
 				ScribusDoc *s_doc = new ScribusDoc();
-				s_doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+				s_doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 				s_doc->setPage(100, 100, 0, 0, 0, 0, 0, 0, false, false);
 				s_doc->addPage(0);
 				s_doc->setGUI(false, this, nullptr);
diff --git a/scribus/scribus.h b/scribus/scribus.h
index 566c4eb..7102ea0 100644
--- a/scribus/scribus.h
+++ b/scribus/scribus.h
@@ -152,8 +152,8 @@ public:
 	inline bool scriptIsRunning(void) const { return (m_ScriptRunning > 0); }
 	inline void setScriptRunning(bool value) { m_ScriptRunning += (value ? 1 : -1); }
 
-	ScribusDoc* doFileNew(double width, double height, double topMargin, double leftMargin, double rightMargin, double bottomMargin, double columnDistance, double columnCount, bool autoTextFrames, int pageArrangement, int unitIndex, int firstPageLocation, int orientation, int firstPageNumber, const QString& defaultPageSize, bool requiresGUI, int pageCount = 1, bool showView = true, int marginPreset = 0);
-	ScribusDoc* newDoc(double width, double height, double topMargin, double leftMargin, double rightMargin, double bottomMargin, double columnDistance, double columnCount, bool autoTextFrames, int pageArrangement, int unitIndex, int firstPageLocation, int orientation, int firstPageNumber, const QString& defaultPageSize, bool requiresGUI, int pageCount = 1, bool showView = true, int marginPreset = 0);
+	ScribusDoc* doFileNew(double width, double height, double topMargin, double leftMargin, double rightMargin, double bottomMargin, double columnDistance, double columnCount, bool autoTextFrames, int pageArrangement, int unitIndex, int firstPageLocation, int orientation, int firstPageNumber, QSizeF defaultPageSize, bool requiresGUI, int pageCount = 1, bool showView = true, int marginPreset = 0);
+	ScribusDoc* newDoc(double width, double height, double topMargin, double leftMargin, double rightMargin, double bottomMargin, double columnDistance, double columnCount, bool autoTextFrames, int pageArrangement, int unitIndex, int firstPageLocation, int orientation, int firstPageNumber, QSizeF defaultPageSize, bool requiresGUI, int pageCount = 1, bool showView = true, int marginPreset = 0);
 	bool DoFileSave(const QString& fileName, QString* savedFileName = nullptr, uint formatID = FORMATID_CURRENTEXPORT);
 
 	void changeEvent(QEvent *e) override;
diff --git a/scribus/scribusdoc.cpp b/scribus/scribusdoc.cpp
index c885c92..35c5d35 100644
--- a/scribus/scribusdoc.cpp
+++ b/scribus/scribusdoc.cpp
@@ -678,12 +678,13 @@ QList<PageItem*> *ScribusDoc::parentGroup(PageItem* item, QList<PageItem*> *list
 	return retList;
 }
 
-void ScribusDoc::setup(int unitIndex, int fp, int firstLeft, int orientation, int firstPageNumber, const QString& defaultPageSize, const QString& documentName)
+void ScribusDoc::setup(int unitIndex, int fp, int firstLeft, int orientation, int firstPageNumber, QSizeF pageSize, const QString& documentName)
 {
 	m_docPrefsData.docSetupPrefs.docUnitIndex = unitIndex;
 	setPageSetFirstPage(fp, firstLeft);
 	m_docPrefsData.docSetupPrefs.pageOrientation = orientation;
-	m_docPrefsData.docSetupPrefs.pageSize = defaultPageSize;
+	PageSize ps(pageSize.width(), pageSize.height());
+	m_docPrefsData.docSetupPrefs.pageSize = ps.name();
 	FirstPnum = firstPageNumber;
 	m_docPrefsData.docSetupPrefs.pagePositioning = fp;
 	setDocumentFileName(documentName);
diff --git a/scribus/scribusdoc.h b/scribus/scribusdoc.h
index 14d2874..af8db19 100644
--- a/scribus/scribusdoc.h
+++ b/scribus/scribusdoc.h
@@ -105,7 +105,7 @@ public:
 	bool inASpecialEditMode() const;
 	QList<PageItem*> getAllItems(const QList<PageItem*> &items) const;
 	QList<PageItem*> *parentGroup(PageItem* item, QList<PageItem*> *list);
-	void setup(int, int, int, int, int, const QString&, const QString&);
+	void setup(int, int, int, int, int, QSizeF pageSize, const QString&);
 	void setLoading(bool);
 	bool isLoading() const;
 	void setModified(bool);
@@ -220,10 +220,10 @@ public:
 
 	double pageHeight() const { return m_docPrefsData.docSetupPrefs.pageHeight; }
 	double pageWidth() const { return m_docPrefsData.docSetupPrefs.pageWidth; }
-	const QString& pageSize() const { return m_docPrefsData.docSetupPrefs.pageSize; }
+	const QString& pageSize() const { return m_docPrefsData.docSetupPrefs.pageSize; } // legacy support for < 1.7.1
 	void setPageHeight(double h) { m_docPrefsData.docSetupPrefs.pageHeight = h; }
 	void setPageWidth(double w) { m_docPrefsData.docSetupPrefs.pageWidth = w; }
-	void setPageSize(const QString& s) { m_docPrefsData.docSetupPrefs.pageSize = s; }
+	void setPageSize(const QString& s) { m_docPrefsData.docSetupPrefs.pageSize = s; } // legacy support for < 1.7.1
 
 	int marginPreset() const { return m_docPrefsData.docSetupPrefs.marginPreset; }
 	void setMarginPreset(int mp) { m_docPrefsData.docSetupPrefs.marginPreset = mp; }
diff --git a/scribus/ui/colorsandfills.cpp b/scribus/ui/colorsandfills.cpp
index 85b5377..196044f 100644
--- a/scribus/ui/colorsandfills.cpp
+++ b/scribus/ui/colorsandfills.cpp
@@ -1951,7 +1951,7 @@ void ColorsAndFillsDialog::doSaveDefaults(const QString& name, bool changed)
 	if (fmt)
 	{
 		std::unique_ptr<ScribusDoc> s_doc(new ScribusDoc());
-		s_doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+		s_doc->setup(0, 1, 1, 1, 1, QSizeF(), "Custom");
 		s_doc->setPage(100, 100, 0, 0, 0, 0, 0, 0, false, false);
 		s_doc->addPage(0);
 		s_doc->setGUI(false, mainWin, nullptr);
diff --git a/scribus/ui/inspage.cpp b/scribus/ui/inspage.cpp
index cd9d652..ac60517 100644
--- a/scribus/ui/inspage.cpp
+++ b/scribus/ui/inspage.cpp
@@ -248,7 +248,7 @@ InsPage::InsPage( QWidget* parent, ScribusDoc* currentDoc, int currentPage, int
 	textLabel1 = new QLabel( tr( "&Size:" ), dsGroupBox7);
 	dsGroupBox7Layout->addWidget(textLabel1, 0, 0, Qt::AlignTop | Qt::AlignRight);
 	pageSizeSelector = new PageSizeSelector(dsGroupBox7);
-	pageSizeSelector->setPageSize(m_doc->pageSize());
+	pageSizeSelector->setPageSize(m_doc->pageWidth(), m_doc->pageHeight());
 	textLabel1->setBuddy(pageSizeSelector);
 	dsGroupBox7Layout->addWidget(pageSizeSelector, 0, 1);
 	textLabel2 = new QLabel( tr( "Orie&ntation:" ), dsGroupBox7);
diff --git a/scribus/ui/newdocdialog.cpp b/scribus/ui/newdocdialog.cpp
index 3b0486d..c71ef70 100644
--- a/scribus/ui/newdocdialog.cpp
+++ b/scribus/ui/newdocdialog.cpp
@@ -133,7 +133,6 @@ void NewDocDialog::createNewDocPage()
 {
 	int orientation = prefsManager.appPrefs.docSetupPrefs.pageOrientation;
 	int pagePositioning = prefsManager.appPrefs.docSetupPrefs.pagePositioning;
-	QString pageSize = prefsManager.appPrefs.docSetupPrefs.pageSize;
 	double pageHeight = prefsManager.appPrefs.docSetupPrefs.pageHeight;
 	double pageWidth = prefsManager.appPrefs.docSetupPrefs.pageWidth;
 
@@ -165,11 +164,11 @@ void NewDocDialog::createNewDocPage()
 		pageLayoutButtons->button(2)->setChecked(true);
 	}
 
-	listPageFormats->setValues(pageSize, orientation, PageSizeInfo::Preferred, PageSizeList::NameAsc);
+	listPageFormats->setValues(QSizeF(pageWidth, pageHeight), orientation, PageSizeInfo::Preferred, PageSizeList::NameAsc);
 
 	pageSizeSelector->setHasFormatSelector(false);
 	pageSizeSelector->setHasCustom(false);
-	pageSizeSelector->setPageSize(pageSize);
+	pageSizeSelector->setPageSize(pageWidth, pageHeight);
 	pageSizeSelector->setCurrentCategory(PageSizeInfo::Preferred);
 
 	widthSpinBox->setMinimum(pts2value(1.0, m_unitIndex));
@@ -194,7 +193,6 @@ void NewDocDialog::createNewDocPage()
 	marginGroup->setPageHeight(pageHeight);
 	marginGroup->setPageWidth(pageWidth);
 	marginGroup->setFacingPages(!(pagePositioning == singlePage));
-	marginGroup->setPageSize(pageSize);
 	marginGroup->setMarginPreset(prefsManager.appPrefs.docSetupPrefs.marginPreset);
 
 	MarginStruct bleed;
@@ -204,7 +202,6 @@ void NewDocDialog::createNewDocPage()
 	bleedGroup->setPageHeight(pageHeight);
 	bleedGroup->setPageWidth(pageWidth);
 	bleedGroup->setFacingPages(!(pagePositioning == singlePage));
-	bleedGroup->setPageSize(pageSize);
 	bleedGroup->setMarginPreset(prefsManager.appPrefs.docSetupPrefs.marginPreset);
 
 	pageCountSpinBox->setMaximum( 10000 );
@@ -214,7 +211,7 @@ void NewDocDialog::createNewDocPage()
 	pageCountLabel->setPixmap(iconManager.loadPixmap("panel-page"));
 
 	setDocLayout(pagePositioning);
-	setSize(pageSize);
+	setSize(QSizeF(pageWidth, pageHeight));
 	setOrientation(orientation);
 
 	numberOfCols->setButtonSymbols( QSpinBox::UpDownArrows );
@@ -341,8 +338,8 @@ void NewDocDialog::setWidth(double)
 	marginGroup->setPageWidth(m_pageWidth);
 	bleedGroup->setPageWidth(m_pageWidth);
 	listPageFormats->clearSelection();
-	m_pageSize = CommonStrings::customPageSize;
-	pagePreview->setPage(m_pageHeight, m_pageWidth, marginGroup->margins(), bleedGroup->margins(), m_pageSize, m_choosenLayout, m_layoutFirstPage);
+	listPageFormats->setDimensions(m_pageWidth, m_pageHeight);
+	pagePreview->setPage(m_pageHeight, m_pageWidth, marginGroup->margins(), bleedGroup->margins(), m_choosenLayout, m_layoutFirstPage);
 
 	int newOrientation = (widthSpinBox->value() > heightSpinBox->value()) ? landscapePage : portraitPage;
 	if (newOrientation != m_orientation)
@@ -363,8 +360,8 @@ void NewDocDialog::setHeight(double)
 	marginGroup->setPageHeight(m_pageHeight);
 	bleedGroup->setPageHeight(m_pageHeight);	
 	listPageFormats->clearSelection();
-	m_pageSize = CommonStrings::customPageSize;
-	pagePreview->setPage(m_pageHeight, m_pageWidth, marginGroup->margins(), bleedGroup->margins(), m_pageSize, m_choosenLayout, m_layoutFirstPage);
+	listPageFormats->setDimensions(m_pageWidth, m_pageHeight);
+	pagePreview->setPage(m_pageHeight, m_pageWidth, marginGroup->margins(), bleedGroup->margins(), m_choosenLayout, m_layoutFirstPage);
 
 	int newOrientation = (widthSpinBox->value() > heightSpinBox->value()) ? landscapePage : portraitPage;
 	if (newOrientation != m_orientation)
@@ -381,10 +378,11 @@ void NewDocDialog::setHeight(double)
 void NewDocDialog::changePageSize(const QModelIndex &ic)
 {
 	int unit = ic.data(PageSizeList::Unit).toInt();
-	QString sizeName = ic.data(PageSizeList::Name).toString();
+	double width = ic.data(PageSizeList::Width).toDouble();
+	double height = ic.data(PageSizeList::Height).toDouble();
 
 	setUnit(unit);
-	setPageSize(sizeName);
+	setPageSize(QSizeF(width, height));
 
 	QSignalBlocker sig(unitOfMeasureComboBox);
 	unitOfMeasureComboBox->setCurrentIndex(unit);
@@ -504,7 +502,9 @@ void NewDocDialog::setOrientation(int ori)
 		heightSpinBox->setValue((ori == portraitPage) ? qMax(w, h) : qMin(w, h));
 		m_pageWidth  = (ori == portraitPage) ? qMin(pw, ph) : qMax(pw, ph);
 		m_pageHeight = (ori == portraitPage) ? qMax(pw, ph) : qMin(pw, ph);
-		listPageFormats->setOrientation(ori);
+		// listPageFormats->setDimensions(pw, ph);
+		// listPageFormats->setOrientation(ori);
+		listPageFormats->setValues(QSizeF(pw, ph), ori, listPageFormats->category(), listPageFormats->sortMode());
 	}
 	// #869 pv - defined constants added + code repeat (check w/h)
 	(ori == portraitPage) ? m_orientation = portraitPage : m_orientation = landscapePage;
@@ -513,7 +513,7 @@ void NewDocDialog::setOrientation(int ori)
 	marginGroup->setPageWidth(m_pageWidth);
 	bleedGroup->setPageHeight(m_pageHeight);
 	bleedGroup->setPageWidth(m_pageWidth);
-	pagePreview->setPage(m_pageHeight, m_pageWidth, marginGroup->margins(), bleedGroup->margins(), m_pageSize, m_choosenLayout, m_layoutFirstPage);
+	pagePreview->setPage(m_pageHeight, m_pageWidth, marginGroup->margins(), bleedGroup->margins(), m_choosenLayout, m_layoutFirstPage);
 
 	connect(widthSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setWidth(double)));
 	connect(heightSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setHeight(double)));
@@ -539,43 +539,37 @@ void NewDocDialog::setLayout(int layoutId)
 	}
 }
 
-void NewDocDialog::setPageSize(const QString &size)
+void NewDocDialog::setPageSize(QSizeF size)
 {
 	setSize(size);
-
-	if (size != CommonStrings::customPageSize)
-		setOrientation(pageOrientationButtons->checkedId());
-
-	marginGroup->setPageSize(size);
-	bleedGroup->setPageSize(size);
-
+	setOrientation(pageOrientationButtons->checkedId());
 }
 
-void NewDocDialog::setSize(const QString& gr)
+void NewDocDialog::setSize(QSizeF size)
 {
 	m_pageWidth = widthSpinBox->value() / m_unitRatio;
 	m_pageHeight = heightSpinBox->value() / m_unitRatio;
-	m_pageSize = gr;
+
+	PageSize ps(size.width(), size.height());
 
 	disconnect(widthSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setWidth(double)));
 	disconnect(heightSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setHeight(double)));
-	if (m_pageSize == CommonStrings::trCustomPageSize || m_pageSize == CommonStrings::customPageSize)
+	if (ps.name() == CommonStrings::customPageSize)
 	{
 		widthSpinBox->setEnabled(true);
 		heightSpinBox->setEnabled(true);
 	}
 	else
 	{
-		PageSize ps2(m_pageSize);
 		if (pageOrientationButtons->checkedId() == portraitPage)
 		{
-			m_pageWidth = ps2.width();
-			m_pageHeight = ps2.height();
+			m_pageWidth = ps.width();
+			m_pageHeight = ps.height();
 		}
 		else
 		{
-			m_pageWidth = ps2.height();
-			m_pageHeight = ps2.width();
+			m_pageWidth = ps.height();
+			m_pageHeight = ps.width();
 		}
 	}
 	widthSpinBox->setValue(m_pageWidth * m_unitRatio);
@@ -584,7 +578,7 @@ void NewDocDialog::setSize(const QString& gr)
 	marginGroup->setPageWidth(m_pageWidth);
 	bleedGroup->setPageHeight(m_pageHeight);
 	bleedGroup->setPageWidth(m_pageWidth);
-	pagePreview->setPage(m_pageHeight, m_pageWidth, marginGroup->margins(), bleedGroup->margins(), m_pageSize, m_choosenLayout, m_layoutFirstPage);
+	pagePreview->setPage(m_pageHeight, m_pageWidth, marginGroup->margins(), bleedGroup->margins(), m_choosenLayout, m_layoutFirstPage);
 
 	connect(widthSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setWidth(double)));
 	connect(heightSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setHeight(double)));
@@ -597,7 +591,7 @@ void NewDocDialog::setDocLayout(int layout)
 	bleedGroup->setFacingPages(layout != singlePage);
 	m_choosenLayout = layout;
 	m_layoutFirstPage = prefsManager.appPrefs.pageSets[m_choosenLayout].FirstPage;
-	pagePreview->setPage(m_pageHeight, m_pageWidth, marginGroup->margins(), bleedGroup->margins(), m_pageSize, m_choosenLayout, m_layoutFirstPage);
+	pagePreview->setPage(m_pageHeight, m_pageWidth, marginGroup->margins(), bleedGroup->margins(), m_choosenLayout, m_layoutFirstPage);
 }
 
 void NewDocDialog::setDocFirstPage(int firstPage)
@@ -694,6 +688,5 @@ void NewDocDialog::changeCategory(PageSizeInfo::Category category)
 	if (listPageFormats->category() == category)
 		return;
 
-	listPageFormats->setFormat(m_pageSize);
-	listPageFormats->setCategory(category);
+	listPageFormats->setValues(QSizeF(m_pageWidth, m_pageHeight), listPageFormats->orientation(), category, listPageFormats->sortMode());
 }
diff --git a/scribus/ui/newdocdialog.h b/scribus/ui/newdocdialog.h
index a65550f..50e9c95 100644
--- a/scribus/ui/newdocdialog.h
+++ b/scribus/ui/newdocdialog.h
@@ -61,8 +61,7 @@ public:
 	void createNewDocPage();
 	void createOpenDocPage();
 	void createRecentDocPage();
-	void setSize(const QString& gr);
-	QString pageSizeName() const { return m_pageSize; };
+	void setSize(QSizeF size);
 
 	QFileDialog *fileDialog {nullptr};
 
@@ -94,7 +93,7 @@ public slots:
 	void ExitOK();
 	void setOrientation(int ori);
 	void setLayout(int layoutId);
-	void setPageSize(const QString &);
+	void setPageSize(QSizeF size);
 	void setDocLayout(int layout);
 	void setDocFirstPage(int firstPage);
 	/*! Opens document on doubleclick
@@ -132,7 +131,6 @@ protected:
 	double m_distance { 11.0 };
 	QString m_unitSuffix;
 	QString m_selectedFile;
-	QString m_pageSize;
 	int m_unitIndex { 0 };
 	int m_tabSelected { 0 };
 	bool m_onStartup { false };
diff --git a/scribus/ui/newmarginwidget.cpp b/scribus/ui/newmarginwidget.cpp
index deffc8f..43144ea 100644
--- a/scribus/ui/newmarginwidget.cpp
+++ b/scribus/ui/newmarginwidget.cpp
@@ -7,11 +7,12 @@ for which a new license (GPL+exception) is in place.
 
 #include "newmarginwidget.h"
 #include "iconmanager.h"
+#include "pagesize.h"
+#include "scribusapp.h"
 #include "scrspinbox.h"
-#include "units.h"
 #include "ui/marginpresetlayout.h"
 #include "ui/useprintermarginsdialog.h"
-#include "scribusapp.h"
+#include "units.h"
 
 NewMarginWidget::NewMarginWidget(QWidget* parent)
 	: QWidget(parent)
@@ -314,12 +315,6 @@ void NewMarginWidget::setPreset()
 	emit marginChanged(m_marginData);
 }
 
-void NewMarginWidget::setPageSize(const QString& pageSize)
-{
-	m_pageSize = pageSize;
-}
-
-
 void NewMarginWidget::updateMarginSpinValues()
 {
 	QSignalBlocker leftBlocked(leftMarginSpinBox);
@@ -424,7 +419,9 @@ void NewMarginWidget::setFacingPages(bool facing, int pageType)
 void NewMarginWidget::setMarginsToPrinterMargins()
 {
 	QSizeF pageDimensions(m_pageWidth, m_pageHeight);
-	UsePrinterMarginsDialog upm(parentWidget(), pageDimensions, m_pageSize, unitGetRatioFromIndex(m_unitIndex), unitGetSuffixFromIndex(m_unitIndex));
+	PageSize ps(m_pageWidth, m_pageHeight);
+
+	UsePrinterMarginsDialog upm(parentWidget(), pageDimensions, ps.nameTR(), unitGetRatioFromIndex(m_unitIndex), unitGetSuffixFromIndex(m_unitIndex));
 	if (upm.exec() != QDialog::Accepted)
 		return;
 
diff --git a/scribus/ui/newmarginwidget.h b/scribus/ui/newmarginwidget.h
index df098d2..7c45b85 100644
--- a/scribus/ui/newmarginwidget.h
+++ b/scribus/ui/newmarginwidget.h
@@ -36,8 +36,6 @@ class SCRIBUS_API NewMarginWidget : public QWidget, Ui::NewMarginWidget
 		void setPageWidth(double);
 		/*! \brief Setup the spinboxes properties (min/max value etc.) by height */
 		void setPageHeight(double);
-		/*! \brief Set the page size for margin getting from cups */
-		void setPageSize(const QString&);
 		void setNewUnit(int unitIndex);
 		void setNewValues(const MarginStruct& margs);
 		/*! \brief Setup the presetCombo without changing the margin values, only used by tabdocument */
@@ -67,7 +65,6 @@ class SCRIBUS_API NewMarginWidget : public QWidget, Ui::NewMarginWidget
 
 		MarginStruct m_marginData;
 		MarginStruct m_savedMarginData;
-		QString m_pageSize;
 		bool   m_facingPages {false};
 		bool   m_isSingle {false};
 		double m_pageHeight {0.0};
diff --git a/scribus/ui/pagepropertiesdialog.cpp b/scribus/ui/pagepropertiesdialog.cpp
index 32f5216..2fbde75 100644
--- a/scribus/ui/pagepropertiesdialog.cpp
+++ b/scribus/ui/pagepropertiesdialog.cpp
@@ -59,7 +59,7 @@ PagePropertiesDialog::PagePropertiesDialog( QWidget* parent, ScribusDoc* doc )
 	TextLabel1 = new QLabel( tr( "&Size:" ), dsGroupBox7 );
 	dsGroupBox7Layout->addWidget( TextLabel1, 0, 0, Qt::AlignTop | Qt::AlignRight);
 	pageSizeSelector = new PageSizeSelector(dsGroupBox7);
-	pageSizeSelector->setPageSize(doc->currentPage()->size());
+	pageSizeSelector->setPageSize(doc->currentPage()->width(), doc->currentPage()->height());
 	TextLabel1->setBuddy(pageSizeSelector);
 	dsGroupBox7Layout->addWidget(pageSizeSelector, 0, 1);
 	TextLabel2 = new QLabel( tr( "Orie&ntation:" ), dsGroupBox7 );
@@ -249,7 +249,6 @@ void PagePropertiesDialog::setSize(const QString & gr)
 	heightSpinBox->setValue(m_pageHeight * m_unitRatio);
 	marginWidget->setPageHeight(m_pageHeight);
 	marginWidget->setPageWidth(m_pageWidth);
-	marginWidget->setPageSize(gr);
 	connect(widthSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setPageWidth(double)));
 	connect(heightSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setPageHeight(double)));
 }
diff --git a/scribus/ui/prefs_documentsetup.cpp b/scribus/ui/prefs_documentsetup.cpp
index f5fc66b..f0dee06 100644
--- a/scribus/ui/prefs_documentsetup.cpp
+++ b/scribus/ui/prefs_documentsetup.cpp
@@ -184,12 +184,10 @@ void Prefs_DocumentSetup::restoreDefaults(struct ApplicationPrefs *prefsData)
 	marginsWidget->setup(prefsData->docSetupPrefs.margins, prefsData->docSetupPrefs.pagePositioning, prefsData->docSetupPrefs.docUnitIndex, NewMarginWidget::MarginWidgetFlags);
 	marginsWidget->setPageWidth(prefsData->docSetupPrefs.pageWidth);
 	marginsWidget->setPageHeight(prefsData->docSetupPrefs.pageHeight);
-//	marginsWidget->setPageSize(prefsPageSizeName);
 	marginsWidget->setMarginPreset(prefsData->docSetupPrefs.marginPreset);
 	bleedsWidget->setup(prefsData->docSetupPrefs.bleeds, prefsData->docSetupPrefs.pagePositioning, prefsData->docSetupPrefs.docUnitIndex, NewMarginWidget::BleedWidgetFlags);
 	bleedsWidget->setPageWidth(prefsData->docSetupPrefs.pageWidth);
 	bleedsWidget->setPageHeight(prefsData->docSetupPrefs.pageHeight);
-//	bleedsWidget->setPageSize(prefsPageSizeName);
 	bleedsWidget->setMarginPreset(prefsData->docSetupPrefs.marginPreset);
 	saveCompressedCheckBox->setChecked(prefsData->docSetupPrefs.saveCompressed);
 	emergencyCheckBox->setChecked(prefsData->miscPrefs.saveEmergencyFile);
@@ -271,21 +269,12 @@ void Prefs_DocumentSetup::setupPageSets()
 
 void Prefs_DocumentSetup::setupPageSizes(struct ApplicationPrefs *prefsData)
 {
-	prefsPageSizeName = prefsData->docSetupPrefs.pageSize;
+	double width = prefsData->docSetupPrefs.pageWidth;
+	double height = prefsData->docSetupPrefs.pageHeight;
 
-	PageSize ps(prefsPageSizeName);
+	pageSizeSelector->setPageSize(width, height);
+	prefsPageSizeName = pageSizeSelector->pageSize();
 
-	// try to find coresponding page size by dimensions
-	if (ps.name() == CommonStrings::customPageSize)
-	{
-		PageSizeInfoMap pages = ps.sizesByDimensions(QSize(prefsData->docSetupPrefs.pageWidth, prefsData->docSetupPrefs.pageHeight));
-		if (pages.count() > 0)
-			prefsPageSizeName = pages.firstKey();
-	}
-
-	pageSizeSelector->setPageSize(prefsPageSizeName);
-	marginsWidget->setPageSize(prefsPageSizeName);
-	bleedsWidget->setPageSize(prefsPageSizeName);
 }
 
 void Prefs_DocumentSetup::pageLayoutChanged(int i)
@@ -299,9 +288,9 @@ void Prefs_DocumentSetup::setPageWidth(double w)
 {
 	pageW = pageWidthSpinBox->value() / unitRatio;
 	marginsWidget->setPageWidth(pageW);
-	QString psText = pageSizeSelector->pageSizeTR();
-	if (psText != CommonStrings::trCustomPageSize && psText != CommonStrings::customPageSize)
-		pageSizeSelector->setPageSize(CommonStrings::customPageSize);
+
+	pageSizeSelector->setPageSize(pageW, pageH);
+
 	int newOrientation = (pageWidthSpinBox->value() > pageHeightSpinBox->value()) ? landscapePage : portraitPage;
 	if (newOrientation != pageOrientationComboBox->currentIndex())
 	{
@@ -315,9 +304,9 @@ void Prefs_DocumentSetup::setPageHeight(double h)
 {
 	pageH = pageHeightSpinBox->value() / unitRatio;
 	marginsWidget->setPageHeight(pageH);
-	QString psText = pageSizeSelector->pageSizeTR();
-	if (psText != CommonStrings::trCustomPageSize && psText != CommonStrings::customPageSize)
-		pageSizeSelector->setPageSize(CommonStrings::customPageSize);
+
+	pageSizeSelector->setPageSize(pageW, pageH);
+
 	int newOrientation = (pageWidthSpinBox->value() > pageHeightSpinBox->value()) ? landscapePage : portraitPage;
 	if (newOrientation != pageOrientationComboBox->currentIndex())
 	{
@@ -370,7 +359,6 @@ void Prefs_DocumentSetup::setSize(const QString &newSize)
 	pageHeightSpinBox->setValue(pageH * unitRatio);
 	marginsWidget->setPageHeight(pageH);
 	marginsWidget->setPageWidth(pageW);
-	marginsWidget->setPageSize(newSize);
 	pageWidthSpinBox->blockSignals(false);
 	pageHeightSpinBox->blockSignals(false);
 }
diff --git a/scribus/ui/prefs_pdfexport.cpp b/scribus/ui/prefs_pdfexport.cpp
index abe3fcf..8734921 100644
--- a/scribus/ui/prefs_pdfexport.cpp
+++ b/scribus/ui/prefs_pdfexport.cpp
@@ -413,7 +413,6 @@ void Prefs_PDFExport::restoreDefaults(struct ApplicationPrefs *prefsData, const
 	bleedsWidget->setup(prefsData->pdfPrefs.bleeds, prefsData->docSetupPrefs.pagePositioning, prefsData->docSetupPrefs.docUnitIndex, NewMarginWidget::BleedWidgetFlags);
 	bleedsWidget->setPageWidth(prefsData->docSetupPrefs.pageWidth);
 	bleedsWidget->setPageHeight(prefsData->docSetupPrefs.pageHeight);
-	bleedsWidget->setPageSize(prefsData->docSetupPrefs.pageSize);
 	bleedsWidget->setMarginPreset(prefsData->docSetupPrefs.marginPreset);
 //
 	useCustomRenderingCheckBox->setChecked(prefsData->pdfPrefs.UseLPI);
diff --git a/scribus/ui/widgets/pagesizelist.cpp b/scribus/ui/widgets/pagesizelist.cpp
index cf40f71..1226c12 100644
--- a/scribus/ui/widgets/pagesizelist.cpp
+++ b/scribus/ui/widgets/pagesizelist.cpp
@@ -39,23 +39,23 @@ PageSizeList::PageSizeList(QWidget* parent) :
 	setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
 }
 
-void PageSizeList::setFormat(QString format)
+void PageSizeList::setDimensions(double width, double height)
 {
-	loadPageSizes(format, m_orientation, m_category);
-	m_name = format;
+	loadPageSizes(QSizeF(width, height), m_orientation, m_category);
+	m_dimensions = QSizeF(width, height);
 	setSortMode(m_sortMode);
 }
 
 void PageSizeList::setOrientation(int orientation)
 {
-	loadPageSizes(m_name, orientation, m_category);
+	loadPageSizes(m_dimensions, orientation, m_category);
 	m_orientation = orientation;
 	setSortMode(m_sortMode);
 }
 
 void PageSizeList::setCategory(PageSizeInfo::Category category)
 {
-	loadPageSizes(m_name, m_orientation, category);
+	loadPageSizes(m_dimensions, m_orientation, category);
 	m_category = category;
 	setSortMode(m_sortMode);
 }
@@ -87,21 +87,21 @@ void PageSizeList::setSortMode(SortMode sortMode)
 	}
 }
 
-void PageSizeList::setValues(QString format, int orientation, PageSizeInfo::Category category, SortMode sortMode)
+void PageSizeList::setValues(QSizeF dimensions, int orientation, PageSizeInfo::Category category, SortMode sortMode)
 {
-	loadPageSizes(format, orientation, category);
-	m_name = format;
+	loadPageSizes(dimensions, orientation, category);
+	m_dimensions = dimensions;
 	m_orientation = orientation;
 	m_category = category;
 	setSortMode(sortMode);
 }
 
-void PageSizeList::loadPageSizes(QString name, int orientation, PageSizeInfo::Category category)
+void PageSizeList::loadPageSizes(QSizeF dimensions, int orientation, PageSizeInfo::Category category)
 {
 	QSignalBlocker sig(this);
 
-	PageSize ps(name);
-	PageSize pref(PrefsManager::instance().appPrefs.docSetupPrefs.pageSize);
+	PageSize pref(PrefsManager::instance().appPrefs.docSetupPrefs.pageWidth, PrefsManager::instance().appPrefs.docSetupPrefs.pageHeight);
+	PageSize ps(dimensions.width(), dimensions.height());
 
 	int sel = -1;
 
@@ -109,8 +109,9 @@ void PageSizeList::loadPageSizes(QString name, int orientation, PageSizeInfo::Ca
 	m_model->setSortRole(ItemData::Name);
 	m_model->sort(0, Qt::AscendingOrder);
 
-	if (m_category == category && this->selectionModel()->currentIndex().isValid())
-		sel = this->selectionModel()->currentIndex().row();
+	// enable if list selection should be remembered
+	// if (m_category == category && this->selectionModel()->currentIndex().isValid())
+	// 	sel = this->selectionModel()->currentIndex().row();
 
 	m_model->clear();
 
@@ -134,10 +135,14 @@ void PageSizeList::loadPageSizes(QString name, int orientation, PageSizeInfo::Ca
 			itemA->setData(QVariant(item.category), ItemData::Category);
 			itemA->setData(QVariant(item.sizeName), ItemData::Name);
 			itemA->setData(QVariant(item.width * item.height), ItemData::Dimension);
+			itemA->setData(QVariant(item.width), ItemData::Width);
+			itemA->setData(QVariant(item.height), ItemData::Height);
 			m_model->appendRow(itemA);
 
-			if (sel == -1 && item.sizeName == ps.name())
+			// select item with name match OR equal size
+			if (sel == -1 && (item.sizeName == ps.name() || (item.width == ps.width() && item.height == ps.height())))
 				sel = itemA->row();
+
 		}
 	}
 
diff --git a/scribus/ui/widgets/pagesizelist.h b/scribus/ui/widgets/pagesizelist.h
index 8f2bd8b..065c33f 100644
--- a/scribus/ui/widgets/pagesizelist.h
+++ b/scribus/ui/widgets/pagesizelist.h
@@ -33,13 +33,14 @@ public:
 		Category = Qt::UserRole + 2,
 		Name = Qt::UserRole + 3,
 		Dimension = Qt::UserRole + 4,
+		Width = Qt::UserRole + 5,
+		Height = Qt::UserRole + 6
 	};
 
 	PageSizeList(QWidget* parent);
 	~PageSizeList() = default;
 
-	void setFormat(QString format);
-	const QString& format() const { return m_name; };
+	void setDimensions(double width, double height);
 
 	void setOrientation(int orientation);
 	int orientation() const { return m_orientation; };
@@ -50,19 +51,19 @@ public:
 	void setSortMode(SortMode sortMode);
 	SortMode sortMode() const { return m_sortMode; };
 
-	void setValues(QString format, int orientation, PageSizeInfo::Category category, SortMode sortMode);
+	void setValues(QSizeF dimensions, int orientation, PageSizeInfo::Category category, SortMode sortMode);
 
 	void updateGeometries() override;
 
 private:
-	QString m_name {PageSize::defaultSizesList().at(1)};
+	QSizeF m_dimensions;
 	int m_orientation {0};
 	PageSizeInfo::Category m_category {PageSizeInfo::Preferred};
 	SortMode m_sortMode {SortMode::NameAsc};
 	QStandardItemModel* m_model { nullptr };
 
 	QIcon sizePreview(QSize iconSize, QSize pageSize) const;
-	void loadPageSizes(QString name, int orientation, PageSizeInfo::Category category);
+	void loadPageSizes(QSizeF dimensions, int orientation, PageSizeInfo::Category category);
 };
 
 
diff --git a/scribus/ui/widgets/pagesizepreview.h b/scribus/ui/widgets/pagesizepreview.h
index 665f39d..3e0e53c 100644
--- a/scribus/ui/widgets/pagesizepreview.h
+++ b/scribus/ui/widgets/pagesizepreview.h
@@ -13,20 +13,26 @@ class PageSizePreview : public QWidget
 public:
 	explicit PageSizePreview(QWidget *parent = nullptr);
 
-	void setPageHeight(double height) { m_height = height; update(); };
-	void setPageWidth(double width) { m_width = width; update(); };
-	void setMargins(const MarginStruct& margins) { m_margins = margins; update(); };
-	void setBleeds(const MarginStruct& bleeds) { m_bleeds = bleeds; update(); };
-	void setPageName(const QString& name) {
-		PageSize ps(name);
+	void setPageHeight(double height)
+	{
+		PageSize ps(m_width, height);
 		m_name = ps.nameTR();
+		m_height = height;
 		update();
 	};
+	void setPageWidth(double width)
+	{
+		PageSize ps(width, m_height);
+		m_width = width;
+		update();
+	};
+	void setMargins(const MarginStruct& margins) { m_margins = margins; update(); };
+	void setBleeds(const MarginStruct& bleeds) { m_bleeds = bleeds; update(); };
 	void setLayout(int layout) { m_layout = layout; update(); };
 	void setFirstPage(int firstPage) { m_firstPage = firstPage; update(); };
-	void setPage(double height, double width, const MarginStruct& margins, const MarginStruct& bleeds, QString name, int layout, int firstPage)
+	void setPage(double height, double width, const MarginStruct& margins, const MarginStruct& bleeds, int layout, int firstPage)
 	{
-		PageSize ps(name);
+		PageSize ps(width, height);
 
 		m_height = height;
 		m_width = width;
diff --git a/scribus/ui/widgets/pagesizeselector.cpp b/scribus/ui/widgets/pagesizeselector.cpp
index 5ca25c5..f9e0507 100644
--- a/scribus/ui/widgets/pagesizeselector.cpp
+++ b/scribus/ui/widgets/pagesizeselector.cpp
@@ -49,7 +49,7 @@ void PageSizeSelector::setHasCustom(bool hasCustom)
 	m_hasCustom = hasCustom;
 
 	if (!m_sizeName.isEmpty())
-		setPageSize(m_sizeName);
+		setPageSize(m_size.width(), m_size.height());
 }
 
 void PageSizeSelector::setCurrentCategory(PageSizeInfo::Category category)
@@ -59,10 +59,8 @@ void PageSizeSelector::setCurrentCategory(PageSizeInfo::Category category)
 		comboCategory->setCurrentIndex(index);
 }
 
-void PageSizeSelector::setPageSize(QString name)
+void PageSizeSelector::setup(PageSize ps)
 {
-	PageSize ps(name);
-
 	m_sizeName = ps.name();
 	m_sizeCategory = ps.category();
 	m_trSizeName = ps.nameTR();
@@ -89,7 +87,7 @@ void PageSizeSelector::setPageSize(QString name)
 	{
 		comboCategory->addItem(it.value(), it.key());
 		if (it.key() == m_sizeCategory)
-			index = comboCategory->count() - 1;			
+			index = comboCategory->count() - 1;
 	}
 
 	comboCategory->setCurrentIndex(index);
@@ -102,6 +100,13 @@ void PageSizeSelector::setPageSize(QString name)
 	setFormat(m_sizeCategory, m_sizeName);
 }
 
+void PageSizeSelector::setPageSize(double width, double height)
+{
+	m_size = QSizeF(width, height);
+	PageSize ps(width, height);
+	setup(ps);
+}
+
 void PageSizeSelector::setFormat(PageSizeInfo::Category category, QString name)
 {
 	if (!hasFormatSelector())
diff --git a/scribus/ui/widgets/pagesizeselector.h b/scribus/ui/widgets/pagesizeselector.h
index 8c9b996..f73f162 100644
--- a/scribus/ui/widgets/pagesizeselector.h
+++ b/scribus/ui/widgets/pagesizeselector.h
@@ -29,7 +29,7 @@ class PageSizeSelector : public QWidget
 public:
 	explicit PageSizeSelector(QWidget *parent = nullptr);
 
-	void setPageSize(QString name);
+	void setPageSize(double width, double height);
 	void setHasFormatSelector(bool isVisble );
 	void setHasCustom(bool hasCustom);
 	bool hasCustom() const { return m_hasCustom; };
@@ -46,10 +46,12 @@ private:
 
 	QString m_sizeName;
 	QString m_trSizeName;
+	QSizeF m_size;
 	PageSizeInfo::Category m_sizeCategory;
 	bool m_hasFormatSelector {true};
 	bool m_hasCustom {true};
 
+	void setup(PageSize ps);
 	void setFormat(PageSizeInfo::Category category, QString name);
 
 signals:
autopagesize_2025-03-27_02.diff (84,850 bytes)   

Issue History

Date Modified Username Field Change
2025-03-27 17:04 nitramr New Issue
2025-03-27 17:04 nitramr Status new => assigned
2025-03-27 17:04 nitramr Assigned To => nitramr
2025-03-27 17:04 nitramr File Added: autopagesize_2025-03-27_01.diff
2025-03-27 17:06 nitramr Note Added: 0052353
2025-03-27 18:24 nitramr Note Added: 0052354
2025-03-27 18:24 nitramr File Added: autopagesize_2025-03-27_02.diff