View Issue Details

IDProjectCategoryView StatusLast Update
0017476ScribusGeneralpublic2026-01-03 21:21
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.
Attached Files
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)   
PatchYes

Relationships

related to 0017650 new Custom page-size bug 

Activities

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)   

cbradney

2025-10-21 20:14

administrator   ~0053097

Updated patch for current code
17652_patchupdate.diff (79,135 bytes)   
Index: scribus/pagesize.cpp
===================================================================
--- scribus/pagesize.cpp	(revision 27090)
+++ scribus/pagesize.cpp	(working copy)
@@ -27,25 +27,50 @@
 
 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;
 	m_pageUnitIndex = -1;
@@ -124,13 +149,14 @@
 	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());
 	}
 
@@ -137,6 +163,13 @@
 	return map;
 }
 
+PageSizeInfo PageSize::pageInfoByDimensions(QSizeF sizePt) const
+{
+	PageSizeInfoMap list = sizesByDimensions(sizePt);
+	return (list.empty()) ? PageSizeInfo() : list.first();
+}
+
+
 PageSizeInfoMap PageSize::activePageSizes() const
 {
 	PageSizeInfoMap map;
Index: scribus/pagesize.h
===================================================================
--- scribus/pagesize.h	(revision 27090)
+++ scribus/pagesize.h	(working copy)
@@ -61,13 +61,13 @@
 		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 @@
 	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 @@
 	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 @@
 	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);
Index: scribus/plugins/fileloader/scribus171format/scribus171format.cpp
===================================================================
--- scribus/plugins/fileloader/scribus171format/scribus171format.cpp	(revision 27090)
+++ scribus/plugins/fileloader/scribus171format/scribus171format.cpp	(working copy)
@@ -2529,7 +2529,7 @@
 	//Remove uppercase in 1.8
 	if (attrs.hasAttribute("PAGESIZE"))
 	{
-		m_Doc->setPageSize(attrs.valueAsString("PAGESIZE"));
+		// 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));
@@ -2569,6 +2569,9 @@
 		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);
@@ -2595,7 +2598,7 @@
 	}
 	else
 	{
-		m_Doc->setPageSize(attrs.valueAsString("PageSize"));
+		// m_Doc->setPageSize(attrs.valueAsString("PageSize"));
 		m_Doc->setPageOrientation(attrs.valueAsInt("PageOrientation", 0));
 		m_Doc->FirstPnum = attrs.valueAsInt("FirstPageNumber", 1);
 		m_Doc->setPagePositioning(attrs.valueAsInt("PagePositioning", 0));
@@ -4771,8 +4774,6 @@
 	else
 		mpName = attrs.valueAsString("MasterPageName", "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"));
 
@@ -4800,16 +4801,8 @@
 	else
 		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());
Index: scribus/plugins/fileloader/scribus171format/scribus171format_save.cpp
===================================================================
--- scribus/plugins/fileloader/scribus171format/scribus171format_save.cpp	(revision 27090)
+++ scribus/plugins/fileloader/scribus171format/scribus171format_save.cpp	(working copy)
@@ -333,7 +333,7 @@
 	docu.writeAttribute("BleedRight", m_Doc->bleeds()->right());
 	docu.writeAttribute("BleedBottom", m_Doc->bleeds()->bottom());
 	docu.writeAttribute("PageOrientation", m_Doc->pageOrientation());
-	docu.writeAttribute("PageSize", m_Doc->pageSize());
+	// docu.writeAttribute("PageSize", m_Doc->pageSize());
 	docu.writeAttribute("FirstPageNumber", m_Doc->FirstPnum);
 	docu.writeAttribute("PagePositioning", m_Doc->pagePositioning());
 	if (m_Doc->usesAutomaticTextFrames())
@@ -1797,7 +1797,7 @@
 		docu.writeAttribute("PageNumber",page->pageNr());
 		docu.writeAttribute("PageName",page->pageName());
 		docu.writeAttribute("MasterPageName",page->masterPageName());
-		docu.writeAttribute("Size", page->size());
+		// docu.writeAttribute("Size", page->size());
 		docu.writeAttribute("Orientation", page->orientation());
 		docu.writeAttribute("LeftPage", page->LeftPg);
 		docu.writeAttribute("Preset", page->marginPreset);
Index: scribus/plugins/import/ai/importai.cpp
===================================================================
--- scribus/plugins/import/ai/importai.cpp	(revision 27090)
+++ scribus/plugins/import/ai/importai.cpp	(working copy)
@@ -136,7 +136,7 @@
 	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 @@
 	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 @@
 	{
 		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;
Index: scribus/plugins/import/cdr/importcdr.cpp
===================================================================
--- scribus/plugins/import/cdr/importcdr.cpp	(revision 27090)
+++ scribus/plugins/import/cdr/importcdr.cpp	(working copy)
@@ -49,7 +49,7 @@
 	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 @@
 	}
 	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;
Index: scribus/plugins/import/cgm/importcgm.cpp
===================================================================
--- scribus/plugins/import/cgm/importcgm.cpp	(revision 27090)
+++ scribus/plugins/import/cgm/importcgm.cpp	(working copy)
@@ -101,7 +101,7 @@
 	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 @@
 	{
 		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;
Index: scribus/plugins/import/cvg/importcvg.cpp
===================================================================
--- scribus/plugins/import/cvg/importcvg.cpp	(revision 27090)
+++ scribus/plugins/import/cvg/importcvg.cpp	(working copy)
@@ -55,7 +55,7 @@
 	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 @@
 	{
 		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;
Index: scribus/plugins/import/drw/importdrw.cpp
===================================================================
--- scribus/plugins/import/drw/importdrw.cpp	(revision 27090)
+++ scribus/plugins/import/drw/importdrw.cpp	(working copy)
@@ -62,7 +62,7 @@
 	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 @@
 	{
 		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;
Index: scribus/plugins/import/emf/importemf.cpp
===================================================================
--- scribus/plugins/import/emf/importemf.cpp	(revision 27090)
+++ scribus/plugins/import/emf/importemf.cpp	(working copy)
@@ -438,7 +438,7 @@
 	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 @@
 	}
 	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);
Index: scribus/plugins/import/fh/importfh.cpp
===================================================================
--- scribus/plugins/import/fh/importfh.cpp	(revision 27090)
+++ scribus/plugins/import/fh/importfh.cpp	(working copy)
@@ -56,7 +56,7 @@
 	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 @@
 	{
 		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;
Index: scribus/plugins/import/idml/importidml.cpp
===================================================================
--- scribus/plugins/import/idml/importidml.cpp	(revision 27090)
+++ scribus/plugins/import/idml/importidml.cpp	(working copy)
@@ -154,7 +154,7 @@
 		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 @@
 	}
 
 	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 @@
 	{
 		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;
Index: scribus/plugins/import/odg/importodg.cpp
===================================================================
--- scribus/plugins/import/odg/importodg.cpp	(revision 27090)
+++ scribus/plugins/import/odg/importodg.cpp	(working copy)
@@ -172,7 +172,7 @@
 	{
 		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;
Index: scribus/plugins/import/oodraw/oodrawimp.cpp
===================================================================
--- scribus/plugins/import/oodraw/oodrawimp.cpp	(revision 27090)
+++ scribus/plugins/import/oodraw/oodrawimp.cpp	(working copy)
@@ -308,7 +308,7 @@
 	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 @@
 	{
 		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;
 		}
Index: scribus/plugins/import/pages/importpages.cpp
===================================================================
--- scribus/plugins/import/pages/importpages.cpp	(revision 27090)
+++ scribus/plugins/import/pages/importpages.cpp	(working copy)
@@ -239,7 +239,7 @@
 	{
 		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;
Index: scribus/plugins/import/pct/importpct.cpp
===================================================================
--- scribus/plugins/import/pct/importpct.cpp	(revision 27090)
+++ scribus/plugins/import/pct/importpct.cpp	(working copy)
@@ -62,7 +62,7 @@
 	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 @@
 	{
 		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);
Index: scribus/plugins/import/pdf/importpdf.cpp
===================================================================
--- scribus/plugins/import/pdf/importpdf.cpp	(revision 27090)
+++ scribus/plugins/import/pdf/importpdf.cpp	(working copy)
@@ -164,7 +164,7 @@
 	{
 		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;
 		}
Index: scribus/plugins/import/pm/importpm.cpp
===================================================================
--- scribus/plugins/import/pm/importpm.cpp	(revision 27090)
+++ scribus/plugins/import/pm/importpm.cpp	(working copy)
@@ -54,7 +54,7 @@
 	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 @@
 	{
 		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;
Index: scribus/plugins/import/pub/importpub.cpp
===================================================================
--- scribus/plugins/import/pub/importpub.cpp	(revision 27090)
+++ scribus/plugins/import/pub/importpub.cpp	(working copy)
@@ -57,7 +57,7 @@
 	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 @@
 	{
 		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;
Index: scribus/plugins/import/qxp/importqxp.cpp
===================================================================
--- scribus/plugins/import/qxp/importqxp.cpp	(revision 27090)
+++ scribus/plugins/import/qxp/importqxp.cpp	(working copy)
@@ -74,7 +74,7 @@
 	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 @@
 	{
 		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;
Index: scribus/plugins/import/shape/importshape.cpp
===================================================================
--- scribus/plugins/import/shape/importshape.cpp	(revision 27090)
+++ scribus/plugins/import/shape/importshape.cpp	(working copy)
@@ -72,7 +72,7 @@
 	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 @@
 	{
 		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;
Index: scribus/plugins/import/sml/importsml.cpp
===================================================================
--- scribus/plugins/import/sml/importsml.cpp	(revision 27090)
+++ scribus/plugins/import/sml/importsml.cpp	(working copy)
@@ -70,7 +70,7 @@
 	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 @@
 	{
 		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;
Index: scribus/plugins/import/svg/svgplugin.cpp
===================================================================
--- scribus/plugins/import/svg/svgplugin.cpp	(revision 27090)
+++ scribus/plugins/import/svg/svgplugin.cpp	(working copy)
@@ -237,7 +237,7 @@
 	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 @@
 	{
 		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;
 		}
Index: scribus/plugins/import/svm/importsvm.cpp
===================================================================
--- scribus/plugins/import/svm/importsvm.cpp	(revision 27090)
+++ scribus/plugins/import/svm/importsvm.cpp	(working copy)
@@ -308,7 +308,7 @@
 	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 @@
 	{
 		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);
Index: scribus/plugins/import/viva/importviva.cpp
===================================================================
--- scribus/plugins/import/viva/importviva.cpp	(revision 27090)
+++ scribus/plugins/import/viva/importviva.cpp	(working copy)
@@ -115,7 +115,7 @@
 	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 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 @@
 	{
 		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;
Index: scribus/plugins/import/vsd/importvsd.cpp
===================================================================
--- scribus/plugins/import/vsd/importvsd.cpp	(revision 27090)
+++ scribus/plugins/import/vsd/importvsd.cpp	(working copy)
@@ -67,7 +67,7 @@
 	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 @@
 	{
 		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;
Index: scribus/plugins/import/wmf/wmfimport.cpp
===================================================================
--- scribus/plugins/import/wmf/wmfimport.cpp	(revision 27090)
+++ scribus/plugins/import/wmf/wmfimport.cpp	(working copy)
@@ -301,7 +301,7 @@
 	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 @@
 	{
 		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;
 		}
Index: scribus/plugins/import/wpg/importwpg.cpp
===================================================================
--- scribus/plugins/import/wpg/importwpg.cpp	(revision 27090)
+++ scribus/plugins/import/wpg/importwpg.cpp	(working copy)
@@ -418,7 +418,7 @@
 	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 @@
 	{
 		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;
Index: scribus/plugins/import/xar/importxar.cpp
===================================================================
--- scribus/plugins/import/xar/importxar.cpp	(revision 27090)
+++ scribus/plugins/import/xar/importxar.cpp	(working copy)
@@ -70,7 +70,7 @@
 		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 @@
 	{
 		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;
Index: scribus/plugins/import/xfig/importxfig.cpp
===================================================================
--- scribus/plugins/import/xfig/importxfig.cpp	(revision 27090)
+++ scribus/plugins/import/xfig/importxfig.cpp	(working copy)
@@ -63,7 +63,7 @@
 	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 @@
 	{
 		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;
Index: scribus/plugins/import/xps/importxps.cpp
===================================================================
--- scribus/plugins/import/xps/importxps.cpp	(revision 27090)
+++ scribus/plugins/import/xps/importxps.cpp	(working copy)
@@ -112,7 +112,7 @@
 		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 @@
 	{
 		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;
Index: scribus/plugins/import/zmf/importzmf.cpp
===================================================================
--- scribus/plugins/import/zmf/importzmf.cpp	(revision 27090)
+++ scribus/plugins/import/zmf/importzmf.cpp	(working copy)
@@ -53,7 +53,7 @@
 	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 @@
 	{
 		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;
Index: scribus/plugins/scriptplugin/cmddoc.cpp
===================================================================
--- scribus/plugins/scriptplugin/cmddoc.cpp	(revision 27090)
+++ scribus/plugins/scriptplugin/cmddoc.cpp	(working copy)
@@ -71,7 +71,7 @@
 								// 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 @@
 	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));
 }
Index: scribus/plugins/shapes/shapepalette.cpp
===================================================================
--- scribus/plugins/shapes/shapepalette.cpp	(revision 27090)
+++ scribus/plugins/shapes/shapepalette.cpp	(working copy)
@@ -217,7 +217,7 @@
 		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);
Index: scribus/prefsmanager.cpp
===================================================================
--- scribus/prefsmanager.cpp	(revision 27090)
+++ scribus/prefsmanager.cpp	(working copy)
@@ -1377,8 +1377,8 @@
 	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 @@
 			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));
Index: scribus/sampleitem.cpp
===================================================================
--- scribus/sampleitem.cpp	(revision 27090)
+++ scribus/sampleitem.cpp	(working copy)
@@ -28,7 +28,7 @@
 	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);
Index: scribus/scpreview.cpp
===================================================================
--- scribus/scpreview.cpp	(revision 27090)
+++ scribus/scpreview.cpp	(working copy)
@@ -43,7 +43,7 @@
 		}
 
 		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);
Index: scribus/scribus.cpp
===================================================================
--- scribus/scribus.cpp	(revision 27090)
+++ scribus/scribus.cpp	(working copy)
@@ -337,7 +337,7 @@
 	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);
@@ -2038,7 +2038,7 @@
 			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());
@@ -2114,7 +2114,7 @@
 	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()))
 	{
@@ -2136,12 +2136,12 @@
 }
 
 //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();
@@ -8673,7 +8673,7 @@
 					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);
@@ -8711,7 +8711,7 @@
 				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);
@@ -9225,7 +9225,7 @@
 			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);
Index: scribus/scribus.h
===================================================================
--- scribus/scribus.h	(revision 27090)
+++ scribus/scribus.h	(working copy)
@@ -154,8 +154,8 @@
 	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;
Index: scribus/scribusdoc.cpp
===================================================================
--- scribus/scribusdoc.cpp	(revision 27090)
+++ scribus/scribusdoc.cpp	(working copy)
@@ -680,12 +680,13 @@
 	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);
Index: scribus/scribusdoc.h
===================================================================
--- scribus/scribusdoc.h	(revision 27090)
+++ scribus/scribusdoc.h	(working copy)
@@ -107,7 +107,7 @@
 	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);
@@ -222,10 +222,10 @@
 
 	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; }
Index: scribus/ui/colorsandfills.cpp
===================================================================
--- scribus/ui/colorsandfills.cpp	(revision 27090)
+++ scribus/ui/colorsandfills.cpp	(working copy)
@@ -1951,7 +1951,7 @@
 	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);
Index: scribus/ui/inspage.cpp
===================================================================
--- scribus/ui/inspage.cpp	(revision 27090)
+++ scribus/ui/inspage.cpp	(working copy)
@@ -248,7 +248,7 @@
 	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);
Index: scribus/ui/newdocdialog.cpp
===================================================================
--- scribus/ui/newdocdialog.cpp	(revision 27090)
+++ scribus/ui/newdocdialog.cpp	(working copy)
@@ -133,7 +133,6 @@
 {
 	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 @@
 		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 @@
 	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 @@
 	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 @@
 	pageCountLabel->setPixmap(iconManager.loadPixmap("panel-page"));
 
 	setDocLayout(pagePositioning);
-	setSize(pageSize);
+	setSize(QSizeF(pageWidth, pageHeight));
 	setOrientation(orientation);
 
 	numberOfCols->setButtonSymbols( QSpinBox::UpDownArrows );
@@ -341,8 +338,8 @@
 	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 @@
 	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::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 @@
 		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 @@
 	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,27 +539,22 @@
 	}
 }
 
-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);
@@ -566,16 +561,15 @@
 	}
 	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 @@
 	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 @@
 	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 @@
 	if (listPageFormats->category() == category)
 		return;
 
-	listPageFormats->setFormat(m_pageSize);
-	listPageFormats->setCategory(category);
+	listPageFormats->setValues(QSizeF(m_pageWidth, m_pageHeight), listPageFormats->orientation(), category, listPageFormats->sortMode());
 }
Index: scribus/ui/newdocdialog.h
===================================================================
--- scribus/ui/newdocdialog.h	(revision 27090)
+++ scribus/ui/newdocdialog.h	(working copy)
@@ -61,8 +61,7 @@
 	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 @@
 	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 @@
 	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 };
Index: scribus/ui/newmarginwidget.cpp
===================================================================
--- scribus/ui/newmarginwidget.cpp	(revision 27090)
+++ scribus/ui/newmarginwidget.cpp	(working copy)
@@ -7,11 +7,12 @@
 
 #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)
@@ -300,12 +301,6 @@
 	emit marginChanged(m_marginData);
 }
 
-void NewMarginWidget::setPageSize(const QString& pageSize)
-{
-	m_pageSize = pageSize;
-}
-
-
 void NewMarginWidget::updateMarginSpinValues()
 {
 	bool leftBlocked = leftMarginSpinBox->blockSignals(true);
@@ -401,7 +396,9 @@
 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;
 
Index: scribus/ui/newmarginwidget.h
===================================================================
--- scribus/ui/newmarginwidget.h	(revision 27090)
+++ scribus/ui/newmarginwidget.h	(working copy)
@@ -36,8 +36,6 @@
 		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 */
@@ -64,7 +62,6 @@
 
 		MarginStruct m_marginData;
 		MarginStruct m_savedMarginData;
-		QString m_pageSize;
 		bool   m_facingPages {false};
 		double m_pageHeight {0.0};
 		double m_pageWidth {0.0};
Index: scribus/ui/pagepropertiesdialog.cpp
===================================================================
--- scribus/ui/pagepropertiesdialog.cpp	(revision 27090)
+++ scribus/ui/pagepropertiesdialog.cpp	(working copy)
@@ -59,7 +59,7 @@
 	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 @@
 	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)));
 }
Index: scribus/ui/prefs_documentsetup.cpp
===================================================================
--- scribus/ui/prefs_documentsetup.cpp	(revision 27090)
+++ scribus/ui/prefs_documentsetup.cpp	(working copy)
@@ -184,12 +184,10 @@
 	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::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 @@
 {
 	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 @@
 {
 	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 @@
 	pageHeightSpinBox->setValue(pageH * unitRatio);
 	marginsWidget->setPageHeight(pageH);
 	marginsWidget->setPageWidth(pageW);
-	marginsWidget->setPageSize(newSize);
 	pageWidthSpinBox->blockSignals(false);
 	pageHeightSpinBox->blockSignals(false);
 }
Index: scribus/ui/prefs_pdfexport.cpp
===================================================================
--- scribus/ui/prefs_pdfexport.cpp	(revision 27090)
+++ scribus/ui/prefs_pdfexport.cpp	(working copy)
@@ -413,7 +413,6 @@
 	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);
Index: scribus/ui/widgets/pagesizelist.cpp
===================================================================
--- scribus/ui/widgets/pagesizelist.cpp	(revision 27090)
+++ scribus/ui/widgets/pagesizelist.cpp	(working copy)
@@ -39,16 +39,16 @@
 	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);
 }
@@ -55,7 +55,7 @@
 
 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::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 @@
 	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 @@
 			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();
+
 		}
 	}
 
Index: scribus/ui/widgets/pagesizelist.h
===================================================================
--- scribus/ui/widgets/pagesizelist.h	(revision 27090)
+++ scribus/ui/widgets/pagesizelist.h	(working copy)
@@ -33,13 +33,14 @@
 		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,12 +51,12 @@
 	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};
@@ -62,7 +63,7 @@
 	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);
 };
 
 
Index: scribus/ui/widgets/pagesizepreview.h
===================================================================
--- scribus/ui/widgets/pagesizepreview.h	(revision 27090)
+++ scribus/ui/widgets/pagesizepreview.h	(working copy)
@@ -13,20 +13,26 @@
 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;
Index: scribus/ui/widgets/pagesizeselector.cpp
===================================================================
--- scribus/ui/widgets/pagesizeselector.cpp	(revision 27090)
+++ scribus/ui/widgets/pagesizeselector.cpp	(working copy)
@@ -49,7 +49,7 @@
 	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 @@
 		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 @@
 	{
 		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 @@
 	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())
Index: scribus/ui/widgets/pagesizeselector.h
===================================================================
--- scribus/ui/widgets/pagesizeselector.h	(revision 27090)
+++ scribus/ui/widgets/pagesizeselector.h	(working copy)
@@ -29,7 +29,7 @@
 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 @@
 
 	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:
17652_patchupdate.diff (79,135 bytes)   

nitramr

2026-01-03 15:43

developer   ~0053411

I updated the patch to SVN version (27285) and added an option to save and load user page presets.
As a foundation of this feature, I moved all page size templates from code into external files. This allows us to resolve issues without recompiling Scribus.
User page presets are saved in a separate folder to avoid a conflict with Scribus's default presets.

The user preset saves all page properties from the new doc dialog (width, height, orientation, first page, single/double page, margins, bleeds, text frame option... all except page numbers).
In the preset picker on the new doc dialog, you will see a new "User" section where you can see your custom presets. A preset can be deleted by right-clicking.

Limitations:
Currently, the user's page preset collection is auto generated and as a user, you can't edit the name or add more than this one.
You can't edit a user page preset. You need to save a modified copy and delete the old one.

PS:
The new PagePresetManager has functions to update existing page presets and collections, but it is not implemented in UI yet.
If you want to have more than one user page preset collection, you can add them manually in the user pagepreset folder.
user_page_preset.png (43,829 bytes)   
user_page_preset.png (43,829 bytes)   

nitramr

2026-01-03 21:21

developer   ~0053412

pagepresets_2026-01-03_02.diff (313,128 bytes)   
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6b45863d3..2c747fbc0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -550,6 +550,7 @@ add_subdirectory(resources/iconsets)
 add_subdirectory(resources/keysets)
 add_subdirectory(resources/loremipsum)
 add_subdirectory(resources/manpages)
+add_subdirectory(resources/pagepresets)
 add_subdirectory(resources/profiles)
 add_subdirectory(resources/swatches)
 add_subdirectory(resources/templates)
diff --git a/CMakeLists_Directories.cmake b/CMakeLists_Directories.cmake
index 264f01a97..1095159be 100644
--- a/CMakeLists_Directories.cmake
+++ b/CMakeLists_Directories.cmake
@@ -71,6 +71,21 @@ else()
 	add_definitions(-DICONDIR="${ICONDIR}")
 endif()
 
+#PAGEPRESETDIR
+if(WIN32)
+	set(PAGEPRESETSDIR "${CMAKE_INSTALL_DATAROOTDIR}/pagepresets/")
+else()
+	set(PAGEPRESETSDIR "${CMAKE_INSTALL_DATAROOTDIR}/${MAIN_DIR_NAME}${TAG_VERSION}/pagepresets/")
+endif()
+
+if(IS_ABSOLUTE ${PAGEPRESETSDIR} AND WANT_RELOCATABLE)
+	message(FATAL_ERROR "ERROR: PAGEPRESETSDIR must be relative when using WANT_RELOCATABLE option")
+elseif(NOT IS_ABSOLUTE ${PAGEPRESETSDIR} AND NOT WANT_RELOCATABLE)
+	add_definitions(-DPAGEPRESETSDIR="${CMAKE_INSTALL_PREFIX}/${PAGEPRESETSDIR}")
+else()
+	add_definitions(-DPAGEPRESETSDIR="${PAGEPRESETSDIR}")
+endif()
+
 #SAMPLES
 if(WIN32)
 	set(SAMPLESDIR "${CMAKE_INSTALL_DATAROOTDIR}/samples/")
diff --git a/resources/iconsets/1_7_0/1_7_0.xml b/resources/iconsets/1_7_0/1_7_0.xml
index 3f707ec7f..2385fd18b 100644
--- a/resources/iconsets/1_7_0/1_7_0.xml
+++ b/resources/iconsets/1_7_0/1_7_0.xml
@@ -116,6 +116,7 @@ On Dark:  #e580ff; rgb(229, 128, 255); hsl(288, 100, 75)
 		<icon id="rotate-ccw" file="16/action-rotate-left.svg" />
 		<icon id="rotate-cw" file="16/action-rotate-right.svg" />
 		<icon id="round-corners" file="16/object-rounded-corner.svg" />
+		<icon id="save" file="16/action-save.svg" />
 		<icon id="scale-height" file="16/action-scale-height.svg" />
 		<icon id="scale-width" file="16/action-scale-width.svg" />
 		<icon id="settings" file="16/properties-external-tools.svg" />
@@ -399,6 +400,7 @@ On Dark:  #e580ff; rgb(229, 128, 255); hsl(288, 100, 75)
 		<icon id="page-simple" file="16/page-type-single.svg" />
 		<icon id="page-sizes" file="16/page-sizes.svg" />
 		<icon id="show-object" file="16/object-visible.svg" />
+		<icon onLight="#E54545" onDark="#FF6666" id="user-page-preset" file="16/draw-heart.svg" />
     
 		<!-- PDF Tools -->
 		<icon id="pdf-annotation-3d" file="16/pdf-annotation-3d.svg" />
diff --git a/resources/install.targets b/resources/install.targets
index ab918e8f7..1d06164c7 100644
--- a/resources/install.targets
+++ b/resources/install.targets
@@ -5,8 +5,9 @@
 	<Import Project="iconsets\install.targets" />
 	<Import Project="keysets\install.targets" />
 	<Import Project="loremipsum\install.targets" />
+	<Import Project="pagepresets\install.targets" />
 	<Import Project="profiles\install.targets" />
 	<Import Project="swatches\install.targets" />
 	<Import Project="templates\install.targets" />
 	<Import Project="unicodemap\install.targets" />
-</Project>
\ No newline at end of file
+</Project>
diff --git a/resources/pagepresets/Books.xml b/resources/pagepresets/Books.xml
new file mode 100644
index 000000000..781c967c3
--- /dev/null
+++ b/resources/pagepresets/Books.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<collection id="1vr4vpmdzKHvVtNWoCHn3J" name="Books" minVersion="1.7.2" version="1.7.2">
+    <metadata>
+        <author>Scribus</author>
+        <license>CC0</license>
+        <names>
+            <name lang="en_US">Books</name>
+            <name lang="de">Bücher</name>
+        </names>
+    </metadata>
+    <pages>
+        <page id="00000" unit="in" width="5" height="7.375" name="12mo (Duodecimo)"/>
+        <page id="00001" unit="in" width="4" height="6.75" name="16mo (Sextodecimo)"/>
+        <page id="00002" unit="in" width="4" height="6.5" name="18mo (Octodecimo)"/>
+        <page id="00003" unit="in" width="3.5" height="5.5" name="32mo (Tricesimo Secondo)"/>
+        <page id="00004" unit="in" width="2.5" height="4" name="48mo (Quadragesimo Octavo)"/>
+        <page id="00005" unit="in" width="9.5" height="12" name="4to (Quarto)"/>
+        <page id="00006" unit="in" width="2" height="3" name="64mo (Sexagesimo Quarto)"/>
+        <page id="00007" unit="in" width="5.375" height="8" name="8vo (Crown Octavo)"/>
+        <page id="00008" unit="in" width="8.25" height="11.5" name="8vo (Imperial Octavo)"/>
+        <page id="00009" unit="in" width="6.5" height="9.25" name="8vo (Medium Octavo)"/>
+        <page id="00010" unit="in" width="6" height="9" name="8vo (Octavo)"/>
+        <page id="00011" unit="in" width="6.25" height="10" name="8vo (Royal Octavo)"/>
+        <page id="00012" unit="in" width="7" height="11" name="8vo (Super Octavo)"/>
+        <page id="00013" unit="in" width="4.25" height="7" name="A Format"/>
+        <page id="00014" unit="in" width="5.1" height="7.75" name="B Format"/>
+        <page id="00015" unit="in" width="5.25" height="8.5" name="C Format"/>
+        <page id="00016" unit="in" width="6.63" height="10.25" name="Comic Book">
+	    <names>
+	        <name lang="en_US">Comic Book</name>
+	        <name lang="de">Comic-Buch</name>
+	    </names>
+        </page>
+        <page id="00017" unit="mm" width="189" height="246" name="Crown Quarto"/>
+        <page id="00018" unit="in" width="12" height="19" name="Folio"/>
+    </pages>
+</collection>
diff --git a/resources/pagepresets/Business_Cards.xml b/resources/pagepresets/Business_Cards.xml
new file mode 100644
index 000000000..601e9a506
--- /dev/null
+++ b/resources/pagepresets/Business_Cards.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<collection id="3B8Fnc4pRStCkKRhmvAqFV" name="Business Cards" minVersion="1.7.2" version="1.7.2">
+    <metadata>
+        <author>Scribus</author>
+        <license>CC0</license>
+        <names>
+            <name lang="en_US">Business Cards</name>
+            <name lang="de">Visitenkarten</name>
+        </names>
+    </metadata>
+    <pages>
+        <page id="00000" unit="mm" width="90" height="54" name="China"/>
+        <page id="00001" unit="mm" width="85" height="55" name="Europe">
+	    <names>
+	        <name lang="en_US">Europe</name>
+	        <name lang="de">Europa</name>
+	    </names>
+        </page>
+        <page id="00002" unit="mm" width="90" height="50" name="Hungary">
+	    <names>
+	        <name lang="en_US">Hungary</name>
+	        <name lang="de">Ungarn</name>
+	    </names>
+        </page>
+        <page id="00003" unit="mm" width="74" height="52" name="ISO 216"/>
+        <page id="00004" unit="mm" width="85.6" height="54" name="ISO 7810 ID-1"/>
+        <page id="00005" unit="mm" width="85" height="48" name="Iran"/>
+        <page id="00006" unit="mm" width="91" height="55" name="Japan"/>
+        <page id="00007" unit="mm" width="90" height="55" name="India, Scandinavia">
+	    <names>
+	        <name lang="en_US">India, Scandinavia</name>
+	        <name lang="de">Indien, Skandinavien</name>
+	    </names>
+        </page>
+        <page id="00008" unit="in" width="3.5" height="2" name="US/Canada" orientation="1">
+	    <names>
+	        <name lang="en_US">US/Canada</name>
+	        <name lang="de">US/Kanada</name>
+	    </names>
+        </page>
+    </pages>
+</collection>
diff --git a/resources/pagepresets/CMakeLists.txt b/resources/pagepresets/CMakeLists.txt
new file mode 100644
index 000000000..e67bb6d7e
--- /dev/null
+++ b/resources/pagepresets/CMakeLists.txt
@@ -0,0 +1,7 @@
+include_directories(
+"${CMAKE_SOURCE_DIR}/scribus"
+)
+
+#Install our page preset files, selected from *.xml in this directory
+file( GLOB SCRIBUS_PAGEPRESET_FILES *.xml )
+install(FILES ${SCRIBUS_PAGEPRESET_FILES} DESTINATION ${PAGEPRESETSDIR})
diff --git a/resources/pagepresets/Canadian.xml b/resources/pagepresets/Canadian.xml
new file mode 100644
index 000000000..b1f3ca232
--- /dev/null
+++ b/resources/pagepresets/Canadian.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<collection id="48pmjdi5oHMHQwzRrwgM1j" name="Canadian" minVersion="1.7.2" version="1.7.2">
+    <metadata>
+        <author>Scribus</author>
+        <license>CC0</license>
+        <names>
+            <name lang="en_US">Canadian</name>
+            <name lang="de">Kanadisch</name>
+        </names>
+    </metadata>
+    <pages>
+        <page id="00000" unit="mm" width="560" height="860" name="P1"/>
+        <page id="00001" unit="mm" width="430" height="560" name="P2"/>
+        <page id="00002" unit="mm" width="280" height="430" name="P3"/>
+        <page id="00003" unit="mm" width="215" height="280" name="P4"/>
+        <page id="00004" unit="mm" width="140" height="215" name="P5"/>
+        <page id="00005" unit="mm" width="107" height="140" name="P6"/>
+    </pages>
+</collection>
diff --git a/resources/pagepresets/Chinese.xml b/resources/pagepresets/Chinese.xml
new file mode 100644
index 000000000..096c9475f
--- /dev/null
+++ b/resources/pagepresets/Chinese.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<collection id="26Aea4rG4Omg83cpd0vosr" name="Chinese" minVersion="1.7.2" version="1.7.2">
+    <metadata>
+        <author>Scribus</author>
+        <license>CC0</license>
+        <names>
+            <name lang="en_US">Chinese</name>
+            <name lang="de">Chinesisch</name>
+        </names>
+    </metadata>
+    <pages>
+        <page id="00000" unit="mm" width="764" height="1064" name="D0"/>
+        <page id="00001" unit="mm" width="532" height="760" name="D1"/>
+        <page id="00002" unit="mm" width="380" height="528" name="D2"/>
+        <page id="00003" unit="mm" width="264" height="375" name="D3"/>
+        <page id="00004" unit="mm" width="188" height="260" name="D4"/>
+        <page id="00005" unit="mm" width="130" height="184" name="D5"/>
+        <page id="00006" unit="mm" width="92" height="126" name="D6"/>
+        <page id="00007" unit="mm" width="787" height="1092" name="RD0"/>
+        <page id="00008" unit="mm" width="546" height="787" name="RD1"/>
+        <page id="00009" unit="mm" width="393" height="546" name="RD2"/>
+        <page id="00010" unit="mm" width="273" height="393" name="RD3"/>
+        <page id="00011" unit="mm" width="196" height="273" name="RD4"/>
+        <page id="00012" unit="mm" width="136" height="196" name="RD5"/>
+        <page id="00013" unit="mm" width="98" height="136" name="RD6"/>
+    </pages>
+</collection>
diff --git a/resources/pagepresets/Colombian.xml b/resources/pagepresets/Colombian.xml
new file mode 100644
index 000000000..7163e76f6
--- /dev/null
+++ b/resources/pagepresets/Colombian.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<collection id="3CXbAxd9ZvKGAbA35YBQgE" name="Colombian" minVersion="1.7.2" version="1.7.2">
+    <metadata>
+        <author>Scribus</author>
+        <license>CC0</license>
+        <names>
+            <name lang="en_US">Colombian</name>
+            <name lang="de">Kolumbianisch</name>
+        </names>
+    </metadata>
+    <pages>
+        <page id="00000" unit="mm" width="500" height="700" name="1/2 Pliego"/>
+        <page id="00001" unit="mm" width="350" height="500" name="1/4 Pliego"/>
+        <page id="00002" unit="mm" width="250" height="350" name="1/8 Pliego"/>
+        <page id="00003" unit="mm" width="216" height="279" name="Carta"/>
+        <page id="00004" unit="mm" width="304" height="457.2" name="Extra Tabloide"/>
+        <page id="00005" unit="mm" width="216" height="330" name="Oficio"/>
+        <page id="00006" unit="mm" width="700" height="1000" name="Pliego"/>
+    </pages>
+</collection>
diff --git a/resources/pagepresets/French.xml b/resources/pagepresets/French.xml
new file mode 100644
index 000000000..360098835
--- /dev/null
+++ b/resources/pagepresets/French.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<collection id="3VCpPjZIdBPGQmV3j664Ir" name="French" minVersion="1.7.2" version="1.7.2">
+    <metadata>
+        <author>Scribus</author>
+        <license>CC0</license>
+        <names>
+            <name lang="en_US">French</name>
+            <name lang="de">Französisch</name>
+        </names>
+    </metadata>
+    <pages>
+        <page id="00000" unit="mm" width="450" height="560" name="Carré"/>
+        <page id="00001" unit="mm" width="460" height="620" name="Cavalier"/>
+        <page id="00002" unit="mm" width="300" height="400" name="Cloche"/>
+        <page id="00003" unit="mm" width="600" height="800" name="Colombier affiche"/>
+        <page id="00004" unit="mm" width="630" height="900" name="Colombier commercial"/>
+        <page id="00005" unit="mm" width="440" height="560" name="Coquille"/>
+        <page id="00006" unit="mm" width="360" height="360" name="Couronne écriture"/>
+        <page id="00007" unit="mm" width="370" height="470" name="Couronne édition"/>
+        <page id="00008" unit="mm" width="325" height="500" name="Demi-raisin"/>
+        <page id="00009" unit="mm" width="650" height="1000" name="Double Raisin"/>
+        <page id="00010" unit="mm" width="400" height="520" name="Écu"/>
+        <page id="00011" unit="mm" width="750" height="1050" name="Grand Aigle"/>
+        <page id="00012" unit="mm" width="900" height="1260" name="Grand Monde"/>
+        <page id="00013" unit="mm" width="560" height="760" name="Jésus"/>
+        <page id="00014" unit="mm" width="700" height="940" name="Petit Aigle"/>
+        <page id="00015" unit="mm" width="310" height="400" name="Pot, écolier"/>
+        <page id="00016" unit="mm" width="500" height="650" name="Raisin"/>
+        <page id="00017" unit="mm" width="390" height="500" name="Roberto"/>
+        <page id="00018" unit="mm" width="600" height="800" name="Soleil"/>
+        <page id="00019" unit="mm" width="340" height="440" name="Tellière"/>
+        <page id="00020" unit="mm" width="1000" height="1130" name="Univers"/>
+    </pages>
+</collection>
diff --git a/resources/pagepresets/German.xml b/resources/pagepresets/German.xml
new file mode 100644
index 000000000..d37b2b628
--- /dev/null
+++ b/resources/pagepresets/German.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<collection id="5ERUrUQp2TpRzMkHc0ZWok" name="German" minVersion="1.7.2" version="1.7.2">
+    <metadata>
+        <author>Scribus</author>
+        <license>CC0</license>
+        <names>
+            <name lang="en_US">German</name>
+            <name lang="de">Deutsch</name>
+        </names>
+    </metadata>
+    <pages>
+        <page id="00000" unit="mm" width="771" height="1090" name="DIN D0"/>
+        <page id="00001" unit="mm" width="545" height="771" name="DIN D1"/>
+        <page id="00002" unit="mm" width="385" height="545" name="DIN D2"/>
+        <page id="00003" unit="mm" width="272" height="385" name="DIN D3"/>
+        <page id="00004" unit="mm" width="192" height="272" name="DIN D4"/>
+        <page id="00005" unit="mm" width="136" height="192" name="DIN D5"/>
+        <page id="00006" unit="mm" width="96" height="136" name="DIN D6"/>
+        <page id="00007" unit="mm" width="68" height="96" name="DIN D7"/>
+        <page id="00008" unit="mm" width="48" height="68" name="DIN D8"/>
+        <page id="00009" unit="mm" width="34" height="48" name="DIN D9"/>
+        <page id="00010" unit="mm" width="24" height="34" name="DIN D10"/>
+    </pages>
+</collection>
diff --git a/resources/pagepresets/ISO_A_Paper.xml b/resources/pagepresets/ISO_A_Paper.xml
new file mode 100644
index 000000000..069624028
--- /dev/null
+++ b/resources/pagepresets/ISO_A_Paper.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<collection id="FzlMfpPelK5894hHnoLDC" name="ISO A Paper" minVersion="1.7.2" version="1.7.2">
+    <metadata>
+        <author>Scribus</author>
+        <license>CC0</license>
+        <names>
+            <name lang="en_US">ISO A Paper</name>
+            <name lang="de">ISO A Papier</name>
+        </names>
+    </metadata>
+    <pages>
+        <page id="00000" unit="mm" width="1189" height="1682" name="2A0" legacyNames="IsoA_2A0"/>
+        <page id="00001" unit="mm" width="1682" height="2378" name="4A0" legacyNames="IsoA_4A0"/>
+        <page id="00002" unit="mm" width="841" height="1189" name="A0" legacyNames="IsoA_A00"/>
+        <page id="00003" unit="mm" width="914" height="1292" name="A0+" legacyNames="IsoA_A00+"/>
+        <page id="00004" unit="mm" width="594" height="841" name="A1" legacyNames="IsoA_A01"/>
+        <page id="00005" unit="mm" width="609" height="914" name="A1+" legacyNames="IsoA_A01+"/>
+        <page id="00006" unit="mm" width="420" height="594" name="A2" legacyNames="IsoA_A02"/>
+        <page id="00007" unit="mm" width="297" height="420" name="A3" legacyNames="IsoA_A03"/>
+        <page id="00008" unit="mm" width="329" height="483" name="A3+" legacyNames="IsoA_A03+"/>
+        <page id="00009" unit="mm" width="210" height="297" name="A4" legacyNames="IsoA_A04"/>
+        <page id="00010" unit="mm" width="148" height="210" name="A5" legacyNames="IsoA_A05"/>
+        <page id="00011" unit="mm" width="105" height="148" name="A6" legacyNames="IsoA_A06"/>
+        <page id="00012" unit="mm" width="74" height="105" name="A7" legacyNames="IsoA_A07"/>
+        <page id="00013" unit="mm" width="52" height="74" name="A8" legacyNames="IsoA_A08"/>
+        <page id="00014" unit="mm" width="37" height="52" name="A9" legacyNames="IsoA_A09"/>
+        <page id="00015" unit="mm" width="26" height="37" name="A10" legacyNames="IsoA_A10"/>
+    </pages>
+</collection>
diff --git a/resources/pagepresets/ISO_B_Paper.xml b/resources/pagepresets/ISO_B_Paper.xml
new file mode 100644
index 000000000..83eac877a
--- /dev/null
+++ b/resources/pagepresets/ISO_B_Paper.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<collection id="30dag4PXhnVBczm2YsnTU2" name="ISO B Paper" minVersion="1.7.2" version="1.7.2">
+    <metadata>
+        <author>Scribus</author>
+        <license>CC0</license>
+        <names>
+            <name lang="en_US">ISO B Paper</name>
+            <name lang="de">ISO B Papier</name>
+        </names>
+    </metadata>
+    <pages>
+        <page id="00000" unit="mm" width="1000" height="1414" name="B0"/>
+        <page id="00001" unit="mm" width="1118" height="1580" name="B0+"/>
+        <page id="00002" unit="mm" width="707" height="1000" name="B1"/>
+        <page id="00003" unit="mm" width="720" height="1020" name="B1+"/>
+        <page id="00004" unit="mm" width="500" height="707" name="B2"/>
+        <page id="00005" unit="mm" width="520" height="720" name="B2+"/>
+        <page id="00006" unit="mm" width="353" height="500" name="B3"/>
+        <page id="00007" unit="mm" width="250" height="353" name="B4"/>
+        <page id="00008" unit="mm" width="176" height="250" name="B5"/>
+        <page id="00009" unit="mm" width="125" height="176" name="B6"/>
+        <page id="00010" unit="mm" width="88" height="125" name="B7"/>
+        <page id="00011" unit="mm" width="62" height="88" name="B8"/>
+        <page id="00012" unit="mm" width="44" height="62" name="B9"/>
+        <page id="00013" unit="mm" width="31" height="44" name="B10"/>
+    </pages>
+</collection>
diff --git a/resources/pagepresets/ISO_C_Envelope.xml b/resources/pagepresets/ISO_C_Envelope.xml
new file mode 100644
index 000000000..bcf0ef11d
--- /dev/null
+++ b/resources/pagepresets/ISO_C_Envelope.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<collection id="3WC9fBTWa7bFfpQMvDcy11" name="ISO C Envelope" minVersion="1.7.2" version="1.7.2">
+    <metadata>
+        <author>Scribus</author>
+        <license>CC0</license>
+        <names>
+            <name lang="en_US">ISO C Envelope</name>
+            <name lang="de">ISO C Umschläge</name>
+        </names>
+    </metadata>
+    <pages>
+        <page id="00000" unit="mm" width="917" height="1297" name="C0"/>
+        <page id="00001" unit="mm" width="648" height="917" name="C1"/>
+        <page id="00002" unit="mm" width="458" height="648" name="C2"/>
+        <page id="00003" unit="mm" width="324" height="458" name="C3"/>
+        <page id="00004" unit="mm" width="229" height="324" name="C4"/>
+        <page id="00005" unit="mm" width="162" height="229" name="C5"/>
+        <page id="00006" unit="mm" width="114" height="162" name="C6"/>
+        <page id="00007" unit="mm" width="81" height="114" name="C7"/>
+        <page id="00008" unit="mm" width="57" height="81" name="C8"/>
+        <page id="00009" unit="mm" width="40" height="57" name="C9"/>
+        <page id="00010" unit="mm" width="28" height="40" name="C10"/>
+    </pages>
+</collection>
diff --git a/resources/pagepresets/Imperial.xml b/resources/pagepresets/Imperial.xml
new file mode 100644
index 000000000..c5d8ca0af
--- /dev/null
+++ b/resources/pagepresets/Imperial.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<collection id="2JZKolhGaH42V9TAo1RuaY" name="Imperial" minVersion="1.7.2" version="1.7.2">
+    <metadata>
+        <author>Scribus</author>
+        <license>CC0</license>
+        <names>
+            <name lang="en_US">Imperial</name>
+        </names>
+    </metadata>
+    <pages>
+        <page id="00000" unit="in" width="15" height="20" name="Crown"/>
+        <page id="00001" unit="in" width="17.5" height="22.5" name="Demy"/>
+        <page id="00002" unit="in" width="22.5" height="35" name="Double Demy"/>
+        <page id="00003" unit="in" width="23" height="28" name="Elephant"/>
+        <page id="00004" unit="in" width="7.25" height="10.5" name="Executive"/>
+        <page id="00005" unit="in" width="8" height="13" name="Foolscap"/>
+        <page id="00006" unit="in" width="16.5" height="21" name="Large Post"/>
+        <page id="00007" unit="in" width="18" height="23" name="Medium"/>
+        <page id="00008" unit="in" width="15.5" height="19.25" name="Post"/>
+        <page id="00009" unit="in" width="35" height="45" name="Quad Demy"/>
+        <page id="00010" unit="in" width="8" height="10" name="Quarto"/>
+        <page id="00011" unit="in" width="20" height="25" name="Royal"/>
+        <page id="00012" unit="in" width="5.5" height="8.5" name="STMT"/>
+    </pages>
+</collection>
diff --git a/resources/pagepresets/International_Envelopes.xml b/resources/pagepresets/International_Envelopes.xml
new file mode 100644
index 000000000..813bf21ff
--- /dev/null
+++ b/resources/pagepresets/International_Envelopes.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<collection id="wqubwm7de8ooiQ88AXyG6" name="International Envelopes" minVersion="1.7.2" version="1.7.2">
+    <metadata>
+        <author>Scribus</author>
+        <license>CC0</license>
+        <names>
+            <name lang="en_US">International Envelopes</name>
+            <name lang="de">Internationale Briefumschläge</name>
+        </names>
+    </metadata>
+    <pages>
+        <page id="00000" unit="mm" width="324" height="125" name="B6/C4"/>
+        <page id="00001" unit="mm" width="318" height="229" name="C4M"/>
+        <page id="00002" unit="mm" width="229" height="114" name="C6/C5"/>
+        <page id="00003" unit="mm" width="318" height="114" name="C64M"/>
+        <page id="00004" unit="mm" width="162" height="81" name="C7/C6"/>
+        <page id="00005" unit="mm" width="220" height="110" name="DL, E65"/>
+        <page id="00006" unit="mm" width="312" height="220" name="E4"/>
+        <page id="00007" unit="mm" width="220" height="115" name="E5"/>
+        <page id="00008" unit="mm" width="115" height="115" name="E56"/>
+        <page id="00009" unit="mm" width="155" height="110" name="E6"/>
+        <page id="00010" unit="mm" width="229" height="220" name="EC45"/>
+        <page id="00011" unit="mm" width="229" height="155" name="EC5"/>
+        <page id="00012" unit="mm" width="216" height="115" name="EX5"/>
+        <page id="00013" unit="mm" width="135" height="120" name="R7"/>
+        <page id="00014" unit="mm" width="330" height="250" name="S4"/>
+        <page id="00015" unit="mm" width="255" height="185" name="S5"/>
+        <page id="00016" unit="mm" width="225" height="110" name="S65"/>
+        <page id="00017" unit="mm" width="216" height="105" name="X5"/>
+    </pages>
+</collection>
diff --git a/resources/pagepresets/Japanese.xml b/resources/pagepresets/Japanese.xml
new file mode 100644
index 000000000..bae9f1277
--- /dev/null
+++ b/resources/pagepresets/Japanese.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<collection id="6R1ClF2BAAN4npRFJLRH29" name="Japanese" minVersion="1.7.2" version="1.7.2">
+    <metadata>
+        <author>Scribus</author>
+        <license>CC0</license>
+        <names>
+            <name lang="en_US">Japanese</name>
+            <name lang="de">Japanisch</name>
+        </names>
+    </metadata>
+    <pages>
+        <page id="00000" unit="mm" width="1030" height="1456" name="JB0"/>
+        <page id="00001" unit="mm" width="728" height="1030" name="JB1"/>
+        <page id="00002" unit="mm" width="515" height="728" name="JB2"/>
+        <page id="00003" unit="mm" width="364" height="515" name="JB3"/>
+        <page id="00004" unit="mm" width="257" height="364" name="JB4"/>
+        <page id="00005" unit="mm" width="182" height="257" name="JB5"/>
+        <page id="00006" unit="mm" width="128" height="182" name="JB6"/>
+        <page id="00007" unit="mm" width="91" height="128" name="JB7"/>
+        <page id="00008" unit="mm" width="64" height="91" name="JB8"/>
+        <page id="00009" unit="mm" width="45" height="64" name="JB9"/>
+        <page id="00010" unit="mm" width="32" height="45" name="JB10"/>
+        <page id="00011" unit="mm" width="22" height="32" name="JB11"/>
+        <page id="00012" unit="mm" width="16" height="22" name="JB12"/>
+        <page id="00013" unit="mm" width="227" height="306" name="Kiku 4"/>
+        <page id="00014" unit="mm" width="151" height="227" name="Kiku 5"/>
+        <page id="00015" unit="mm" width="264" height="379" name="Shiroku ban 4"/>
+        <page id="00016" unit="mm" width="189" height="262" name="Shiroku ban 5"/>
+        <page id="00017" unit="mm" width="127" height="188" name="Shiroku ban 6"/>
+    </pages>
+</collection>
diff --git a/resources/pagepresets/Newspapers.xml b/resources/pagepresets/Newspapers.xml
new file mode 100644
index 000000000..de0c9d182
--- /dev/null
+++ b/resources/pagepresets/Newspapers.xml
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<collection id="6lwP3dWCNF2pPoHAqiiIxY" name="Newspapers" minVersion="1.7.2" version="1.7.2">
+    <metadata>
+        <author>Scribus</author>
+        <license>CC0</license>
+        <names>
+            <name lang="en_US">Newspapers</name>
+            <name lang="de">Zeitungen</name>
+        </names>
+    </metadata>
+    <pages>
+        <page id="00000" unit="mm" width="420" height="594" name="AU/NZ Broadsheet">
+            <names>
+                <name lang="en_US">AU/NZ Broadsheet</name>
+                <name lang="de">AU/NZ Vollformat</name>
+            </names>
+        </page>
+        <page id="00001" unit="mm" width="315" height="470" name="Berliner Broadsheet">
+            <names>
+                <name lang="en_US">Berliner Broadsheet</name>
+                <name lang="de">Berliner Vollformat</name>
+            </names>
+        </page>
+        <page id="00002" unit="mm" width="235" height="315" name="Berliner Tabloid">
+            <names>
+                <name lang="en_US">Berliner Tabloid</name>
+                <name lang="de">Berliner Halbformat</name>
+            </names>
+        </page>
+        <page id="00003" unit="mm" width="260" height="368" name="Canadian Tabloid">
+            <names>
+                <name lang="en_US">Canadian Tabloid</name>
+                <name lang="de">Kanadisches Halbformat</name>
+            </names>
+        </page>
+        <page id="00004" unit="mm" width="260" height="413" name="Canadian Tall Tabloid">
+            <names>
+                <name lang="en_US">Canadian Tall Tabloid</name>
+                <name lang="de">Kanadisches Halbformat (hoch)</name>
+            </names>
+        </page>
+        <page id="00005" unit="mm" width="350" height="500" name="Ciner"/>
+        <page id="00006" unit="mm" width="280" height="430" name="Compact"/>
+        <page id="00007" unit="in" width="12" height="22" name="New York Times"/>
+        <page id="00008" unit="mm" width="400" height="570" name="Nordisch Broadsheet">
+            <names>
+                <name lang="en_US">Nordisch Broadsheet</name>
+                <name lang="de">Nordisches Vollformat</name>
+            </names>
+        </page>
+        <page id="00009" unit="mm" width="285" height="400" name="Nordisch Tabloid">
+            <names>
+                <name lang="en_US">Nordisch Tabloid</name>
+                <name lang="de">Nordisches Halbformat</name>
+            </names>
+        </page>
+        <page id="00010" unit="mm" width="280" height="400" name="Norwegian Tabloid">
+            <names>
+                <name lang="en_US">Norwegian Tabloid</name>
+                <name lang="de">Norwegisches Halbformat</name>
+            </names>
+        </page>
+        <page id="00011" unit="mm" width="350" height="520" name="Rhenish Broadsheet">
+            <names>
+                <name lang="en_US">Rhenish Broadsheet</name>
+                <name lang="de">Rheinisches Vollformat</name>
+            </names>
+        </page>
+        <page id="00012" unit="mm" width="260" height="350" name="Rhenish Tabloid">
+            <names>
+                <name lang="en_US">Rhenish Tabloid</name>
+                <name lang="de">Rheinisches Halbformat</name>
+            </names>
+        </page>
+        <page id="00013" unit="mm" width="410" height="578" name="SA Broadsheet">
+            <names>
+                <name lang="en_US">SA Broadsheet</name>
+                <name lang="de">SA Vollformat</name>
+            </names>
+        </page>
+        <page id="00014" unit="mm" width="320" height="475" name="Swiss Broadsheet">
+            <names>
+                <name lang="en_US">Swiss Broadsheet</name>
+                <name lang="de">Schweizer Vollformat</name>
+            </names>
+        </page>
+        <page id="00015" unit="mm" width="375" height="597" name="UK Broadsheet">
+            <names>
+                <name lang="en_US">UK Broadsheet</name>
+                <name lang="de">UK Vollformat</name>
+            </names>
+        </page>
+        <page id="00016" unit="mm" width="280" height="430" name="UK Tabloid">
+            <names>
+                <name lang="en_US">UK Tabloid</name>
+                <name lang="de">UK Halbformat</name>
+            </names>
+        </page>
+        <page id="00017" unit="in" width="15" height="22.75" name="US Broadsheet">
+            <names>
+                <name lang="en_US">US Broadsheet</name>
+                <name lang="de">US Vollformat</name>
+            </names>
+        </page>
+        <page id="00018" unit="in" width="12" height="22.75" name="Wall Street Journal"/>
+    </pages>
+</collection>
diff --git a/resources/pagepresets/Others.xml b/resources/pagepresets/Others.xml
new file mode 100644
index 000000000..5296c8f2d
--- /dev/null
+++ b/resources/pagepresets/Others.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<collection id="4bdbpuiDuPEb66E6h3aREw" name="Others" minVersion="1.7.2" version="1.7.2">
+    <metadata>
+        <author>Scribus</author>
+        <license>CC0</license>
+        <names>
+            <name lang="en_US">Others</name>
+            <name lang="de">Sonstiges</name>
+        </names>
+    </metadata>
+    <pages>
+        <page id="00000" unit="mm" width="264" height="148" name="Blu-Ray Cover (12 mm)"/>
+        <page id="00001" unit="mm" width="266" height="148" name="Blu-Ray Cover (14 mm)"/>
+        <page id="00002" unit="mm" width="276" height="148" name="Blu-Ray Cover (24 mm)"/>
+        <page id="00003" unit="mm" width="257" height="148" name="Blu-Ray Cover (5 mm)"/>
+        <page id="00004" unit="mm" width="101.5" height="105" name="Cassette Cover (J-Card)">
+	    <names>
+	        <name lang="en_US">Cassette Cover (J-Card)</name>
+	        <name lang="de">Kassetten-Cover (J-Card)</name>
+	    </names>
+        </page>
+        <page id="00005" unit="mm" width="101.5" height="140.9" name="Cassette Cover (U-Card)">
+	    <names>
+	        <name lang="en_US">Cassette Cover (U-Card)</name>
+	        <name lang="de">Kassetten-Cover (U-Card)</name>
+	    </names>
+        </page>
+        <page id="00006" unit="mm" width="151" height="118" name="Compact Disc (Back)">
+	    <names>
+	        <name lang="en_US">Compact Disc (Back)</name>
+	        <name lang="de">CD (Rückseite)</name>
+	    </names>
+        </page>
+        <page id="00007" unit="mm" width="240" height="120" name="Compact Disc (Front Double)">
+	    <names>
+	        <name lang="en_US">Compact Disc (Front Double)</name>
+	        <name lang="de">CD (Vorderseite doppelt)</name>
+	    </names>
+        </page>
+        <page id="00008" unit="mm" width="120" height="120" name="Compact Disc (Front)">
+	    <names>
+	        <name lang="en_US">Compact Disc (Front)</name>
+	        <name lang="de">CD (Vorderseite)</name>
+	    </names>
+        </page>
+        <page id="0009" unit="mm" width="273" height="183" name="DVD Cover Normal">
+	    <names>
+	        <name lang="en_US">DVD Cover Normal</name>
+	        <name lang="de">DVD Cover Normal</name>
+	    </names>
+        </page>
+        <page id="00010" unit="mm" width="266" height="183" name="DVD Cover Slim">
+	    <names>
+	        <name lang="en_US">DVD Cover Slim</name>
+	        <name lang="de">DVD Cover Schmal</name>
+	    </names>
+        </page>
+        <page id="00011" unit="mm" width="314.3" height="314.3" name="Vinyl LP"/>
+    </pages>
+</collection>
diff --git a/resources/pagepresets/Swedish.xml b/resources/pagepresets/Swedish.xml
new file mode 100644
index 000000000..7a8dbef31
--- /dev/null
+++ b/resources/pagepresets/Swedish.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<collection id="3PEKXhAxpnf106iRYXog4M" name="Swedish" minVersion="1.7.2" version="1.7.2">
+    <metadata>
+        <author>Scribus</author>
+        <license>CC0</license>
+        <names>
+            <name lang="en_US">Swedish</name>
+            <name lang="de">Schwedisch</name>
+        </names>
+    </metadata>
+    <pages>
+        <page id="00000" unit="mm" width="1091" height="1542" name="SIS D0"/>
+        <page id="00001" unit="mm" width="771" height="1091" name="SIS D1"/>
+        <page id="00002" unit="mm" width="545" height="771" name="SIS D2"/>
+        <page id="00003" unit="mm" width="386" height="545" name="SIS D3"/>
+        <page id="00004" unit="mm" width="273" height="386" name="SIS D4"/>
+        <page id="00005" unit="mm" width="193" height="273" name="SIS D5"/>
+        <page id="00006" unit="mm" width="136" height="193" name="SIS D6"/>
+        <page id="00007" unit="mm" width="96" height="136" name="SIS D7"/>
+        <page id="00008" unit="mm" width="68" height="96" name="SIS D8"/>
+        <page id="00009" unit="mm" width="48" height="68" name="SIS D9"/>
+        <page id="00010" unit="mm" width="34" height="48" name="SIS D10"/>
+        <page id="00011" unit="mm" width="878" height="1242" name="SIS E0"/>
+        <page id="00012" unit="mm" width="621" height="878" name="SIS E1"/>
+        <page id="00013" unit="mm" width="439" height="621" name="SIS E2"/>
+        <page id="00014" unit="mm" width="310" height="439" name="SIS E3"/>
+        <page id="00015" unit="mm" width="220" height="310" name="SIS E4"/>
+        <page id="00016" unit="mm" width="155" height="220" name="SIS E5"/>
+        <page id="00017" unit="mm" width="110" height="155" name="SIS E6"/>
+        <page id="00018" unit="mm" width="78" height="110" name="SIS E7"/>
+        <page id="00019" unit="mm" width="55" height="78" name="SIS E8"/>
+        <page id="00020" unit="mm" width="39" height="55" name="SIS E9"/>
+        <page id="00021" unit="mm" width="27" height="39" name="SIS E10"/>
+        <page id="00022" unit="mm" width="958" height="1354" name="SIS F0"/>
+        <page id="00023" unit="mm" width="677" height="958" name="SIS F1"/>
+        <page id="00024" unit="mm" width="479" height="677" name="SIS F2"/>
+        <page id="00025" unit="mm" width="339" height="479" name="SIS F3"/>
+        <page id="00026" unit="mm" width="239" height="339" name="SIS F4"/>
+        <page id="00027" unit="mm" width="169" height="239" name="SIS F5"/>
+        <page id="00028" unit="mm" width="120" height="169" name="SIS F6"/>
+        <page id="00029" unit="mm" width="85" height="120" name="SIS F7"/>
+        <page id="00030" unit="mm" width="60" height="85" name="SIS F8"/>
+        <page id="00031" unit="mm" width="42" height="60" name="SIS F9"/>
+        <page id="00032" unit="mm" width="30" height="42" name="SIS F10"/>
+        <page id="00033" unit="mm" width="1044" height="1477" name="SIS G0"/>
+        <page id="00034" unit="mm" width="738" height="1044" name="SIS G1"/>
+        <page id="00035" unit="mm" width="522" height="738" name="SIS G2"/>
+        <page id="00036" unit="mm" width="369" height="522" name="SIS G3"/>
+        <page id="00037" unit="mm" width="261" height="369" name="SIS G4"/>
+        <page id="00038" unit="mm" width="185" height="261" name="SIS G5"/>
+        <page id="00039" unit="mm" width="131" height="185" name="SIS G6"/>
+        <page id="00040" unit="mm" width="92" height="131" name="SIS G7"/>
+        <page id="00041" unit="mm" width="65" height="92" name="SIS G8"/>
+        <page id="00042" unit="mm" width="46" height="65" name="SIS G9"/>
+        <page id="00043" unit="mm" width="33" height="46" name="SIS G10"/>
+    </pages>
+</collection>
diff --git a/resources/pagepresets/Transitional.xml b/resources/pagepresets/Transitional.xml
new file mode 100644
index 000000000..2c1b6ebe5
--- /dev/null
+++ b/resources/pagepresets/Transitional.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<collection id="aJy2ulZsX9uRnGHvnWFnr" name="Transitional" minVersion="1.7.2" version="1.7.2">
+    <metadata>
+        <author>Scribus</author>
+        <license>CC0</license>
+        <names>
+            <name lang="en_US">Transitional</name>
+        </names>
+    </metadata>
+    <pages>
+        <page id="00000" unit="mm" width="841" height="1321" name="F0"/>
+        <page id="00001" unit="mm" width="660" height="841" name="F1"/>
+        <page id="00002" unit="mm" width="420" height="660" name="F2"/>
+        <page id="00003" unit="mm" width="330" height="420" name="F3"/>
+        <page id="00004" unit="mm" width="210" height="330" name="F4"/>
+        <page id="00005" unit="mm" width="165" height="210" name="F5"/>
+        <page id="00006" unit="mm" width="105" height="165" name="F6"/>
+        <page id="00007" unit="mm" width="82" height="105" name="F7"/>
+        <page id="00008" unit="mm" width="52" height="82" name="F8"/>
+        <page id="00009" unit="mm" width="41" height="52" name="F9"/>
+        <page id="00010" unit="mm" width="26" height="41" name="F10"/>
+        <page id="00011" unit="mm" width="840" height="1120" name="PA0"/>
+        <page id="00012" unit="mm" width="560" height="840" name="PA1"/>
+        <page id="00013" unit="mm" width="420" height="560" name="PA2"/>
+        <page id="00014" unit="mm" width="280" height="420" name="PA3"/>
+        <page id="00015" unit="mm" width="210" height="280" name="PA4"/>
+        <page id="00016" unit="mm" width="140" height="210" name="PA5"/>
+        <page id="00017" unit="mm" width="105" height="140" name="PA6"/>
+        <page id="00018" unit="mm" width="70" height="105" name="PA7"/>
+        <page id="00019" unit="mm" width="52" height="70" name="PA8"/>
+        <page id="00020" unit="mm" width="35" height="52" name="PA9"/>
+        <page id="00021" unit="mm" width="26" height="35" name="PA10"/>
+    </pages>
+</collection>
diff --git a/resources/pagepresets/US_Envelopes.xml b/resources/pagepresets/US_Envelopes.xml
new file mode 100644
index 000000000..b9b4bd75d
--- /dev/null
+++ b/resources/pagepresets/US_Envelopes.xml
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<collection id="1MiUxZ8tKVnDRnWnv08WC2" name="US Envelopes" minVersion="1.7.2" version="1.7.2">
+    <metadata>
+        <author>Scribus</author>
+        <license>CC0</license>
+        <names>
+            <name lang="en_US">US Envelopes</name>
+            <name lang="de">US Briefumschläge</name>
+        </names>
+    </metadata>
+    <pages>
+        <page id="00000" unit="in" width="5.125" height="3.625" name="A-1"/>
+        <page id="00001" unit="in" width="5.75" height="4.375" name="A-2 (Lady Grey)"/>
+        <page id="00002" unit="in" width="6.25" height="4.25" name="A-4"/>
+        <page id="00003" unit="in" width="6.5" height="4.75" name="A-6 (Thompson Standard)"/>
+        <page id="00004" unit="in" width="7.25" height="5.25" name="A-7 (Besselheim)"/>
+        <page id="00005" unit="in" width="8.125" height="5.5" name="A-8 (Carrs)"/>
+        <page id="00006" unit="in" width="8.75" height="5.75" name="A-9 (Diplomat)"/>
+        <page id="00007" unit="in" width="9.5" height="6" name="A-10 (Willow)"/>
+        <page id="00008" unit="in" width="8.875" height="3.875" name="A Long"/>
+        <page id="00009" unit="in" width="5.125" height="3.625" name="Baronial 4"/>
+        <page id="00010" unit="in" width="5.75" height="4.375" name="Baronial 5 1/2"/>
+        <page id="00011" unit="in" width="6.5" height="4.75" name="Baronial 6"/>
+        <page id="00012" unit="in" width="7.25" height="5.25" name="Lee"/>
+        <page id="00013" unit="in" width="6" height="4.75" name="Booklet 3"/>
+        <page id="00014" unit="in" width="7.5" height="5.5" name="Booklet 4 1/2"/>
+        <page id="00015" unit="in" width="8.875" height="5.75" name="Booklet 6"/>
+        <page id="00016" unit="in" width="9" height="6" name="Booklet 6 1/2"/>
+        <page id="00017" unit="in" width="9.5" height="6.5" name="Booklet 6 3/4"/>
+        <page id="00018" unit="in" width="9.5" height="6" name="Booklet 6 7/8"/>
+        <page id="00019" unit="in" width="10.5" height="7.5" name="Booklet 7 1/2"/>
+        <page id="00020" unit="in" width="11.5" height="8.75" name="Booklet 9"/>
+        <page id="00021" unit="in" width="12" height="9" name="Booklet 9 1/2"/>
+        <page id="00022" unit="in" width="12.625" height="9.5" name="Booklet 10"/>
+        <page id="00023" unit="in" width="13" height="10" name="Booklet 13"/>
+        <page id="00024" unit="in" width="9" height="6" name="Catalog 1"/>
+        <page id="00025" unit="in" width="9.5" height="6.5" name="Catalog 1 3/4"/>
+        <page id="00026" unit="in" width="10" height="7" name="Catalog 3"/>
+        <page id="00027" unit="in" width="10.5" height="7.5" name="Catalog 6"/>
+        <page id="00028" unit="in" width="11.25" height="8.25" name="Catalog 8"/>
+        <page id="00029" unit="in" width="11.25" height="8.75" name="Catalog 9 3/4"/>
+        <page id="00030" unit="in" width="12" height="9" name="Catalog 10 1/2"/>
+        <page id="00031" unit="in" width="12.5" height="9.5" name="Catalog 12 1/5"/>
+        <page id="00032" unit="in" width="13" height="10" name="Catalog 13 1/2"/>
+        <page id="00033" unit="in" width="14.5" height="11.5" name="Catalog 14 1/2"/>
+        <page id="00034" unit="in" width="15" height="10" name="Catalog 15"/>
+        <page id="00035" unit="in" width="15.5" height="12" name="Catalog 15 1/2"/>
+        <page id="00036" unit="in" width="5.5" height="3.125" name="Commerical 5"/>
+        <page id="00037" unit="in" width="6" height="3.5" name="Commerical 6 1/4"/>
+        <page id="00038" unit="in" width="6.5" height="3.625" name="Commerical 6 3/4"/>
+        <page id="00039" unit="in" width="6.75" height="3.75" name="Commerical 7"/>
+        <page id="00040" unit="in" width="7.5" height="3.9375" name="Commerical 7 1/2"/>
+        <page id="00041" unit="in" width="8.625" height="3.625" name="Commerical 8 5/8"/>
+        <page id="00042" unit="in" width="8.875" height="3.875" name="Commerical 9"/>
+        <page id="00043" unit="in" width="9.5" height="4.125" name="Commerical 10"/>
+        <page id="00044" unit="in" width="10.375" height="4.5" name="Commerical 11"/>
+        <page id="00045" unit="in" width="11" height="4.75" name="Commerical 12"/>
+        <page id="00046" unit="in" width="11.5" height="5" name="Commerical 14"/>
+        <page id="00047" unit="in" width="6" height="6" name="Square 6"/>
+        <page id="00048" unit="in" width="6.5" height="6.5" name="Square 6 1/2"/>
+        <page id="00049" unit="in" width="7" height="7" name="Square 7"/>
+        <page id="00050" unit="in" width="7.5" height="7.5" name="Square 7 1/2"/>
+        <page id="00051" unit="in" width="8" height="8" name="Square 8"/>
+        <page id="00052" unit="in" width="8.5" height="8.5" name="Square 8 1/2"/>
+        <page id="00053" unit="in" width="9" height="9" name="Square 9"/>
+        <page id="00054" unit="in" width="9.5" height="9.5" name="Square 9 1/2"/>
+    </pages>
+</collection>
diff --git a/resources/pagepresets/US_Paper.xml b/resources/pagepresets/US_Paper.xml
new file mode 100644
index 000000000..5c9401c37
--- /dev/null
+++ b/resources/pagepresets/US_Paper.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<collection id="6w0FSR1dcD7Lh6qfbD3QvD" name="US Paper" minVersion="1.7.2" version="1.7.2">
+    <metadata>
+        <author>Scribus</author>
+        <license>CC0</license>
+        <names>
+            <name lang="en_US">US Paper</name>
+            <name lang="de">US Papier</name>
+        </names>
+    </metadata>
+    <pages>
+        <page id="00000" unit="in" width="8.5" height="11" name="ANSI A"/>
+        <page id="00001" unit="in" width="11" height="17" name="ANSI B"/>
+        <page id="00002" unit="in" width="17" height="22" name="ANSI C"/>
+        <page id="00003" unit="in" width="22" height="34" name="ANSI D"/>
+        <page id="00004" unit="in" width="34" height="44" name="ANSI E"/>
+        <page id="00005" unit="in" width="9" height="12" name="Arch A"/>
+        <page id="00006" unit="in" width="12" height="18" name="Arch B"/>
+        <page id="00007" unit="in" width="18" height="24" name="Arch C"/>
+        <page id="00008" unit="in" width="24" height="36" name="Arch D"/>
+        <page id="00009" unit="in" width="36" height="48" name="Arch E"/>
+        <page id="00010" unit="in" width="30" height="42" name="Arch E1"/>
+        <page id="00011" unit="in" width="26" height="38" name="Arch E2"/>
+        <page id="00012" unit="in" width="27" height="39" name="Arch E3"/>
+        <page id="00013" unit="in" width="8.5" height="13" name="Government Legal"/>
+        <page id="00014" unit="in" width="8" height="10.5" name="Government Letter"/>
+        <page id="00015" unit="in" width="5" height="8" name="Junior Legal"/>
+        <page id="00016" unit="in" width="11" height="17" name="Ledger, Tabloid"/>
+        <page id="00017" unit="in" width="8.5" height="14" name="Legal"/>
+        <page id="00018" unit="in" width="7" height="8.5" name="Legal Half"/>
+        <page id="00019" unit="in" width="8.5" height="11" name="Letter" legacyNames="US Letter"/>
+        <page id="00020" unit="in" width="5.5" height="8.5" name="Letter Half"/>
+    </pages>
+</collection>
diff --git a/resources/pagepresets/US_Press.xml b/resources/pagepresets/US_Press.xml
new file mode 100644
index 000000000..503c8d93d
--- /dev/null
+++ b/resources/pagepresets/US_Press.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<collection id="2KwNut04bTxX8zfZbvW3RM" name="US Press" minVersion="1.7.2" version="1.7.2">
+    <metadata>
+        <author>Scribus</author>
+        <license>CC0</license>
+        <names>
+            <name lang="en_US">US Press</name>
+            <name lang="de">US Druck</name>
+        </names>
+    </metadata>
+    <pages>
+        <page id="00000" unit="in" width="11" height="17" name="11x17"/>
+        <page id="00001" unit="in" width="12" height="18" name="12x18"/>
+        <page id="00002" unit="in" width="17" height="22" name="17x22"/>
+        <page id="00003" unit="in" width="19" height="25" name="19x25"/>
+        <page id="00004" unit="in" width="20" height="26" name="20x26"/>
+        <page id="00005" unit="in" width="23" height="29" name="23x29"/>
+        <page id="00006" unit="in" width="23" height="35" name="23x35"/>
+        <page id="00007" unit="in" width="25" height="38" name="25x38"/>
+        <page id="00008" unit="in" width="26" height="40" name="26x40"/>
+        <page id="00009" unit="in" width="28" height="40" name="28x40"/>
+        <page id="00010" unit="in" width="35" height="45" name="38x45"/>
+        <page id="00011" unit="in" width="38" height="50" name="38x50"/>
+    </pages>
+</collection>
diff --git a/resources/pagepresets/index.xml b/resources/pagepresets/index.xml
new file mode 100644
index 000000000..9e3c8ac75
--- /dev/null
+++ b/resources/pagepresets/index.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<collections minVersion="1.7.2" version="1.7.2">
+  <collection name="ISO_A_Paper.xml"/>
+  <collection name="ISO_B_Paper.xml"/>
+  <collection name="ISO_C_Envelope.xml"/>
+  <collection name="International_Envelopes.xml"/>
+  <separator/>
+  <collection name="US_Paper.xml"/>
+  <collection name="US_Press.xml"/>
+  <collection name="US_Envelopes.xml"/>
+  <separator/>
+  <collection name="Books.xml"/>
+  <collection name="Business_Cards.xml"/>
+  <collection name="Newspapers.xml"/>
+  <collection name="Transitional.xml"/>
+  <collection name="Others.xml"/>
+  <separator/>
+  <collection name="Canadian.xml"/>
+  <collection name="Chinese.xml"/>
+  <collection name="Colombian.xml"/>
+  <collection name="French.xml"/>
+  <collection name="German.xml"/>
+  <collection name="Imperial.xml"/>
+  <collection name="Japanese.xml"/>
+  <collection name="Swedish.xml"/>
+  <separator/>
+</collections>
diff --git a/resources/pagepresets/install.targets b/resources/pagepresets/install.targets
new file mode 100644
index 000000000..179e1bcc8
--- /dev/null
+++ b/resources/pagepresets/install.targets
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+	<ItemGroup>
+		<FilesToInstall_resources_pagepresets Include="$(MSBuildThisFileDirectory)*.xml" />
+	</ItemGroup>
+	
+	<PropertyGroup>
+		<AfterBuildDependsOn>
+			$(AfterBuildDependsOn);
+			Install_resources_pagepresets;
+		</AfterBuildDependsOn>
+	</PropertyGroup>
+	
+	<Target Name="Install_resources_pagepresets">  
+		<Copy  
+			SourceFiles="@(FilesToInstall_resources_pagepresets)"  
+			DestinationFiles="@(FilesToInstall_resources_pagepresets-&gt;'$(OutDir)\share\pagepresets\%(Filename)%(Extension)')"
+			SkipUnchangedFiles="true"
+		/>  
+	</Target>
+</Project>
diff --git a/scribus/CMakeLists_Sources.txt b/scribus/CMakeLists_Sources.txt
index afb5817be..a2902f4cf 100644
--- a/scribus/CMakeLists_Sources.txt
+++ b/scribus/CMakeLists_Sources.txt
@@ -263,6 +263,7 @@ set(SCRIBUS_SOURCES
 	imagedataloaders/scimgdataloader_tiff.cpp
 	imagedataloaders/scimgdataloader_wpg.cpp
 	manager/dock_manager.cpp
+	manager/pagepreset_manager.cpp
 	manager/widget_manager.cpp
 	models/gradientlistmodel.cpp
 	palettes/cxfcolor.cpp
diff --git a/scribus/localemgr.cpp b/scribus/localemgr.cpp
index 392a3a9f1..3ac0b0991 100644
--- a/scribus/localemgr.cpp
+++ b/scribus/localemgr.cpp
@@ -32,7 +32,7 @@ for which a new license (GPL+exception) is in place.
 #include "scribuscore.h"
 #include "localemgr.h"
 #include "scpaths.h"
-#include "pagesize.h"
+#include "manager/pagepreset_manager.h"
 
 LocaleManager& LocaleManager::instance()
 {
@@ -61,13 +61,13 @@ void LocaleManager::generateLocaleList()
 	//Build table;
 	//No, we don't translate these, they are internal use that don't get to the GUI
 	m_localeTable.clear();
-	m_localeTable.append(LocaleDef("default","mm",   PageSize::defaultSizesList().at(1)));
-	m_localeTable.append(LocaleDef("en",     "in",   PageSize::defaultSizesList().at(4)));
-	m_localeTable.append(LocaleDef("en_AU",  "mm",   PageSize::defaultSizesList().at(1)));
-	m_localeTable.append(LocaleDef("en_GB",  "mm",   PageSize::defaultSizesList().at(1)));
-	m_localeTable.append(LocaleDef("en_US",  "in",   PageSize::defaultSizesList().at(4)));
-	m_localeTable.append(LocaleDef("fr",     "mm",   PageSize::defaultSizesList().at(1)));
-	m_localeTable.append(LocaleDef("fr_QC",  "pica", PageSize::defaultSizesList().at(4)));
+	m_localeTable.append(LocaleDef("default","mm",   PagePresetManager::defaultSizesList().at(1)));
+	m_localeTable.append(LocaleDef("en",     "in",   PagePresetManager::defaultSizesList().at(4)));
+	m_localeTable.append(LocaleDef("en_AU",  "mm",   PagePresetManager::defaultSizesList().at(1)));
+	m_localeTable.append(LocaleDef("en_GB",  "mm",   PagePresetManager::defaultSizesList().at(1)));
+	m_localeTable.append(LocaleDef("en_US",  "in",   PagePresetManager::defaultSizesList().at(4)));
+	m_localeTable.append(LocaleDef("fr",     "mm",   PagePresetManager::defaultSizesList().at(1)));
+	m_localeTable.append(LocaleDef("fr_QC",  "pica", PagePresetManager::defaultSizesList().at(4)));
 }
 
 void LocaleManager::printSelectedForLocale(const QString& locale)
@@ -105,8 +105,8 @@ QString LocaleManager::pageSizeForLocale(const QString& locale)
 	//qDebug()<<"No definition for locale: "<<selectedLocale;
 	//No, we don't translate these, they are internal use that don't get to the GUI
 	if (m_sysLocale.measurementSystem()==0)
-		return PageSize::defaultSizesList().at(1);
-	return PageSize::defaultSizesList().at(4);
+		return PagePresetManager::defaultSizesList().at(1);
+	return PagePresetManager::defaultSizesList().at(4);
 //	qFatal("Page Size not found in LocaleManager");
 //	return "";
 }
diff --git a/scribus/manager/pagepreset_manager.cpp b/scribus/manager/pagepreset_manager.cpp
new file mode 100644
index 000000000..254025d17
--- /dev/null
+++ b/scribus/manager/pagepreset_manager.cpp
@@ -0,0 +1,891 @@
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+
+/*
+For general Scribus copyright and licensing information please refer
+to the COPYING file provided with the program.
+*/
+#include "pagepreset_manager.h"
+#include <QDebug>
+#include <QDir>
+#include <QFile>
+#include <QSaveFile>
+#include <QUuid>
+#include <QXmlStreamReader>
+#include <QXmlStreamWriter>
+#include "api/api_application.h"
+#include "commonstrings.h"
+#include "langmgr.h"
+#include "prefsmanager.h"
+#include "scpaths.h"
+#include "scribusapp.h"
+#include "units.h"
+#include "util.h"
+
+PagePresetManager *PagePresetManager::m_instance = nullptr;
+
+PagePresetManager &PagePresetManager::instance()
+{
+	static PagePresetManager m_instance;
+	return m_instance;
+}
+
+PagePresetManager::PagePresetManager(QObject *parent)
+	: QObject(parent)
+{
+
+	reloadAllPresets();
+	connect(ScQApp, &ScribusQApp::localeChanged, this, &PagePresetManager::localeChange);
+}
+
+
+void PagePresetManager::reloadAllPresets()
+{
+	m_pageSizeList.clear();
+	m_categoryList.clear();
+	m_categoryOrderList.clear();
+
+	// Add Scribus page presets
+	loadAllPresets(systemIndexFile(), PageSizeType::Preset);
+
+	// Add users page presets
+	loadAllPresets(userIndexFile(), PageSizeType::User);
+}
+
+QStringList PagePresetManager::defaultSizesList()
+{
+	// A3, A4, A5, A6, US letter
+	static const QStringList list = {"FzlMfpPelK5894hHnoLDC_00007", "FzlMfpPelK5894hHnoLDC_00009", "FzlMfpPelK5894hHnoLDC_00010", "FzlMfpPelK5894hHnoLDC_00011", "6w0FSR1dcD7Lh6qfbD3QvD_00019"};
+	return list;
+}
+
+PageCollectionInfo PagePresetManager::categoryInfoById(const QString &id)
+{
+	return m_categoryList.value(id);
+}
+
+PageCollectionInfo PagePresetManager::categoryInfoCustom()
+{
+	PageCollectionInfo pciCustom;
+	pciCustom.id = CommonStrings::customPageSize;
+	pciCustom.displayName = CommonStrings::trCustomPageSize;
+	return pciCustom;
+}
+
+PageCollectionInfo PagePresetManager::categoryInfoPreferred()
+{
+	PageCollectionInfo pciPreferred;
+	pciPreferred.id = QStringLiteral("Preferred");
+	pciPreferred.displayName = tr("Preferred");
+	return pciPreferred;
+}
+
+PageSizeInfoMap PagePresetManager::activePageSizes() const
+{
+	const auto &activeList = PrefsManager::instance().appPrefs.activePageSizes;
+
+	if (activeList.isEmpty())
+		return m_pageSizeList;
+
+	PageSizeInfoMap map;
+
+	for (const QString &id : activeList)
+	{
+		auto it = m_pageSizeList.find(id);
+		if (it != m_pageSizeList.end())
+			map.insert(id, *it);
+
+		// This is an alternative way to find a page size, but needs more time
+		// PageSizeInfo psi = pageInfoByName(id);
+		// map.insert(psi.id, psi);
+	}
+	return map;
+}
+
+PageSizeInfoMap PagePresetManager::sizesByCategory(QString categoryId) const
+{
+	PageSizeInfoMap map;
+	for (auto it = m_pageSizeList.constBegin(); it != m_pageSizeList.constEnd(); ++it)
+		if (it.value().categoryId == categoryId)
+			map.insert(it.key(), it.value());
+	return map;
+}
+
+PageSizeInfoMap PagePresetManager::sizesByDimensions(QSizeF sizePt) const
+{
+	PageSizeInfoMap map;
+	for (auto it = m_pageSizeList.constBegin(); it != m_pageSizeList.constEnd(); ++it)
+		if (isSizeMatch(it.value(), sizePt))
+			map.insert(it.key(), it.value());
+	return map;
+}
+
+PageSizeInfo PagePresetManager::pageInfoByDimensions(QSizeF sizePt) const
+{
+	for (auto it = m_pageSizeList.constBegin(); it != m_pageSizeList.constEnd(); ++it)
+		if (isSizeMatch(it.value(), sizePt))
+			return it.value();
+
+	PageSizeInfo psi = pageInfoCustom();
+	psi.width = sizePt.width();
+	psi.height = sizePt.height();
+	return psi;
+}
+
+PageSizeInfo PagePresetManager::pageInfoByName(const QString &name) const
+{
+	auto it = m_pageSizeList.find(name);
+	if (it != m_pageSizeList.end())
+		return it.value();
+
+	for (auto it2 = m_pageSizeList.constBegin(); it2 != m_pageSizeList.constEnd(); ++it2)
+		if (it2.value().displayName == name || it2.value().lagacyNames.contains(name))
+			return it2.value();
+
+	return pageInfoCustom();
+}
+
+PageSizeInfo PagePresetManager::pageInfoCustom() const
+{
+	PageCollectionInfo pci = PagePresetManager::instance().categoryInfoCustom();
+	PageSizeInfo psi;
+	psi.width = 0.0;
+	psi.height = 0.0;
+	psi.pageUnitIndex = 0; //pt
+	psi.id = CommonStrings::customPageSize;
+	psi.name = CommonStrings::trCustomPageSize;
+	psi.displayName = CommonStrings::trCustomPageSize;
+	psi.categoryId = pci.id;
+
+	return psi;
+}
+
+bool PagePresetManager::isSizeMatch(const PageSizeInfo &info, const QSizeF &size)
+{
+	const double epsilon = 0.01;
+
+	return (qAbs(info.width - size.width()) <= epsilon && qAbs(info.height - size.height()) <= epsilon)
+		   || (qAbs(info.width - size.height()) <= epsilon && qAbs(info.height - size.width()) <= epsilon);
+}
+
+void PagePresetManager::addPageSize(const PageSizeInfo &info)
+{
+	PageSizeInfo pinfo = info;
+	pinfo.width = value2pts(info.width, info.pageUnitIndex);
+	pinfo.height = value2pts(info.height, info.pageUnitIndex);
+	pinfo.label = QStringLiteral("%1 x %2 %3").arg(info.width).arg(info.height).arg(unitGetStrFromIndex(info.pageUnitIndex));
+
+	m_pageSizeList.insert(pinfo.id, std::move(pinfo));
+}
+
+void PagePresetManager::addCategory(const PageCollectionInfo &collection)
+{
+	m_categoryList.insert(collection.id, collection);
+}
+
+void PagePresetManager::loadAllPresets(const QString &indexFilePath, PageSizeType type)
+{
+	QFile file(indexFilePath);
+	if (!file.open(QIODevice::ReadOnly))
+	{
+		if (type == PageSizeType::Preset)
+			qWarning() << "Could not open index file:" << indexFilePath;
+		return;
+	}
+
+	QString basePath = QFileInfo(indexFilePath).path();
+	if (!basePath.endsWith(u'/'))
+		basePath += u'/';
+
+	QXmlStreamReader xml(&file);
+
+	while (!xml.atEnd() && !xml.hasError())
+	{
+		if (xml.readNext() == QXmlStreamReader::StartElement)
+		{
+			const auto tagName = xml.name();
+
+			if (tagName == u"collections")
+			{
+				const auto minVer = xml.attributes().value(u"minVersion");
+				if (!hasValidVersion(minVer.toString()))
+					qWarning() << "The index file is newer than the current version:" << indexFilePath;
+			}
+			else if (tagName == u"collection")
+			{
+				const auto fileNameView = xml.attributes().value(u"name");
+				if (!fileNameView.isEmpty())
+					parseCollectionFile(basePath % fileNameView, type);
+			}
+			else if (tagName == u"separator")
+			{
+				m_categoryOrderList.append(QStringLiteral("-"));
+			}
+		}
+	}
+
+	if (xml.hasError())
+		qWarning() << "XML error in index:" << xml.errorString();
+}
+
+void PagePresetManager::parseCollectionFile(const QString &filePath, PageSizeType type)
+{
+	QFile file(filePath);
+	if (!file.open(QIODevice::ReadOnly))
+	{
+		qWarning() << "Could not open collection file:" << filePath;
+		return;
+	}
+
+	QXmlStreamReader xml(&file);
+	PageCollectionInfo currentMeta;
+	currentMeta.type = type;
+	currentMeta.filePath = filePath;
+
+	bool collectingPages = false;
+
+	while (!xml.atEnd() && !xml.hasError())
+	{
+		const auto token = xml.readNext();
+
+		if (token == QXmlStreamReader::StartElement)
+		{
+			const auto tagName = xml.name();
+
+			if (tagName == u"collection")
+			{
+				const auto &attrs = xml.attributes();
+				if (!hasValidVersion(attrs.value(u"minVersion").toString()))
+				{
+					qWarning() << "Skipped newer version preset:" << filePath;
+					return;
+				}
+
+				currentMeta.id = attrs.value(u"id").toString();
+				currentMeta.name = attrs.value(u"name").toString();
+				currentMeta.displayName = currentMeta.name;
+
+				m_categoryOrderList.append(currentMeta.id);
+			}
+			else if (tagName == u"metadata")
+			{
+				while (!xml.atEnd())
+				{
+					const auto metaToken = xml.readNext();
+					if (metaToken == QXmlStreamReader::EndElement && xml.name() == u"metadata")
+						break;
+
+					if (metaToken == QXmlStreamReader::StartElement)
+					{
+						const auto metaTag = xml.name();
+						if (metaTag == u"author")
+							currentMeta.author = xml.readElementText();
+						else if (metaTag == u"license")
+							currentMeta.license = xml.readElementText();
+						else if (metaTag == u"names")
+						{
+							currentMeta.localizedNames = parseNamesBlock(xml);
+							updateDisplayName(currentMeta);
+						}
+						else
+							xml.skipCurrentElement();
+					}
+				}
+				addCategory(currentMeta);
+			}
+			else if (tagName == u"pages")
+			{
+				collectingPages = true;
+			}
+			else if (collectingPages && tagName == u"page")
+			{
+				PageSizeInfo info;
+				const auto &attrs = xml.attributes();
+
+				info.id = currentMeta.id % u'_' % attrs.value(u"id");
+				info.width = attrs.value(u"width").toDouble();
+				info.height = attrs.value(u"height").toDouble();
+				info.categoryId = currentMeta.id;
+				info.name = attrs.value(u"name").toString();
+				info.displayName = info.name;
+				info.pageUnitIndex = unitIndexFromString(attrs.value(u"unit").toString());
+				info.type = type;
+
+				const auto layoutVal = attrs.value(u"layout");
+				if (!layoutVal.isEmpty())
+					info.layout = attrs.value(u"layout").toInt();
+
+				const auto firstPageVal = attrs.value(u"firstPage");
+				if (!firstPageVal.isEmpty())
+					info.firstPage = attrs.value(u"firstPage").toInt();
+
+				const auto legacyVal = attrs.value(u"legacyNames");
+				if (!legacyVal.isEmpty())
+					info.lagacyNames = legacyVal.toString().split(u';');
+
+				while (!xml.atEnd())
+				{
+					const auto pageToken = xml.readNext();
+					if (pageToken == QXmlStreamReader::EndElement && xml.name() == u"page")
+						break;
+
+					if (pageToken == QXmlStreamReader::StartElement)
+					{
+						const auto childName = xml.name();
+
+						if (childName == u"names")
+						{
+							info.localizedNames = parseNamesBlock(xml);
+							updateDisplayName(info);
+						}
+						else if (childName == u"margins")
+						{
+							const auto &attrs = xml.attributes();
+							MarginStruct margins;
+							margins.setLeft(value2pts(attrs.value(u"left").toDouble(), info.pageUnitIndex));
+							margins.setTop(value2pts(attrs.value(u"top").toDouble(), info.pageUnitIndex));
+							margins.setRight(value2pts(attrs.value(u"right").toDouble(), info.pageUnitIndex));
+							margins.setBottom(value2pts(attrs.value(u"bottom").toDouble(), info.pageUnitIndex));
+
+							info.margins = margins;
+							info.marginPreset = attrs.value(u"preset").toInt();
+
+							xml.skipCurrentElement();
+						}
+						else if (childName == u"bleeds")
+						{
+							const auto &attrs = xml.attributes();
+							MarginStruct margins;
+							margins.setLeft(value2pts(attrs.value(u"left").toDouble(), info.pageUnitIndex));
+							margins.setTop(value2pts(attrs.value(u"top").toDouble(), info.pageUnitIndex));
+							margins.setRight(value2pts(attrs.value(u"right").toDouble(), info.pageUnitIndex));
+							margins.setBottom(value2pts(attrs.value(u"bottom").toDouble(), info.pageUnitIndex));
+
+							info.bleeds = margins;
+
+							xml.skipCurrentElement();
+						}
+						else if (childName == u"textFrame")
+						{
+							const auto &attrs = xml.attributes();
+							QList<double> values;
+							values.append(attrs.value(u"columns").toInt());
+							values.append(value2pts(attrs.value(u"gap").toDouble(), info.pageUnitIndex));
+
+							info.textFrame = values;
+
+							xml.skipCurrentElement();
+						}
+						else
+							xml.skipCurrentElement();
+					}
+				}
+				addPageSize(std::move(info));
+			}
+		}
+		else if (token == QXmlStreamReader::EndElement)
+		{
+			if (xml.name() == u"pages")
+				collectingPages = false;
+		}
+	}
+
+	if (xml.hasError())
+		qWarning() << "XML error in collection" << filePath << ":" << xml.errorString();
+}
+
+template<typename T>
+void PagePresetManager::updateDisplayName(T &info)
+{
+	if (!info.localizedNames.empty())
+	{
+		const QString language = PrefsManager::instance().appPrefs.uiPrefs.language;
+		const QString normalizeLanguage = LanguageManager::instance()->getShortAbbrevFromAbbrevDecomposition(language);
+		info.displayName = info.localizedNames.value(normalizeLanguage, info.name);
+	}
+}
+
+void PagePresetManager::localeChange()
+{
+	for (auto &col : m_categoryList)
+		updateDisplayName(col);
+
+	for (auto &page : m_pageSizeList)
+		updateDisplayName(page);
+}
+
+LocalizedStringsMap PagePresetManager::parseNamesBlock(QXmlStreamReader &xml)
+{
+	LocalizedStringsMap namesMap;
+
+	while (!xml.atEnd())
+	{
+		const auto token = xml.readNext();
+		if (token == QXmlStreamReader::EndElement && xml.name() == u"names")
+			break;
+
+		if (token == QXmlStreamReader::StartElement)
+		{
+			if (xml.name() == u"name")
+			{
+				const auto langView = xml.attributes().value(u"lang").toString();
+				if (!langView.isEmpty())
+				{
+					QString val = xml.readElementText();
+					if (!val.isEmpty())
+						namesMap.insert(langView, std::move(val));
+				}
+				else
+					xml.skipCurrentElement();
+			}
+			else
+				xml.skipCurrentElement();
+		}
+	}
+	return namesMap;
+}
+
+const QString PagePresetManager::systemIndexFile()
+{
+	return QDir::toNativeSeparators(ScPaths::instance().pagePresetsDir()) + QStringLiteral("index.xml");
+}
+
+const QString PagePresetManager::userIndexFile()
+{
+	return QDir::toNativeSeparators(ScPaths::userPagePresetsDir(true)) + QStringLiteral("index.xml");
+}
+
+bool PagePresetManager::hasValidVersion(const QString &version)
+{
+	const int curr_major = version.section(".", 0, 0).toInt();
+	const int curr_minor = version.section(".", 1, 1).toInt();
+	const int curr_patch = version.section(".", 2, 2).toInt();
+	const int curr_fullver = curr_major * 10000 + curr_minor * 100 + curr_patch;
+
+	const int ver_major = ScribusAPI::getVersionMajor();
+	const int ver_minor = ScribusAPI::getVersionMinor();
+	const int ver_patch = ScribusAPI::getVersionPatch();
+	const int ver_fullver = ver_major * 10000 + ver_minor * 100 + ver_patch;
+
+	return curr_fullver <= ver_fullver;
+}
+
+// =======================
+// Custom preset functions
+// =======================
+
+bool PagePresetManager::updateIndexFile(const QString &collectionFilePath, IndexAction action)
+{
+	QFileInfo colInfo(collectionFilePath);
+	const QString fileName = colInfo.fileName();
+	const QString indexFilePath = colInfo.dir().filePath(QStringLiteral("index.xml"));
+
+	QDomDocument doc;
+
+	if (!loadDocument(indexFilePath, doc))
+	{
+		if (action == IndexAction::Remove)
+			return true;
+
+		doc.clear();
+		doc.appendChild(doc.createProcessingInstruction(QStringLiteral("xml"), QStringLiteral("version=\"1.0\" encoding=\"utf-8\"")));
+		QDomElement root = doc.createElement(QStringLiteral("collections"));
+		root.setAttribute(QStringLiteral("minVersion"), ScribusAPI::getVersion());
+		root.setAttribute(QStringLiteral("version"), ScribusAPI::getVersion());
+		doc.appendChild(root);
+	}
+
+	QDomElement root = doc.documentElement();
+	if (root.tagName() != u"collections")
+		return false;
+
+	// Find collection
+	QDomElement foundElem;
+	bool found = false;
+	QDomElement elem = root.firstChildElement(QStringLiteral("collection"));
+
+	while (!elem.isNull())
+	{
+		if (elem.attribute(QStringLiteral("name")) == fileName)
+		{
+			foundElem = elem;
+			found = true;
+			break;
+		}
+		elem = elem.nextSiblingElement(QStringLiteral("collection"));
+	}
+
+	bool changed = false;
+
+	if (action == IndexAction::Add && !found)
+	{
+		QDomElement newCol = doc.createElement(QStringLiteral("collection"));
+		newCol.setAttribute(QStringLiteral("name"), fileName);
+		root.appendChild(newCol);
+		changed = true;
+	}
+	else if (action == IndexAction::Remove && found)
+	{
+		root.removeChild(foundElem);
+		changed = true;
+	}
+
+	return changed ? saveDocument(indexFilePath, doc) : true;
+}
+
+bool PagePresetManager::createOrUpdateCollection(const QString &filePath, const PageCollectionInfo &meta, QString &outUuid)
+{
+	QDomDocument doc;
+	bool exists = loadDocument(filePath, doc);
+	QDomElement root;
+
+	if (!exists)
+	{
+		doc.appendChild(doc.createProcessingInstruction(QStringLiteral("xml"), QStringLiteral("version=\"1.0\" encoding=\"UTF-8\"")));
+		root = doc.createElement(QStringLiteral("collection"));
+		doc.appendChild(root);
+
+		QString newId = getShortUuidFromUuid(QUuid::createUuid());
+		root.setAttribute(QStringLiteral("id"), newId);
+		root.appendChild(doc.createElement(QStringLiteral("pages")));
+		outUuid = newId;
+	}
+	else
+	{
+		root = doc.documentElement();
+		if (root.tagName() != u"collection")
+			return false;
+
+		outUuid = root.attribute(QStringLiteral("id"));
+		if (outUuid.isEmpty())
+		{
+			outUuid = getShortUuidFromUuid(QUuid::createUuid());
+			root.setAttribute(QStringLiteral("id"), outUuid);
+		}
+	}
+
+	root.setAttribute(QStringLiteral("name"), meta.name);
+	root.setAttribute(QStringLiteral("minVersion"), ScribusAPI::getVersion());
+	root.setAttribute(QStringLiteral("version"), ScribusAPI::getVersion());
+
+	QDomElement metaNode = root.firstChildElement(QStringLiteral("metadata"));
+	if (metaNode.isNull())
+	{
+		metaNode = doc.createElement(QStringLiteral("metadata"));
+		QDomElement pagesNode = root.firstChildElement(QStringLiteral("pages"));
+		if (!pagesNode.isNull())
+			root.insertBefore(metaNode, pagesNode);
+		else
+			root.appendChild(metaNode);
+	}
+
+	setChildText(metaNode, QStringLiteral("author"), meta.author);
+	setChildText(metaNode, QStringLiteral("license"), meta.license);
+
+	if (!saveDocument(filePath, doc))
+		return false;
+
+	if (!updateIndexFile(filePath, IndexAction::Add))
+		qWarning() << "Index update failed:" << filePath;
+
+	return true;
+}
+
+bool PagePresetManager::removeCollection(const QString &filePath)
+{
+	if (!updateIndexFile(filePath, IndexAction::Remove))
+		qWarning() << "Index update failed (removal):" << filePath;
+
+	return QFile::remove(filePath);
+}
+
+bool PagePresetManager::isCollectionsEmpty(const QString &filePath)
+{
+	QDomDocument doc;
+	if (!loadDocument(filePath, doc))
+		return false;
+
+	QDomNodeList pagesNodes = doc.elementsByTagName("pages");
+
+	if (pagesNodes.isEmpty())
+		return true;
+
+	QDomElement pagesElement = pagesNodes.at(0).toElement();
+	QDomNode child = pagesElement.firstChild();
+	while (!child.isNull())
+	{
+		if (child.isElement())
+		{
+			if (child.toElement().tagName() == "page")
+				return false;
+		}
+		child = child.nextSibling();
+	}
+
+	return true;
+}
+
+bool PagePresetManager::addCollectionPage(const QString &filePath, const PageSizeInfo &pageInfo)
+{
+	QDomDocument doc;
+	if (!loadDocument(filePath, doc))
+	{
+		qWarning() << "File not found:" << filePath;
+		return false;
+	}
+
+	QDomElement root = doc.documentElement();
+	QDomElement pagesNode = root.firstChildElement(QStringLiteral("pages"));
+
+	if (pagesNode.isNull())
+	{
+		pagesNode = doc.createElement(QStringLiteral("pages"));
+		root.appendChild(pagesNode);
+	}
+
+	int nextIdVal = 0;
+	QDomElement pageElem = pagesNode.firstChildElement(QStringLiteral("page"));
+	while (!pageElem.isNull())
+	{
+		bool ok;
+		int currentId = pageElem.attribute(QStringLiteral("id")).toInt(&ok);
+		if (ok && currentId >= nextIdVal)
+			nextIdVal = currentId + 1;
+		pageElem = pageElem.nextSiblingElement(QStringLiteral("page"));
+	}
+
+	QString newIdString = QStringLiteral("%1").arg(nextIdVal, 5, 10, QChar('0'));
+
+	// Page tag
+	QDomElement newPage = doc.createElement(QStringLiteral("page"));
+	newPage.setAttribute(QStringLiteral("id"), newIdString);
+	newPage.setAttribute(QStringLiteral("unit"), unitGetUntranslatedStrFromIndex(pageInfo.pageUnitIndex));
+	newPage.setAttribute(QStringLiteral("width"), QString::number(pts2value(pageInfo.width, pageInfo.pageUnitIndex)));
+	newPage.setAttribute(QStringLiteral("height"), QString::number(pts2value(pageInfo.height, pageInfo.pageUnitIndex)));
+	newPage.setAttribute(QStringLiteral("name"), pageInfo.name);
+	newPage.setAttribute(QStringLiteral("layout"), QString::number(pageInfo.layout));
+	newPage.setAttribute(QStringLiteral("firstPage"), QString::number(pageInfo.firstPage));
+
+	// Margin tag
+	if (!pageInfo.margins.isNull())
+	{
+		QDomElement element = doc.createElement(QStringLiteral("margins"));
+		element.setAttribute(QStringLiteral("left"), QString::number(pts2value(pageInfo.margins.left(), pageInfo.pageUnitIndex)));
+		element.setAttribute(QStringLiteral("right"), QString::number(pts2value(pageInfo.margins.right(), pageInfo.pageUnitIndex)));
+		element.setAttribute(QStringLiteral("top"), QString::number(pts2value(pageInfo.margins.top(), pageInfo.pageUnitIndex)));
+		element.setAttribute(QStringLiteral("bottom"), QString::number(pts2value(pageInfo.margins.bottom(), pageInfo.pageUnitIndex)));
+		element.setAttribute(QStringLiteral("preset"), QString::number(pageInfo.marginPreset));
+		newPage.appendChild(element);
+	}
+
+	// Bleed tag
+	if (!pageInfo.bleeds.isNull())
+	{
+		QDomElement element = doc.createElement(QStringLiteral("bleeds"));
+		element.setAttribute(QStringLiteral("left"), QString::number(pts2value(pageInfo.bleeds.left(), pageInfo.pageUnitIndex)));
+		element.setAttribute(QStringLiteral("right"), QString::number(pts2value(pageInfo.bleeds.right(), pageInfo.pageUnitIndex)));
+		element.setAttribute(QStringLiteral("top"), QString::number(pts2value(pageInfo.bleeds.top(), pageInfo.pageUnitIndex)));
+		element.setAttribute(QStringLiteral("bottom"), QString::number(pts2value(pageInfo.bleeds.bottom(), pageInfo.pageUnitIndex)));
+		newPage.appendChild(element);
+	}
+
+	// Text frame
+	if (!pageInfo.textFrame.isEmpty())
+	{
+		QDomElement element = doc.createElement(QStringLiteral("textFrame"));
+		element.setAttribute(QStringLiteral("columns"), QString::number(pageInfo.textFrame.at(0)));
+		element.setAttribute(QStringLiteral("gap"), QString::number(pts2value(pageInfo.textFrame.at(1), pageInfo.pageUnitIndex)));
+		newPage.appendChild(element);
+	}
+
+	pagesNode.appendChild(newPage);
+
+	return saveDocument(filePath, doc);
+}
+
+bool PagePresetManager::updateCollectionPage(const QString &filePath, const PageSizeInfo &pageInfo)
+{
+	const int separatorIdx = pageInfo.id.lastIndexOf(u'_');
+	if (separatorIdx == -1)
+		return false;
+
+	const QString collectionId = pageInfo.id.left(separatorIdx);
+	const QString pageId = pageInfo.id.mid(separatorIdx + 1);
+
+	QDomDocument doc;
+	if (!loadDocument(filePath, doc))
+		return false;
+
+	QDomElement root = doc.documentElement();
+	if (root.attribute(QStringLiteral("id")) != collectionId)
+		return false;
+
+	QDomElement pagesNode = root.firstChildElement(QStringLiteral("pages"));
+	QDomElement pageElem = pagesNode.firstChildElement(QStringLiteral("page"));
+
+	while (!pageElem.isNull())
+	{
+		if (pageElem.attribute(QStringLiteral("id")) == pageId)
+		{
+			pageElem.setAttribute(QStringLiteral("unit"), unitGetUntranslatedStrFromIndex(pageInfo.pageUnitIndex));
+			pageElem.setAttribute(QStringLiteral("width"), QString::number(pts2value(pageInfo.width, pageInfo.pageUnitIndex)));
+			pageElem.setAttribute(QStringLiteral("height"), QString::number(pts2value(pageInfo.height, pageInfo.pageUnitIndex)));
+			pageElem.setAttribute(QStringLiteral("name"), pageInfo.name);
+			pageElem.setAttribute(QStringLiteral("layout"), QString::number(pageInfo.layout));
+			pageElem.setAttribute(QStringLiteral("firstPage"), QString::number(pageInfo.firstPage));
+
+			// Margin tag
+			QDomElement marginsElem = pageElem.firstChildElement(QStringLiteral("margins"));
+
+			if (pageInfo.margins.isNull())
+			{
+				if (!marginsElem.isNull())
+					pageElem.removeChild(marginsElem);
+			}
+			else
+			{
+				if (marginsElem.isNull())
+				{
+					marginsElem = doc.createElement(QStringLiteral("margins"));
+					pageElem.appendChild(marginsElem);
+				}
+
+				marginsElem.setAttribute(QStringLiteral("left"), QString::number(pts2value(pageInfo.margins.left(), pageInfo.pageUnitIndex)));
+				marginsElem.setAttribute(QStringLiteral("top"), QString::number(pts2value(pageInfo.margins.top(), pageInfo.pageUnitIndex)));
+				marginsElem.setAttribute(QStringLiteral("right"), QString::number(pts2value(pageInfo.margins.right(), pageInfo.pageUnitIndex)));
+				marginsElem.setAttribute(QStringLiteral("bottom"), QString::number(pts2value(pageInfo.margins.bottom(), pageInfo.pageUnitIndex)));
+				marginsElem.setAttribute(QStringLiteral("preset"), QString::number(pageInfo.marginPreset));
+			}
+
+			// Bleed tag
+			QDomElement bleedsElem = pageElem.firstChildElement(QStringLiteral("bleeds"));
+
+			if (pageInfo.bleeds.isNull())
+			{
+				if (!bleedsElem.isNull())
+					pageElem.removeChild(bleedsElem);
+			}
+			else
+			{
+				if (bleedsElem.isNull())
+				{
+					bleedsElem = doc.createElement(QStringLiteral("bleeds"));
+					pageElem.appendChild(bleedsElem);
+				}
+
+				bleedsElem.setAttribute(QStringLiteral("left"), QString::number(pts2value(pageInfo.bleeds.left(), pageInfo.pageUnitIndex)));
+				bleedsElem.setAttribute(QStringLiteral("top"), QString::number(pts2value(pageInfo.bleeds.top(), pageInfo.pageUnitIndex)));
+				bleedsElem.setAttribute(QStringLiteral("right"), QString::number(pts2value(pageInfo.bleeds.right(), pageInfo.pageUnitIndex)));
+				bleedsElem.setAttribute(QStringLiteral("bottom"), QString::number(pts2value(pageInfo.bleeds.bottom(), pageInfo.pageUnitIndex)));
+			}
+
+			// Text frame
+			QDomElement textFrameElem = pageElem.firstChildElement(QStringLiteral("textFrame"));
+
+			if (pageInfo.textFrame.isEmpty())
+			{
+				if (!textFrameElem.isNull())
+					pageElem.removeChild(textFrameElem);
+			}
+			else
+			{
+				if (textFrameElem.isNull())
+				{
+					textFrameElem = doc.createElement(QStringLiteral("bleeds"));
+					pageElem.appendChild(textFrameElem);
+				}
+
+				textFrameElem.setAttribute(QStringLiteral("columns"), QString::number(pageInfo.textFrame.at(0)));
+				textFrameElem.setAttribute(QStringLiteral("gap"), QString::number(pts2value(pageInfo.textFrame.at(1), pageInfo.pageUnitIndex)));
+			}
+
+			return saveDocument(filePath, doc);
+		}
+		pageElem = pageElem.nextSiblingElement(QStringLiteral("page"));
+	}
+	return false;
+}
+
+bool PagePresetManager::removeCollectionPage(const QString &filePath, const QString &compositeId)
+{
+	const int separatorIdx = compositeId.lastIndexOf(u'_');
+	if (separatorIdx == -1)
+		return false;
+
+	const QString collectionId = compositeId.left(separatorIdx);
+	const QString pageId = compositeId.mid(separatorIdx + 1);
+
+	QDomDocument doc;
+	if (!loadDocument(filePath, doc))
+		return false;
+
+	QDomElement root = doc.documentElement();
+	if (root.attribute(QStringLiteral("id")) != collectionId)
+		return false;
+
+	QDomElement pagesNode = root.firstChildElement(QStringLiteral("pages"));
+	QDomElement pageElem = pagesNode.firstChildElement(QStringLiteral("page"));
+
+	while (!pageElem.isNull())
+	{
+		if (pageElem.attribute(QStringLiteral("id")) == pageId)
+		{
+			pagesNode.removeChild(pageElem);
+			return saveDocument(filePath, doc);
+		}
+		pageElem = pageElem.nextSiblingElement(QStringLiteral("page"));
+	}
+	return false;
+}
+
+bool PagePresetManager::loadDocument(const QString &filePath, QDomDocument &doc)
+{
+	QFile file(filePath);
+	if (!file.exists() || !file.open(QIODevice::ReadOnly | QIODevice::Text))
+		return false;
+
+	return doc.setContent(&file) ? true : false;
+}
+
+bool PagePresetManager::saveDocument(const QString &filePath, const QDomDocument &doc)
+{
+	QFileInfo fi(filePath);
+	if (!fi.dir().exists())
+		fi.dir().mkpath(QStringLiteral("."));
+
+	QSaveFile saveFile(filePath);
+	if (saveFile.open(QIODevice::WriteOnly | QIODevice::Text))
+	{
+		QTextStream out(&saveFile);
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+		out.setEncoding(QStringConverter::Utf8);
+#else
+		out.setCodec("UTF-8");
+#endif
+		doc.save(out, 4);
+		return saveFile.commit();
+	}
+	return false;
+}
+
+void PagePresetManager::setChildText(QDomElement &parent, const QString &tagName, const QString &text)
+{
+	QDomElement element = parent.firstChildElement(tagName);
+
+	if (element.isNull())
+	{
+		element = parent.ownerDocument().createElement(tagName);
+		parent.appendChild(element);
+	}
+
+	while (element.hasChildNodes())
+		element.removeChild(element.firstChild());
+
+	element.appendChild(parent.ownerDocument().createTextNode(text));
+}
diff --git a/scribus/manager/pagepreset_manager.h b/scribus/manager/pagepreset_manager.h
new file mode 100644
index 000000000..1764cb5c1
--- /dev/null
+++ b/scribus/manager/pagepreset_manager.h
@@ -0,0 +1,151 @@
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+
+/*
+For general Scribus copyright and licensing information please refer
+to the COPYING file provided with the program.
+*/
+#ifndef PAGEPRESET_MANAGER_H
+#define PAGEPRESET_MANAGER_H
+
+#include <QDomDocument>
+#include <QMap>
+#include <QObject>
+#include <QSize>
+#include <QStringList>
+#include <QXmlStreamReader>
+#include "margins.h"
+#include "ui/marginpresetlayout.h"
+
+using LocalizedStringsMap = QMap<QString, QString>;
+
+enum PageSizeType
+{
+	Undefined = 0,
+	Preset,
+	User
+};
+
+struct PageCollectionInfo
+{
+	QString id;
+	QString displayName {"undefined"};
+	QString name {"undefined"}; // original name
+	QString author;
+	QString license;
+	QString filePath;
+	LocalizedStringsMap localizedNames;
+	PageSizeType type {PageSizeType::Undefined};
+};
+
+struct PageSizeInfo
+{
+	int pageUnitIndex {-1};
+	int layout {0};
+	int firstPage {1};
+	double width {0.0};
+	double height {0.0};
+	QString displayName {"undefined"};
+	QString name {"undefined"}; // original name
+	QString id;
+	QString label;
+	QString categoryId;
+	QList<QString> lagacyNames; // fallback names for Scribus < 1.7.2
+	QList<double> textFrame;
+	LocalizedStringsMap localizedNames;
+	int marginPreset {PresetLayout::none};
+	MarginStruct margins;
+	MarginStruct bleeds;
+	PageSizeType type {PageSizeType::Undefined};
+};
+
+using PageCollectionInfoMap = QMap<QString, PageCollectionInfo>;
+using PageSizeInfoMap = QMap<QString, PageSizeInfo>;
+
+class PagePresetManager : public QObject
+{
+	Q_OBJECT
+public:
+
+	PagePresetManager(PagePresetManager const &) = delete;
+	void operator=(PagePresetManager const &) = delete;
+	static PagePresetManager &instance();
+
+	static QStringList defaultSizesList();
+
+	QList<QString> categoriesOrder() const { return m_categoryOrderList; }
+
+	PageCollectionInfoMap categories() const { return m_categoryList; }
+
+	PageCollectionInfo categoryInfoById(const QString &id);
+	PageCollectionInfo categoryInfoCustom();
+	PageCollectionInfo categoryInfoPreferred();
+
+	const PageSizeInfoMap &pageSizes() const { return m_pageSizeList; }
+
+	PageSizeInfoMap activePageSizes() const;
+	PageSizeInfoMap sizesByCategory(QString categoryId) const;
+	PageSizeInfoMap sizesByDimensions(QSizeF sizePt) const;
+
+	PageSizeInfo pageInfoByDimensions(double width, double height) const { return pageInfoByDimensions(QSizeF(width, height)); }
+	PageSizeInfo pageInfoByDimensions(QSizeF sizePt) const;
+	PageSizeInfo pageInfoByName(const QString &name) const;
+	PageSizeInfo pageInfoCustom() const;
+
+	void reloadAllPresets();
+
+	// Custom preset functions
+	static bool createOrUpdateCollection(const QString &filePath, const PageCollectionInfo &meta, QString &outUuid);
+	static bool removeCollection(const QString &filePath);
+	static bool isCollectionsEmpty(const QString &filePath);
+	static bool addCollectionPage(const QString &filePath, const PageSizeInfo &pageInfo);
+	static bool updateCollectionPage(const QString &filePath, const PageSizeInfo &pageInfo);
+	static bool removeCollectionPage(const QString &filePath, const QString &compositeId);
+
+private:
+	enum class IndexAction
+	{
+		Add,
+		Remove
+	};
+
+	PagePresetManager(QObject *parent = nullptr);
+	~PagePresetManager() = default;
+
+	static PagePresetManager *m_instance;
+
+	PageSizeInfoMap m_pageSizeList;
+	PageCollectionInfoMap m_categoryList;
+	QList<QString> m_categoryOrderList;
+
+	LocalizedStringsMap parseNamesBlock(QXmlStreamReader &xml);
+	const QString systemIndexFile();
+	const QString userIndexFile();
+	bool hasValidVersion(const QString &version);
+
+	void addCategory(const PageCollectionInfo &collection);
+	void addPageSize(const PageSizeInfo &info);
+	void loadAllPresets(const QString &indexFilePath, PageSizeType type);
+	void parseCollectionFile(const QString &filePath, PageSizeType type);
+
+	template<typename T>
+	void updateDisplayName(T &info);
+
+	// Custom preset functions
+	static bool isSizeMatch(const PageSizeInfo &info, const QSizeF &size);
+	static bool updateIndexFile(const QString &collectionFilePath, IndexAction action);
+	static bool loadDocument(const QString &filePath, QDomDocument &doc);
+	static bool saveDocument(const QString &filePath, const QDomDocument &doc);
+	static void setChildText(QDomElement &parent, const QString &tagName, const QString &text);
+
+private slots:
+	void localeChange();
+};
+
+#endif // PAGEPRESET_MANAGER_H
diff --git a/scribus/pagesize.cpp b/scribus/pagesize.cpp
index dc4d6c94c..206472c63 100644
--- a/scribus/pagesize.cpp
+++ b/scribus/pagesize.cpp
@@ -19,739 +19,22 @@ for which a new license (GPL+exception) is in place.
  *                                                                         *
  ***************************************************************************/
 
-#include "commonstrings.h"
 #include "pagesize.h"
-#include "prefsmanager.h"
 #include <QStringList>
 #include <QObject>
 
 PageSize::PageSize(const QString& sizeName)
 {
-	init(sizeName);
+	m_pageInfo = PagePresetManager::instance().pageInfoByName(sizeName);
 }
 
 PageSize::PageSize(double w, double h)
-        : m_width(w),
-          m_height(h)
 {
-	m_pageSizeName = CommonStrings::customPageSize;
-	m_trPageSizeName = CommonStrings::trCustomPageSize;
+	m_pageInfo = PagePresetManager::instance().pageInfoByDimensions(QSizeF(w, h));
 }
 
 PageSize& PageSize::operator=(const PageSize& other)
 {
-	init(other.name());
+	m_pageInfo = PagePresetManager::instance().pageInfoByDimensions(QSizeF(other.width(), other.height()));
 	return *this;
 }
-
-void PageSize::init(const QString& sizeName)
-{
-	m_width = 0.0;
-	m_height = 0.0;
-	m_pageUnitIndex = -1;
-	m_pageSizeName.clear();
-	m_trPageSizeName.clear();
-
-	bool valuesSet = false;
-	generateSizeList();
-	//Build based on untranslated key value
-	if (m_pageSizeList.contains(sizeName))
-	{
-		PageSizeInfoMap::Iterator it = m_pageSizeList.find(sizeName);
-		m_pageSizeName = it.key();
-		m_width = it.value().width;
-		m_height = it.value().height;
-		m_pageUnitIndex = it.value().pageUnitIndex;
-		m_trPageSizeName = it.value().trSizeName;
-		m_category = it.value().category;
-		valuesSet = true;
-	}
-	else //build based on translated value.
-	{
-		PageSizeInfoMap::Iterator it;
-		for (it = m_pageSizeList.begin(); it != m_pageSizeList.end() && !valuesSet; ++it)
-		{
-			if (sizeName == it.value().trSizeName)
-			{
-				m_pageSizeName = it.key();
-				m_width = it.value().width;
-				m_height = it.value().height;
-				m_pageUnitIndex = it.value().pageUnitIndex;
-				m_trPageSizeName = it.value().trSizeName;
-				m_category = it.value().category;
-				valuesSet = true;
-			}
-		}
-	}
-
-	if (!valuesSet)
-	{
-		//qDebug("Non-existent page size selected");
-		m_width = 0.0;
-		m_height = 0.0;
-		m_pageUnitIndex = -1;
-		m_pageSizeName = CommonStrings::customPageSize;
-		m_trPageSizeName = CommonStrings::trCustomPageSize;
-		m_category = PageSizeInfo::Custom;
-	}
-}
-
-QStringList PageSize::defaultSizesList()
-{
-	return { "IsoA_A03", "IsoA_A04", "IsoA_A05", "IsoA_A06", "US_Letter" };
-}
-
-PageSizeCategoriesMap PageSize::categories() const
-{
-	PageSizeCategoriesMap map;
-
-	for (auto it = m_pageSizeList.begin(); it != m_pageSizeList.end(); ++it)
-		map.insert(it.value().category, categoryToString(it.value().category));
-
-	return map;
-}
-
-PageSizeInfoMap PageSize::sizesByCategory(PageSizeInfo::Category category) const
-{
-	PageSizeInfoMap map;
-
-	for (auto it = m_pageSizeList.begin(); it != m_pageSizeList.end(); ++it)
-	{
-		if (it.value().category == category)
-			map.insert(it.value().sizeName, it.value());
-	}
-
-	return map;
-}
-
-PageSizeInfoMap PageSize::sizesByDimensions(QSize 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())
-			map.insert(it.value().sizeName, it.value());
-	}
-
-	return map;
-}
-
-PageSizeInfoMap PageSize::activePageSizes() const
-{
-	PageSizeInfoMap map;
-	if (PrefsManager::instance().appPrefs.activePageSizes.count() == 0)
-		return pageSizes();
-
-	QStringList activeList(PrefsManager::instance().appPrefs.activePageSizes);
-
-	for (auto it = m_pageSizeList.begin(); it != m_pageSizeList.end(); ++it)
-	{
-		if (activeList.contains(it.value().sizeName))
-			map.insert(it.value().sizeName, it.value());
-	}
-
-	return map;
-}
-
-void PageSize::addPageSize(const QString id, const QString name, double width, double height, int unitIndex, PageSizeInfo::Category category)
-{
-
-	struct PageSizeInfo info;
-	QString unit;
-
-	switch (unitIndex)
-	{
-	case SC_C: // cicero
-		info.width = c2pts(width);
-		info.height = c2pts(height);
-		unit = "c";
-		break;
-	case SC_CM: // centimeter
-		info.width = cm2pts(width);
-		info.height = cm2pts(height);
-		unit = "cm";
-		break;
-	case SC_IN: // inch
-		info.width = in2pts(width);
-		info.height = in2pts(height);
-		unit = "in";
-		break;
-	case SC_MM: // millimeter
-	default:
-		info.width = mm2pts(width);
-		info.height = mm2pts(height);
-		unit = "mm";
-		break;
-	case SC_P: // picas
-		info.width = p2pts(width);
-		info.height = p2pts(height);
-		unit = "p";
-		break;
-	}
-
-	info.pageUnitIndex = unitIndex;
-	info.sizeName = id;
-	info.trSizeName = name;
-	info.category = category;
-	info.sizeLabel = QString("%1 x %2 %3").arg(width).arg(height).arg(unit);
-	m_pageSizeList.insert(info.sizeName, info);
-}
-
-void PageSize::addPageSize(const QString id, double width, double height, int unitIndex, PageSizeInfo::Category category)
-{
-	addPageSize(id, id, width, height, unitIndex, category);
-}
-
-QString PageSize::categoryToString(PageSizeInfo::Category category) const
-{
-	switch (category)
-	{
-	case PageSizeInfo::Preferred:
-		return QObject::tr("Preferred");
-	case PageSizeInfo::Custom:
-		return CommonStrings::trCustomPageSize;
-	case PageSizeInfo::Book:
-		return QObject::tr("Books");
-	case PageSizeInfo::BusinessCards:
-		return QObject::tr("Business Cards");
-	case PageSizeInfo::Canadian:
-		return QObject::tr("Canadian");
-	case PageSizeInfo::Chinese:
-		return QObject::tr("Chinese");
-	case PageSizeInfo::Colombian:
-		return QObject::tr("Colombian");	
-	case PageSizeInfo::French:
-		return QObject::tr("French");
-	case PageSizeInfo::German:
-		return QObject::tr("German");
-	case PageSizeInfo::Imperial:
-		return QObject::tr("Imperial");
-	case PageSizeInfo::IsoA:
-		return QObject::tr("ISO A Paper");
-	case PageSizeInfo::IsoB:
-		return QObject::tr("ISO B Paper");
-	case PageSizeInfo::IsoC:
-		return QObject::tr("ISO C Envelope");
-	case PageSizeInfo::IsoEnvelope:
-		return QObject::tr("International Envelopes");
-	case PageSizeInfo::Japanese:
-		return QObject::tr("Japanese");
-	case PageSizeInfo::Newspaper:
-		return QObject::tr("Newspapers");
-	case PageSizeInfo::Other:
-		return QObject::tr("Others");
-	case PageSizeInfo::Swedish:
-		return QObject::tr("Swedish");
-	case PageSizeInfo::Transitional:
-		return QObject::tr("Transitional");
-	case PageSizeInfo::USStandard:
-		return QObject::tr("US Paper");
-	case PageSizeInfo::USPress:
-		return QObject::tr("US Press");
-	case PageSizeInfo::USEnvelope:
-		return QObject::tr("US Envelopes");
-	default:
-		return "undefined";
-		break;
-	}
-}
-
-
-void PageSize::generateSizeList()
-{
-	// Books
-	// https://papersizes.io/books/	
-	// https://paper-size.com/size/12mo-books-sizes.html
-	// https://en.wikipedia.org/wiki/Book_size
-	// https://blissetts.com/sizes-stocks-more
-	PageSizeInfo::Category catBooks =  PageSizeInfo::Book;
-	QString prefix = "Book_";
-	addPageSize(prefix + "Folio", QObject::tr("Folio"), 12.0, 19.0, SC_IN, catBooks);
-	addPageSize(prefix + "4to Quarto", QObject::tr("4to (Quarto)"), 9.5, 12.0, SC_IN, catBooks);
-	addPageSize(prefix + "8vo Imperial Octavo", QObject::tr("8vo (Imperial Octavo)"), 8.25, 11.5, SC_IN, catBooks);
-	addPageSize(prefix + "8vo Super Octavo", QObject::tr("8vo (Super Octavo)"), 7.0, 11.0, SC_IN, catBooks);
-	addPageSize(prefix + "8vo Royal Octavo", QObject::tr("8vo (Royal Octavo)"), 6.25, 10.0, SC_IN, catBooks);
-	addPageSize(prefix + "8vo Medium Octavo", QObject::tr("8vo (Medium Octavo)"), 6.5, 9.25, SC_IN, catBooks);
-	addPageSize(prefix + "8vo Octavo", QObject::tr("8vo (Octavo)"), 6.0, 9.0, SC_IN, catBooks);
-	addPageSize(prefix + "8vo Crown Octavo", QObject::tr("8vo (Crown Octavo)"), 5.375, 8.0, SC_IN, catBooks);
-	addPageSize(prefix + "12mo", QObject::tr("12mo (Duodecimo)"), 5.0, 7.375, SC_IN, catBooks);
-	addPageSize(prefix + "16mo", QObject::tr("16mo (Sextodecimo)"), 4.0, 6.75, SC_IN, catBooks);
-	addPageSize(prefix + "18mo", QObject::tr("18mo (Octodecimo)"), 4.0, 6.5, SC_IN, catBooks);
-	addPageSize(prefix + "32mo", QObject::tr("32mo (Tricesimo Secondo)"), 3.5, 5.5, SC_IN, catBooks);
-	addPageSize(prefix + "48mo", QObject::tr("48mo (Quadragesimo Octavo)"), 2.5, 4.0, SC_IN, catBooks);
-	addPageSize(prefix + "64mo", QObject::tr("64mo (Sexagesimo Quarto)"), 2.0, 3.0, SC_IN, catBooks);
-	addPageSize(prefix + "A Format", QObject::tr("A Format"), 4.25, 7.0, SC_IN, catBooks);
-	addPageSize(prefix + "B Format", QObject::tr("B Format"), 5.1, 7.75, SC_IN, catBooks);
-	addPageSize(prefix + "C Format", QObject::tr("C Format"), 5.25, 8.5, SC_IN, catBooks);
-	addPageSize(prefix + "Comic Book", QObject::tr("Comic Book"), 6.63, 10.25, SC_IN, catBooks);
-	addPageSize(prefix + "Crown Quarto", QObject::tr("Crown Quarto"), 189, 246, SC_MM, catBooks);
-
-	// Business Cards
-	// https://papersizes.io/business-card/	
-	PageSizeInfo::Category catBusinessCards = PageSizeInfo::BusinessCards;
-	prefix = "Cards_";
-	addPageSize(prefix + "Europe", QObject::tr("Europe"), 55.0, 85.0, SC_MM, catBusinessCards);
-	addPageSize(prefix + "ISO 7810 ID-1", QObject::tr("ISO 7810 ID-1"), 54.0, 85.6, SC_MM, catBusinessCards);
-	addPageSize(prefix + "US/Canada", QObject::tr("US/Canada"), 2.0, 3.5, SC_IN, catBusinessCards);
-	addPageSize(prefix + "China", QObject::tr("China"), 54.0, 90.0, SC_MM, catBusinessCards);
-	addPageSize(prefix + "Scandinavia", QObject::tr("Scandinavia"), 55.0, 90.0, SC_MM, catBusinessCards);
-	addPageSize(prefix + "Japan", QObject::tr("Japan"), 55.0, 91.0, SC_MM, catBusinessCards);
-	addPageSize(prefix + "Hungary", QObject::tr("Hungary"), 50.0, 90.0, SC_MM, catBusinessCards);
-	addPageSize(prefix + "Iran", QObject::tr("Iran"), 48.0, 85.0, SC_MM, catBusinessCards);
-	addPageSize(prefix + "ISO 216", QObject::tr("ISO 216"), 52.0, 74.0, SC_MM, catBusinessCards);
-
-	// Canadian
-	// https://papersizes.io/canadian/	
-	PageSizeInfo::Category catCanadian = PageSizeInfo::Canadian;
-	prefix = "CA_";
-	addPageSize(prefix + "P1", "P1", 560.0, 860.0, SC_MM, catCanadian);
-	addPageSize(prefix + "P2", "P2", 430.0, 560.0, SC_MM, catCanadian);
-	addPageSize(prefix + "P3", "P3", 280.0, 430.0, SC_MM, catCanadian);
-	addPageSize(prefix + "P4", "P4", 215.0, 280.0, SC_MM, catCanadian);
-	addPageSize(prefix + "P5", "P5", 140.0, 215.0, SC_MM, catCanadian);
-	addPageSize(prefix + "P6", "P6", 107.0, 140.0, SC_MM, catCanadian);
-
-	// Chinese
-	// https://papersizes.io/chinese/	
-	PageSizeInfo::Category catChinese = PageSizeInfo::Chinese;
-	prefix = "CN_";
-	addPageSize(prefix + "D0", "D0", 764.0, 1064.0, SC_MM, catChinese);
-	addPageSize(prefix + "D1", "D1", 532.0, 760.0, SC_MM, catChinese);
-	addPageSize(prefix + "D2", "D2", 380.0, 528.0, SC_MM, catChinese);
-	addPageSize(prefix + "D3", "D3", 264.0, 375.0, SC_MM, catChinese);
-	addPageSize(prefix + "D4", "D4", 188.0, 260.0, SC_MM, catChinese);
-	addPageSize(prefix + "D5", "D5", 130.0, 184.0, SC_MM, catChinese);
-	addPageSize(prefix + "D6", "D6", 92.0, 126.0, SC_MM, catChinese);
-	addPageSize(prefix + "RD0", "RD0", 787.0, 1092.0, SC_MM, catChinese);
-	addPageSize(prefix + "RD1", "RD1", 546.0, 787.0, SC_MM, catChinese);
-	addPageSize(prefix + "RD2", "RD2", 393.0, 546.0, SC_MM, catChinese);
-	addPageSize(prefix + "RD3", "RD3", 273.0, 393.0, SC_MM, catChinese);
-	addPageSize(prefix + "RD4", "RD4", 196.0, 273.0, SC_MM, catChinese);
-	addPageSize(prefix + "RD5", "RD5", 136.0, 196.0, SC_MM, catChinese);
-	addPageSize(prefix + "RD6", "RD6", 98.0, 136.0, SC_MM, catChinese);
-
-	// Colombian
-	// https://papersizes.io/colombian/
-	PageSizeInfo::Category catColombian = PageSizeInfo::Colombian;
-	prefix = "CO_";
-	addPageSize(prefix + "Carta", "Carta", 216.0, 279.0, SC_MM, catColombian);
-	addPageSize(prefix + "Extra Tabloide", "Extra Tabloide", 304.0, 457.2, SC_MM, catColombian);
-	addPageSize(prefix + "Oficio", "Oficio", 216.0, 330.0, SC_MM, catColombian);
-	addPageSize(prefix + "Pliego", "Pliego", 700.0, 1000.0, SC_MM, catColombian);
-	addPageSize(prefix + "1/2 Pliego", "1/2 Pliego", 500.0, 700.0, SC_MM, catColombian);
-	addPageSize(prefix + "1/4 Pliego", "1/4 Pliego", 350.0, 500.0, SC_MM, catColombian);
-	addPageSize(prefix + "1/8 Pliego", "1/8 Pliego", 250.0, 350.0, SC_MM, catColombian);
-
-	// French
-	// https://papersizes.io/french/	
-	PageSizeInfo::Category catFrench = PageSizeInfo::French;
-	prefix = "FR_";
-	addPageSize(prefix + "Cloche", "Cloche", 300.0, 400.0, SC_MM, catFrench);
-	addPageSize(prefix + "Pot ecolier", "Pot, écolier", 310.0, 400.0, SC_MM, catFrench);
-	addPageSize(prefix + "Telliere", "Tellière", 340.0, 440.0, SC_MM, catFrench);
-	addPageSize(prefix + "Couronne ecriture", "Couronne écriture", 360.0, 360.0, SC_MM, catFrench);
-	addPageSize(prefix + "Couronne edition", "Couronne édition", 370.0, 470.0, SC_MM, catFrench);
-	addPageSize(prefix + "Roberto", "Roberto", 390.0, 500.0, SC_MM, catFrench);
-	addPageSize(prefix + "Ecu", "Écu", 400.0, 520.0, SC_MM, catFrench);
-	addPageSize(prefix + "Coquille", "Coquille", 440.0, 560.0, SC_MM, catFrench);
-	addPageSize(prefix + "Carre", "Carré", 450.0, 560.0, SC_MM, catFrench);
-	addPageSize(prefix + "Cavalier", "Cavalier", 460.0, 620.0, SC_MM, catFrench);
-	addPageSize(prefix + "Demi-raisin", "Demi-raisin", 325.0, 500.0, SC_MM, catFrench);
-	addPageSize(prefix + "Raisin", "Raisin", 500.0, 650.0, SC_MM, catFrench);
-	addPageSize(prefix + "Double Raisin", "Double Raisin", 650.0, 1000.0, SC_MM, catFrench);
-	addPageSize(prefix + "Jesus", "Jésus", 560.0, 760.0, SC_MM, catFrench);
-	addPageSize(prefix + "Soleil", "Soleil", 600.0, 800.0, SC_MM, catFrench);
-	addPageSize(prefix + "Colombier affiche", "Colombier affiche", 600.0, 800.0, SC_MM, catFrench);
-	addPageSize(prefix + "Colombier commercial", "Colombier commercial", 630.0, 900.0, SC_MM, catFrench);
-	addPageSize(prefix + "Petit Aigle", "Petit Aigle", 700.0, 940.0, SC_MM, catFrench);
-	addPageSize(prefix + "Grand Aigle", "Grand Aigle", 750.0, 1050.0, SC_MM, catFrench);
-	addPageSize(prefix + "Grand Monde", "Grand Monde", 900.0, 1260.0, SC_MM, catFrench);
-	addPageSize(prefix + "Univers", "Univers", 1000.0, 1130.0, SC_MM, catFrench);
-
-	// German
-	// https://papersizes.io/german/
-	// https://www.saxoprint.de/blog/papier/papierformate
-	PageSizeInfo::Category catGerman = PageSizeInfo::German;
-	prefix = "DE_";
-	addPageSize(prefix + "DIN D00", "DIN D0", 771.0, 1090.0, SC_MM, catGerman);
-	addPageSize(prefix + "DIN D01", "DIN D1", 545.0, 771.0, SC_MM, catGerman);
-	addPageSize(prefix + "DIN D02", "DIN D2", 385.0, 545.0, SC_MM, catGerman);
-	addPageSize(prefix + "DIN D03", "DIN D3", 272.0, 385.0, SC_MM, catGerman);
-	addPageSize(prefix + "DIN D04", "DIN D4", 192.0, 272.0, SC_MM, catGerman);
-	addPageSize(prefix + "DIN D05", "DIN D5", 136.0, 192.0, SC_MM, catGerman);
-	addPageSize(prefix + "DIN D06", "DIN D6", 96.0, 136.0, SC_MM, catGerman);
-	addPageSize(prefix + "DIN D07", "DIN D7", 68.0, 96.0, SC_MM, catGerman);
-	addPageSize(prefix + "DIN D08", "DIN D8", 48.0, 68.0, SC_MM, catGerman);
-	addPageSize(prefix + "DIN D09", "DIN D9", 34.0, 48.0, SC_MM, catGerman);
-	addPageSize(prefix + "DIN D10", "DIN D10", 24.0, 34.0, SC_MM, catGerman);
-
-	// Imperial
-	// https://papersdb.com/imperial
-	// https://en.wikipedia.org/wiki/Paper_size#Traditional_inch-based_paper_sizes
-	PageSizeInfo::Category catImperial = PageSizeInfo::Imperial;
-	prefix = "Imp_";
-	addPageSize(prefix + "Quarto", QObject::tr("Quarto"), 8.0, 10.0, SC_IN, catImperial); // from 1.6.2
-	addPageSize(prefix + "Foolscap", QObject::tr("Foolscap"), 8.0, 13.0, SC_IN, catImperial); // from 1.6.2
-	addPageSize(prefix + "Executive", QObject::tr("Executive"), 7.25, 10.5, SC_IN, catImperial); // from 1.6.2
-	addPageSize(prefix + "Post", QObject::tr("Post"), 15.5, 19.25, SC_IN, catImperial); // from 1.6.2
-	addPageSize(prefix + "Crown", QObject::tr("Crown"), 15.0, 20.0, SC_IN, catImperial); // from 1.6.2
-	addPageSize(prefix + "Large Post", QObject::tr("Large Post"), 16.5, 21.0, SC_IN, catImperial); // from 1.6.2
-	addPageSize(prefix + "Demy", QObject::tr("Demy"), 17.5, 22.5, SC_IN, catImperial); // from 1.6.2
-	addPageSize(prefix + "Medium", QObject::tr("Medium"), 18.0, 23.0, SC_IN, catImperial); // from 1.6.2
-	addPageSize(prefix + "Royal", QObject::tr("Royal"), 20.0, 25.0, SC_IN, catImperial); // from 1.6.2
-	addPageSize(prefix + "Elephant", QObject::tr("Elephant"), 23.0, 28.0, SC_IN, catImperial); // from 1.6.2
-	addPageSize(prefix + "Double Demy", QObject::tr("Double Demy"), 22.5, 35.0, SC_IN, catImperial); // from 1.6.2
-	addPageSize(prefix + "Quad Demy", QObject::tr("Quad Demy"), 35.0, 45.0, SC_IN, catImperial); // from 1.6.2
-	addPageSize(prefix + "STMT", QObject::tr("STMT"), 5.5, 8.5, SC_IN, catImperial); // from 1.6.2
-
-	// ISO A series
-	// https://papersizes.io/a/	
-	PageSizeInfo::Category catIsoA = PageSizeInfo::IsoA;
-	prefix = "IsoA_";
-	addPageSize(prefix + "2A0", "2A0", 1189.0, 1682.0, SC_MM, catIsoA); // from 1.6.2
-	addPageSize(prefix + "4A0", "4A0", 1682.0, 2378.0, SC_MM, catIsoA); // from 1.6.2
-	addPageSize(prefix + "A00+", "A0+", 914.0, 1292.0, SC_MM, catIsoA);
-	addPageSize(prefix + "A00", "A0", 841.0, 1189.0, SC_MM, catIsoA); // from 1.6.2
-	addPageSize(prefix + "A01+", "A1+", 609.0, 914.0, SC_MM, catIsoA);
-	addPageSize(prefix + "A01", "A1", 594.0, 841.0, SC_MM, catIsoA); // from 1.6.2
-	addPageSize(prefix + "A02", "A2", 420.0, 594.0, SC_MM, catIsoA); // from 1.6.2
-	addPageSize(prefix + "A03+", "A3+", 329.0, 483.0, SC_MM, catIsoA);
-	addPageSize(prefix + "A03", "A3", 297.0, 420.0, SC_MM, catIsoA); // from 1.6.2
-	addPageSize(prefix + "A04", "A4", 210.0, 297.0, SC_MM, catIsoA); // from 1.6.2
-	addPageSize(prefix + "A05", "A5", 148.0, 210.0, SC_MM, catIsoA); // from 1.6.2
-	addPageSize(prefix + "A06", "A6", 105.0, 148.0, SC_MM, catIsoA); // from 1.6.2
-	addPageSize(prefix + "A07", "A7", 74.0, 105.0, SC_MM, catIsoA); // from 1.6.2
-	addPageSize(prefix + "A08", "A8", 52.0, 74.0, SC_MM, catIsoA); // from 1.6.2
-	addPageSize(prefix + "A09", "A9", 37.0, 52.0, SC_MM, catIsoA); // from 1.6.2
-	addPageSize(prefix + "A10", "A10", 26.0, 37.0, SC_MM, catIsoA); // from 1.6.2
-
-	// ISO B series
-	// https://papersizes.io/b/	
-	PageSizeInfo::Category catIsoB = PageSizeInfo::IsoB;
-	prefix = "IsoB_";
-	addPageSize(prefix + "B00+", "B0+", 1118.0, 1580.0, SC_MM, catIsoB);
-	addPageSize(prefix + "B00", "B0", 1000.0, 1414.0, SC_MM, catIsoB); // from 1.6.2
-	addPageSize(prefix + "B01+", "B1+", 720.0, 1020.0, SC_MM, catIsoB);
-	addPageSize(prefix + "B01", "B1", 707.0, 1000.0, SC_MM, catIsoB); // from 1.6.2
-	addPageSize(prefix + "B02+", "B2+", 520.0, 720.0, SC_MM, catIsoB);
-	addPageSize(prefix + "B02", "B2", 500.0, 707.0, SC_MM, catIsoB); // from 1.6.2
-	addPageSize(prefix + "B03", "B3", 353.0, 500.0, SC_MM, catIsoB); // from 1.6.2
-	addPageSize(prefix + "B04", "B4", 250.0, 353.0, SC_MM, catIsoB); // from 1.6.2
-	addPageSize(prefix + "B05", "B5", 176.0, 250.0, SC_MM, catIsoB); // from 1.6.2
-	addPageSize(prefix + "B06", "B6", 125.0, 176.0, SC_MM, catIsoB); // from 1.6.2
-	addPageSize(prefix + "B07", "B7", 88.0, 125.0, SC_MM, catIsoB); // from 1.6.2
-	addPageSize(prefix + "B08", "B8", 62.0, 88.0, SC_MM, catIsoB); // from 1.6.2
-	addPageSize(prefix + "B09", "B9", 44.0, 62.0, SC_MM, catIsoB); // from 1.6.2
-	addPageSize(prefix + "B10", "B10", 31.0, 44.0, SC_MM, catIsoB); // from 1.6.2
-
-	// ISO C series
-	// https://papersizes.io/c-envelope/	
-	PageSizeInfo::Category catIsoC = PageSizeInfo::IsoC;
-	prefix = "IsoC_";
-	addPageSize(prefix + "C00", "C0", 917.0, 1297.0, SC_MM, catIsoC); // from 1.6.2
-	addPageSize(prefix + "C01", "C1", 648.0, 917.0, SC_MM, catIsoC); // from 1.6.2
-	addPageSize(prefix + "C02", "C2", 458.0, 648.0, SC_MM, catIsoC); // from 1.6.2
-	addPageSize(prefix + "C03", "C3", 324.0, 458.0, SC_MM, catIsoC); // from 1.6.2
-	addPageSize(prefix + "C04", "C4", 229.0, 324.0, SC_MM, catIsoC); // from 1.6.2
-	addPageSize(prefix + "C05", "C5", 162.0, 229.0, SC_MM, catIsoC); // from 1.6.2
-	addPageSize(prefix + "C06", "C6", 114.0, 162.0, SC_MM, catIsoC); // from 1.6.2
-	addPageSize(prefix + "C07", "C7", 81.0, 114.0, SC_MM, catIsoC); // from 1.6.2
-	addPageSize(prefix + "C08", "C8", 57.0, 81.0, SC_MM, catIsoC); // from 1.6.2
-	addPageSize(prefix + "C09", "C9", 40.0, 57.0, SC_MM, catIsoC); // from 1.6.2
-	addPageSize(prefix + "C10", "C10", 28.0, 40.0, SC_MM, catIsoC); // from 1.6.2
-
-	// ISO Envelopes
-	// https://papersizes.io/international-envelope/	
-	PageSizeInfo::Category catIsoEnvelope = PageSizeInfo::IsoEnvelope;
-	prefix = "IsoEnv_";
-	addPageSize(prefix + "DL/E65", "DL, E65", 110.0, 220.0, SC_MM, catIsoEnvelope); // from 1.6.2
-	// addPageSize(prefix + "B4", "B4", 250.0, 353.0, SC_MM, catIsoEnvelope);
-	// addPageSize(prefix + "B5", "B5", 176.0, 250.0, SC_MM, catIsoEnvelope);
-	// addPageSize(prefix + "B6", "B6", 125.0, 176.0, SC_MM, catIsoEnvelope);
-	// addPageSize(prefix + "C3", "C3", 324.0, 458.0, SC_MM, catIsoEnvelope);
-	// addPageSize(prefix + "C4", "C4", 229.0, 324.0, SC_MM, catIsoEnvelope);
-	addPageSize(prefix + "C4M", "C4M", 229.0, 318.0, SC_MM, catIsoEnvelope);
-	// addPageSize(prefix + "C5", "C5", 162.0, 229.0, SC_MM, catIsoEnvelope);
-	addPageSize(prefix + "C6/C5", "C6/C5", 114.0, 229.0, SC_MM, catIsoEnvelope);
-	// addPageSize(prefix + "C6", "C6", 114.0, 162.0, SC_MM, catIsoEnvelope);
-	addPageSize(prefix + "C64M", "C64M", 114.0, 318.0, SC_MM, catIsoEnvelope);
-	// addPageSize(prefix + "C7", "C7", 81.0, 114.0, SC_MM, catIsoEnvelope);
-	addPageSize(prefix + "C7/C6", "C7/C6", 81.0, 162.0, SC_MM, catIsoEnvelope);
-	addPageSize(prefix + "B6/C4", "B6/C4", 125.0, 324.0, SC_MM, catIsoEnvelope);
-	addPageSize(prefix + "E4", "E4", 220.0, 312.0, SC_MM, catIsoEnvelope);
-	addPageSize(prefix + "E5", "E5", 115.0, 220.0, SC_MM, catIsoEnvelope);
-	addPageSize(prefix + "E56", "E56", 115.0, 115.0, SC_MM, catIsoEnvelope);
-	addPageSize(prefix + "E6", "E6", 110.0, 155.0, SC_MM, catIsoEnvelope);
-	addPageSize(prefix + "EC45", "EC45", 220.0, 229.0, SC_MM, catIsoEnvelope);
-	addPageSize(prefix + "EC5", "EC5", 155.0, 229.0, SC_MM, catIsoEnvelope);
-	addPageSize(prefix + "R7", "R7", 120.0, 135.0, SC_MM, catIsoEnvelope);
-	addPageSize(prefix + "S4", "S4", 250.0, 330.0, SC_MM, catIsoEnvelope);
-	addPageSize(prefix + "S5", "S5", 185.0, 255.0, SC_MM, catIsoEnvelope);
-	addPageSize(prefix + "S65", "S65", 110.0, 225.0, SC_MM, catIsoEnvelope);
-	addPageSize(prefix + "X5", "X5", 105.0, 216.0, SC_MM, catIsoEnvelope);
-	addPageSize(prefix + "EX5", "EX5", 115.0, 216.0, SC_MM, catIsoEnvelope);
-
-	// Japanese
-	// https://papersizes.io/japanese/	
-	PageSizeInfo::Category catJapanese = PageSizeInfo::Japanese;
-	prefix = "JP_";
-	addPageSize(prefix + "JB00", "JB0", 1030.0, 1456.0, SC_MM, catJapanese);
-	addPageSize(prefix + "JB01", "JB1", 728.0, 1030.0, SC_MM, catJapanese);
-	addPageSize(prefix + "JB02", "JB2", 515.0, 728.0, SC_MM, catJapanese);
-	addPageSize(prefix + "JB03", "JB3", 364.0, 515.0, SC_MM, catJapanese);
-	addPageSize(prefix + "JB04", "JB4", 257.0, 364.0, SC_MM, catJapanese);
-	addPageSize(prefix + "JB05", "JB5", 182.0, 257.0, SC_MM, catJapanese);
-	addPageSize(prefix + "JB06", "JB6", 128.0, 182.0, SC_MM, catJapanese);
-	addPageSize(prefix + "JB07", "JB7", 91.0, 128.0, SC_MM, catJapanese);
-	addPageSize(prefix + "JB08", "JB8", 64.0, 91.0, SC_MM, catJapanese);
-	addPageSize(prefix + "JB09", "JB9", 45.0, 64.0, SC_MM, catJapanese);
-	addPageSize(prefix + "JB10", "JB10", 32.0, 45.0, SC_MM, catJapanese);
-	addPageSize(prefix + "JB11", "JB11", 22.0, 32.0, SC_MM, catJapanese);
-	addPageSize(prefix + "JB12", "JB12", 16.0, 22.0, SC_MM, catJapanese);
-	addPageSize(prefix + "Shiroku ban 4", "Shiroku ban 4", 264.0, 379.0, SC_MM, catJapanese);
-	addPageSize(prefix + "Shiroku ban 5", "Shiroku ban 5", 189.0, 262.0, SC_MM, catJapanese);
-	addPageSize(prefix + "Shiroku ban 6", "Shiroku ban 6", 127.0, 188.0, SC_MM, catJapanese);
-	addPageSize(prefix + "Kiku 4", "Kiku 4", 227.0, 306.0, SC_MM, catJapanese);
-	addPageSize(prefix + "Kiku 5", "Kiku 5", 151.0, 227.0, SC_MM, catJapanese);
-
-	// Newspaper
-	// https://papersizes.io/newspaper/
-	// https://en.wikipedia.org/wiki/Broadsheet
-	// https://www.papersizes.org/
-	PageSizeInfo::Category catNewspaper = PageSizeInfo::Newspaper;
-	prefix = "News_";
-	// Broadsheet
-	addPageSize(prefix + "AU/NZ Broadsheet", QObject::tr("AU/NZ Broadsheet"), 420.0, 594.0, SC_MM, catNewspaper);
-	addPageSize(prefix + "Berliner Broadsheet", QObject::tr("Berliner Broadsheet"), 315.0, 470.0, SC_MM, catNewspaper);
-	addPageSize(prefix + "Ciner", QObject::tr("Ciner"), 350.0, 500.0, SC_MM, catNewspaper);
-	addPageSize(prefix + "New York Times", QObject::tr("New York Times"), 12.0, 22.0, SC_IN, catNewspaper);
-	addPageSize(prefix + "Nordisch Broadsheet", QObject::tr("Nordisch Broadsheet"), 400.0, 570.0, SC_MM, catNewspaper);
-	addPageSize(prefix + "Rhenish Broadsheet", QObject::tr("Rhenish Broadsheet"), 350.0, 520.0, SC_MM, catNewspaper);
-	addPageSize(prefix + "SA Broadsheet", QObject::tr("SA Broadsheet"), 410.0, 578.0, SC_MM, catNewspaper);
-	addPageSize(prefix + "Swiss Broadsheet", QObject::tr("Swiss Broadsheet"), 320.0, 475.0, SC_MM, catNewspaper);
-	addPageSize(prefix + "UK Broadsheet", QObject::tr("UK Broadsheet"), 375.0, 597.0, SC_MM, catNewspaper);
-	addPageSize(prefix + "US Broadsheet", QObject::tr("US Broadsheet"), 15.0, 22.75, SC_IN, catNewspaper);
-	addPageSize(prefix + "Wall Street Journal", QObject::tr("Wall Street Journal"), 12.0, 22.75, SC_IN, catNewspaper);
-	// Tabloids
-	addPageSize(prefix + "Berliner Tabloid", QObject::tr("Berliner Tabloid"), 235.0, 315.0, SC_MM, catNewspaper);
-	addPageSize(prefix + "Canadian Tabloid", QObject::tr("Canadian Tabloid"), 260.0, 368.0, SC_MM, catNewspaper);
-	addPageSize(prefix + "Canadian Tall Tabloid", QObject::tr("Canadian Tall Tabloid"), 260.0, 413.0, SC_MM, catNewspaper);
-	addPageSize(prefix + "Nordisch Tabloid", QObject::tr("Nordisch Tabloid"), 285.0, 400.0, SC_MM, catNewspaper);
-	addPageSize(prefix + "Norwegian Tabloid", QObject::tr("Norwegian Tabloid"), 280.0, 400.0, SC_MM, catNewspaper);
-	addPageSize(prefix + "Rhenish Tabloid", QObject::tr("Rhenish Tabloid"), 260.0, 350.0, SC_MM, catNewspaper);
-	addPageSize(prefix + "UK Tabloid", QObject::tr("UK Tabloid"), 280.0, 430.0, SC_MM, catNewspaper);
-	addPageSize(prefix + "Compact", QObject::tr("Compact"), 280.0, 430.0, SC_MM, catNewspaper);
-
-	// Swedish
-	// https://papersizes.io/swedish/
-	PageSizeInfo::Category catSwedish = PageSizeInfo::Swedish;
-	prefix = "SE_";
-	addPageSize(prefix + "SIS D00", "SIS D0", 1091.0, 1542.0, SC_MM, catSwedish);
-	addPageSize(prefix + "SIS D01", "SIS D1", 771.0, 1091.0, SC_MM, catSwedish);
-	addPageSize(prefix + "SIS D02", "SIS D2", 545.0, 771.0, SC_MM, catSwedish);
-	addPageSize(prefix + "SIS D03", "SIS D3", 386.0, 545.0, SC_MM, catSwedish);
-	addPageSize(prefix + "SIS D04", "SIS D4", 273.0, 386.0, SC_MM, catSwedish);
-	addPageSize(prefix + "SIS D05", "SIS D5", 193.0, 273.0, SC_MM, catSwedish);
-	addPageSize(prefix + "SIS D06", "SIS D6", 136.0, 193.0, SC_MM, catSwedish);
-	addPageSize(prefix + "SIS D07", "SIS D7", 96.0, 136.0, SC_MM, catSwedish);
-	addPageSize(prefix + "SIS D08", "SIS D8", 68.0, 96.0, SC_MM, catSwedish);
-	addPageSize(prefix + "SIS D09", "SIS D9", 48.0, 68.0, SC_MM, catSwedish);
-	addPageSize(prefix + "SIS D10", "SIS D10", 34.0, 48.0, SC_MM, catSwedish);
-	addPageSize(prefix + "SIS E00", "SIS E0", 878.0, 1242.0, SC_MM, catSwedish);
-	addPageSize(prefix + "SIS E01", "SIS E1", 621.0, 878.0, SC_MM, catSwedish);
-	addPageSize(prefix + "SIS E02", "SIS E2", 439.0, 621.0, SC_MM, catSwedish);
-	addPageSize(prefix + "SIS E03", "SIS E3", 310.0, 439.0, SC_MM, catSwedish);
-	addPageSize(prefix + "SIS E04", "SIS E4", 220.0, 310.0, SC_MM, catSwedish);
-	addPageSize(prefix + "SIS E05", "SIS E5", 155.0, 220.0, SC_MM, catSwedish);
-	addPageSize(prefix + "SIS E06", "SIS E6", 110.0, 155.0, SC_MM, catSwedish);
-	addPageSize(prefix + "SIS E07", "SIS E7", 78.0, 110.0, SC_MM, catSwedish);
-	addPageSize(prefix + "SIS E08", "SIS E8", 55.0, 78.0, SC_MM, catSwedish);
-	addPageSize(prefix + "SIS E09", "SIS E9", 39.0, 55.0, SC_MM, catSwedish);
-	addPageSize(prefix + "SIS E10", "SIS E10", 27.0, 39.0, SC_MM, catSwedish);
-	addPageSize(prefix + "SIS F00", "SIS F0", 958.0, 1354.0, SC_MM, catSwedish);
-	addPageSize(prefix + "SIS F01", "SIS F1", 677.0, 958.0, SC_MM, catSwedish);
-	addPageSize(prefix + "SIS F02", "SIS F2", 479.0, 677.0, SC_MM, catSwedish);
-	addPageSize(prefix + "SIS F03", "SIS F3", 339.0, 479.0, SC_MM, catSwedish);
-	addPageSize(prefix + "SIS F04", "SIS F4", 239.0, 339.0, SC_MM, catSwedish);
-	addPageSize(prefix + "SIS F05", "SIS F5", 169.0, 239.0, SC_MM, catSwedish);
-	addPageSize(prefix + "SIS F06", "SIS F6", 120.0, 169.0, SC_MM, catSwedish);
-	addPageSize(prefix + "SIS F07", "SIS F7", 85.0, 120.0, SC_MM, catSwedish);
-	addPageSize(prefix + "SIS F08", "SIS F8", 60.0, 85.0, SC_MM, catSwedish);
-	addPageSize(prefix + "SIS F09", "SIS F9", 42.0, 60.0, SC_MM, catSwedish);
-	addPageSize(prefix + "SIS F10", "SIS F10", 30.0, 42.0, SC_MM, catSwedish);
-	addPageSize(prefix + "SIS G00", "SIS G0", 1044.0, 1477.0, SC_MM, catSwedish);
-	addPageSize(prefix + "SIS G01", "SIS G1", 738.0, 1044.0, SC_MM, catSwedish);
-	addPageSize(prefix + "SIS G02", "SIS G2", 522.0, 738.0, SC_MM, catSwedish);
-	addPageSize(prefix + "SIS G03", "SIS G3", 369.0, 522.0, SC_MM, catSwedish);
-	addPageSize(prefix + "SIS G04", "SIS G4", 261.0, 369.0, SC_MM, catSwedish);
-	addPageSize(prefix + "SIS G05", "SIS G5", 185.0, 261.0, SC_MM, catSwedish);
-	addPageSize(prefix + "SIS G06", "SIS G6", 131.0, 185.0, SC_MM, catSwedish);
-	addPageSize(prefix + "SIS G07", "SIS G7", 92.0, 131.0, SC_MM, catSwedish);
-	addPageSize(prefix + "SIS G08", "SIS G8", 65.0, 92.0, SC_MM, catSwedish);
-	addPageSize(prefix + "SIS G09", "SIS G9", 46.0, 65.0, SC_MM, catSwedish);
-	addPageSize(prefix + "SIS G10", "SIS G10", 33.0, 46.0, SC_MM, catSwedish);
-
-	// Transitional
-	PageSizeInfo::Category catTransitional = PageSizeInfo::Transitional;
-	prefix = "Trans_";
-	addPageSize(prefix + "F00", "F0", 841.0, 1321.0, SC_MM, catTransitional);
-	addPageSize(prefix + "F01", "F1", 660.0, 841.0, SC_MM, catTransitional);
-	addPageSize(prefix + "F02", "F2", 420.0, 660.0, SC_MM, catTransitional);
-	addPageSize(prefix + "F03", "F3", 330.0, 420.0, SC_MM, catTransitional);
-	addPageSize(prefix + "F04", "F4", 210.0, 330.0, SC_MM, catTransitional);
-	addPageSize(prefix + "F05", "F5", 165.0, 210.0, SC_MM, catTransitional);
-	addPageSize(prefix + "F06", "F6", 105.0, 165.0, SC_MM, catTransitional);
-	addPageSize(prefix + "F07", "F7", 82.0, 105.0, SC_MM, catTransitional);
-	addPageSize(prefix + "F08", "F8", 52.0, 82.0, SC_MM, catTransitional);
-	addPageSize(prefix + "F09", "F9", 41.0, 52.0, SC_MM, catTransitional);
-	addPageSize(prefix + "F10", "F10", 26.0, 41.0, SC_MM, catTransitional);
-	addPageSize(prefix + "PA00", "PA0", 840.0, 1120.0, SC_MM, catTransitional); // from 1.6.2
-	addPageSize(prefix + "PA01", "PA1", 560.0, 840.0, SC_MM, catTransitional); // from 1.6.2
-	addPageSize(prefix + "PA02", "PA2", 420.0, 560.0, SC_MM, catTransitional); // from 1.6.2
-	addPageSize(prefix + "PA03", "PA3", 280.0, 420.0, SC_MM, catTransitional); // from 1.6.2
-	addPageSize(prefix + "PA04", "PA4", 210.0, 280.0, SC_MM, catTransitional); // from 1.6.2
-	addPageSize(prefix + "PA05", "PA5", 140.0, 210.0, SC_MM, catTransitional); // from 1.6.2
-	addPageSize(prefix + "PA06", "PA6", 105.0, 140.0, SC_MM, catTransitional); // from 1.6.2
-	addPageSize(prefix + "PA07", "PA7", 70.0, 105.0, SC_MM, catTransitional); // from 1.6.2
-	addPageSize(prefix + "PA08", "PA8", 52.0, 70.0, SC_MM, catTransitional); // from 1.6.2
-	addPageSize(prefix + "PA09", "PA9", 35.0, 52.0, SC_MM, catTransitional); // from 1.6.2
-	addPageSize(prefix + "PA10", "PA10", 26.0, 35.0, SC_MM, catTransitional); // from 1.6.2
-
-
-	// US Paper Size
-	// https://papersizes.io/us/
-	PageSizeInfo::Category catUSStandard = PageSizeInfo::USStandard;
-	prefix = "US_";
-	addPageSize(prefix + "Government Legal", "Government Legal", 8.5, 13.0, SC_IN, catUSStandard);
-	addPageSize(prefix + "Legal", "Legal", 8.5, 14.0, SC_IN, catUSStandard); // from 1.6.2
-	addPageSize(prefix + "Legal Half", "Legal Half", 7.0, 8.5, SC_IN, catUSStandard);
-	addPageSize(prefix + "Junior Legal", "Junior Legal", 5.0, 8.0, SC_IN, catUSStandard);
-	addPageSize(prefix + "Letter", "Letter", 8.5, 11.0, SC_IN, catUSStandard); // from 1.6.2
-	addPageSize(prefix + "Letter Half", "Letter Half", 5.5, 8.5, SC_IN, catUSStandard); // from 1.6.2
-	addPageSize(prefix + "Government Letter", "Government Letter", 8.0, 10.5, SC_IN, catUSStandard); // from 1.6.2	
-	addPageSize(prefix + "Ledger", "Ledger, Tabloid", 11.0, 17.0, SC_IN, catUSStandard); // from 1.6.2
-	addPageSize(prefix + "ANSI A", "ANSI A", 8.5, 11.0, SC_IN, catUSStandard); // from 1.6.2
-	addPageSize(prefix + "ANSI B", "ANSI B", 11.0, 17.0, SC_IN, catUSStandard); // from 1.6.2
-	addPageSize(prefix + "ANSI C", "ANSI C", 17.0, 22.0, SC_IN, catUSStandard); // from 1.6.2
-	addPageSize(prefix + "ANSI D", "ANSI D", 22.0, 34.0, SC_IN, catUSStandard); // from 1.6.2
-	addPageSize(prefix + "ANSI E", "ANSI E", 34.0, 44.0, SC_IN, catUSStandard); // from 1.6.2
-	addPageSize(prefix + "Arch A", "Arch A", 9.0, 12.0, SC_IN, catUSStandard); // from 1.6.2
-	addPageSize(prefix + "Arch B", "Arch B", 12.0, 18.0, SC_IN, catUSStandard); // from 1.6.2
-	addPageSize(prefix + "Arch C", "Arch C", 18.0, 24.0, SC_IN, catUSStandard); // from 1.6.2
-	addPageSize(prefix + "Arch D", "Arch D", 24.0, 36.0, SC_IN, catUSStandard); // from 1.6.2
-	addPageSize(prefix + "Arch E", "Arch E", 36.0, 48.0, SC_IN, catUSStandard); // from 1.6.2
-	addPageSize(prefix + "Arch E1", "Arch E1", 30.0, 42.0, SC_IN, catUSStandard); // from 1.6.2
-	addPageSize(prefix + "Arch E2", "Arch E2", 26.0, 38.0, SC_IN, catUSStandard); // from 1.6.2
-	addPageSize(prefix + "Arch E3", "Arch E3", 27.0, 39.0, SC_IN, catUSStandard); // from 1.6.2
-
-	// US Common Press
-	// https://papersdb.com/common-us-press-sheet
-	PageSizeInfo::Category catUSPress = PageSizeInfo::USPress;
-	prefix = "USPress_";
-	addPageSize(prefix + "11x17", "11x17", 11.0, 17.0, SC_IN, catUSPress); // from 1.6.2
-	addPageSize(prefix + "12x18", "12x18", 12.0, 18.0, SC_IN, catUSPress);
-	addPageSize(prefix + "17x22", "17x22", 17.0, 22.0, SC_IN, catUSPress);
-	addPageSize(prefix + "19x25", "19x25", 19.0, 25.0, SC_IN, catUSPress);
-	addPageSize(prefix + "20x26", "20x26", 20.0, 26.0, SC_IN, catUSPress);
-	addPageSize(prefix + "23x29", "23x29", 23.0, 29.0, SC_IN, catUSPress);
-	addPageSize(prefix + "23x35", "23x35", 23.0, 35.0, SC_IN, catUSPress);
-//	addPageSize(prefix + "24x36", "24x36", 24.0, 36.0, SC_IN, catUSPress);
-	addPageSize(prefix + "25x38", "25x38", 25.0, 38.0, SC_IN, catUSPress);
-	addPageSize(prefix + "26x40", "26x40", 26.0, 40.0, SC_IN, catUSPress);
-	addPageSize(prefix + "28x40", "28x40", 28.0, 40.0, SC_IN, catUSPress);
-	addPageSize(prefix + "35x45", "38x45", 35.0, 45.0, SC_IN, catUSPress);
-	addPageSize(prefix + "38x50", "38x50", 38.0, 50.0, SC_IN, catUSPress);
-
-	// US Envelope
-	// https://papersdb.com/us-baronial-envelope
-	// https://www.wsel.com/envelopes/standard-sizes
-	PageSizeInfo::Category catUSEnvelope = PageSizeInfo::USEnvelope;
-	prefix = "USEnv_";
-	addPageSize(prefix + "A01", "A-1", 3.625, 5.125, SC_IN, catUSEnvelope);
-	addPageSize(prefix + "A02", "A-2 (Lady Grey)", 4.375, 5.75, SC_IN, catUSEnvelope);
-	addPageSize(prefix + "A04", "A-4", 4.25, 6.25, SC_IN, catUSEnvelope);
-	addPageSize(prefix + "A06", "A-6 (Thompson Standard)", 4.75, 6.5, SC_IN, catUSEnvelope);
-	addPageSize(prefix + "A07", "A-7 (Besselheim)", 5.25, 7.25, SC_IN, catUSEnvelope);
-	addPageSize(prefix + "A08", "A-8 (Carrs)", 5.5, 8.125, SC_IN, catUSEnvelope);
-	addPageSize(prefix + "A09", "A-9 (Diplomat)", 5.75, 8.75, SC_IN, catUSEnvelope);
-	addPageSize(prefix + "A10", "A-10 (Willow)", 6.0, 9.5, SC_IN, catUSEnvelope);
-	addPageSize(prefix + "Baronial 04", "Baronial 4", 3.625, 5.125, SC_IN, catUSEnvelope);
-	addPageSize(prefix + "Baronial 05 1/2", "Baronial 5 1/2", 4.375, 5.75, SC_IN, catUSEnvelope);
-	addPageSize(prefix + "Baronial 06", "Baronial 6", 4.75, 6.5, SC_IN, catUSEnvelope);
-	addPageSize(prefix + "Baronial Lee", "Lee", 5.25, 7.25, SC_IN, catUSEnvelope);
-	addPageSize(prefix + "Booklet 03", "Booklet 3", 4.75, 6.0, SC_IN, catUSEnvelope);
-	addPageSize(prefix + "Booklet 04 1/2", "Booklet 4 1/2", 5.5, 7.5, SC_IN, catUSEnvelope);
-	addPageSize(prefix + "Booklet 06", "Booklet 6", 5.75, 8.875, SC_IN, catUSEnvelope);
-	addPageSize(prefix + "Booklet 06 1/2", "Booklet 6 1/2", 6.0, 9.0, SC_IN, catUSEnvelope);
-	addPageSize(prefix + "Booklet 06 7/8", "Booklet 6 7/8", 6.0, 9.5, SC_IN, catUSEnvelope);
-	addPageSize(prefix + "Booklet 06 3/4", "Booklet 6 3/4", 6.5, 9.5, SC_IN, catUSEnvelope);
-	addPageSize(prefix + "Booklet 07 1/2", "Booklet 7 1/2", 7.5, 10.5, SC_IN, catUSEnvelope);
-	addPageSize(prefix + "Booklet 09", "Booklet 9", 8.75, 11.5, SC_IN, catUSEnvelope);
-	addPageSize(prefix + "Booklet 09 1/2", "Booklet 9 1/2", 9.0, 12.0, SC_IN, catUSEnvelope);
-	addPageSize(prefix + "Booklet 10", "Booklet 10", 9.5, 12.625, SC_IN, catUSEnvelope);
-	addPageSize(prefix + "Booklet 13", "Booklet 13", 10.0, 13.0, SC_IN, catUSEnvelope);
-	addPageSize(prefix + "Catalog 01", "Catalog 1", 6.0, 9.0, SC_IN, catUSEnvelope);
-	addPageSize(prefix + "Catalog 01 3/4", "Catalog 1 3/4", 6.5, 9.5, SC_IN, catUSEnvelope);
-	addPageSize(prefix + "Catalog 03", "Catalog 3", 7.0, 10.0, SC_IN, catUSEnvelope);
-	addPageSize(prefix + "Catalog 06", "Catalog 6", 7.5, 10.5, SC_IN, catUSEnvelope);
-	addPageSize(prefix + "Catalog 08", "Catalog 8", 8.25, 11.25, SC_IN, catUSEnvelope);
-	addPageSize(prefix + "Catalog 09 3/4", "Catalog 9 3/4", 8.75, 11.25, SC_IN, catUSEnvelope);
-	addPageSize(prefix + "Catalog 10 1/2", "Catalog 10 1/2", 9.0, 12.0, SC_IN, catUSEnvelope);
-	addPageSize(prefix + "Catalog 12 1/5", "Catalog 12 1/5", 9.5, 12.5, SC_IN, catUSEnvelope);
-	addPageSize(prefix + "Catalog 13 1/2", "Catalog 13 1/2", 10.0, 13.0, SC_IN, catUSEnvelope);
-	addPageSize(prefix + "Catalog 14 1/2", "Catalog 14 1/2", 11.5, 14.5, SC_IN, catUSEnvelope);
-	addPageSize(prefix + "Catalog 15", "Catalog 15", 10.0, 15.0, SC_IN, catUSEnvelope);
-	addPageSize(prefix + "Catalog 15 1/2", "Catalog 15 1/2", 12.0, 15.5, SC_IN, catUSEnvelope);
-	addPageSize(prefix + "Commerical 05", "Commerical 5", 3.125, 5.5, SC_IN, catUSEnvelope);
-	addPageSize(prefix + "Commerical 06 1/4", "Commerical 6 1/4", 3.5, 6.0, SC_IN, catUSEnvelope);
-	addPageSize(prefix + "Commerical 06 3/4", "Commerical 6 3/4", 3.625, 6.5, SC_IN, catUSEnvelope);
-	addPageSize(prefix + "Commerical 07", "Commerical 7", 3.75, 6.75, SC_IN, catUSEnvelope);
-	addPageSize(prefix + "Commerical 07 1/2", "Commerical 7 1/2", 3.9375, 7.5, SC_IN, catUSEnvelope);
-	addPageSize(prefix + "Commerical 08 5/8", "Commerical 8 5/8", 3.625, 8.625, SC_IN, catUSEnvelope);
-	addPageSize(prefix + "Commerical 09", "Commerical 9", 3.875, 8.875, SC_IN, catUSEnvelope);
-	addPageSize(prefix + "Commerical 10", "Commerical 10", 4.125, 9.5, SC_IN, catUSEnvelope); // from 1.6.2
-	addPageSize(prefix + "Commerical 11", "Commerical 11", 4.5, 10.375, SC_IN, catUSEnvelope);
-	addPageSize(prefix + "Commerical 12", "Commerical 12", 4.75, 11, SC_IN, catUSEnvelope);
-	addPageSize(prefix + "Commerical 14", "Commerical 14", 5.0, 11.5, SC_IN, catUSEnvelope);
-	addPageSize(prefix + "Square 06", "Square 6", 6.0, 6.0, SC_IN, catUSEnvelope);
-	addPageSize(prefix + "Square 06 1/2", "Square 6 1/2", 6.5, 6.5, SC_IN, catUSEnvelope);
-	addPageSize(prefix + "Square 07", "Square 7", 7.0, 7.0, SC_IN, catUSEnvelope);
-	addPageSize(prefix + "Square 07 1/2", "Square 7 1/2", 7.5, 7.5, SC_IN, catUSEnvelope);
-	addPageSize(prefix + "Square 08", "Square 8", 8.0, 8.0, SC_IN, catUSEnvelope);
-	addPageSize(prefix + "Square 08 1/2", "Square 8 1/2", 8.5, 8.5, SC_IN, catUSEnvelope);
-	addPageSize(prefix + "Square 09", "Square 9", 9.0, 9.0, SC_IN, catUSEnvelope);
-	addPageSize(prefix + "Square 09 1/2", "Square 9 1/2", 9.5, 9.5, SC_IN, catUSEnvelope);
-
-	// Other Formats
-	// https://www.template.net/graphic-design/album-cover-sizes/
-	// https://print.dvdcover.com/dvd-blu-ray-cover-size.php
-	// https://www.duplication.com/printspecs/k7insertspecs.htm
-	// https://tapemuzik.de/shop/paper-products/cover-without-flap/?lang=en
-	PageSizeInfo::Category catOther = PageSizeInfo::Other;
-	prefix = "Other_";
-	addPageSize(prefix + "Blu-Ray Cover (5 mm)", QObject::tr("Blu-Ray Cover (5 mm)"), 148.0, 257.0, SC_MM, catOther);
-	addPageSize(prefix + "Blu-Ray Cover (12 mm)", QObject::tr("Blu-Ray Cover (12 mm)"), 148.0, 264.0, SC_MM, catOther);
-	addPageSize(prefix + "Blu-Ray Cover (14 mm)", QObject::tr("Blu-Ray Cover (14 mm)"), 148.0, 266.0, SC_MM, catOther);
-	addPageSize(prefix + "Blu-Ray Cover (24 mm)", QObject::tr("Blu-Ray Cover (24 mm)"), 148.0, 276.0, SC_MM, catOther);
-	addPageSize(prefix + "Cassette Cover (J-Card)", QObject::tr("Cassette Cover (J-Card)"), 101.5, 105.0, SC_MM, catOther);
-	addPageSize(prefix + "Cassette Cover (U-Card)", QObject::tr("Cassette Cover (U-Card)"), 101.5, 140.9, SC_MM, catOther);
-	addPageSize(prefix + "Compact Disc (Front)", QObject::tr("Compact Disc (Front)"), 120.0, 120.0, SC_MM, catOther); // from 1.6.2
-	addPageSize(prefix + "Compact Disc (Back)", QObject::tr("Compact Disc (Back)"), 118.0, 151.0, SC_MM, catOther);
-	addPageSize(prefix + "Compact Disc (Front Double)", QObject::tr("Compact Disc (Front Double)"), 120.0, 240.0, SC_MM, catOther);
-	addPageSize(prefix + "Vinyl LP", QObject::tr("Vinyl LP"), 314.3, 314.3, SC_MM, catOther);
-	addPageSize(prefix + "DVD Cover Normal", QObject::tr("DVD Cover Normal"), 183.0, 273.0, SC_MM, catOther);
-	addPageSize(prefix + "DVD Cover Slim", QObject::tr("DVD Cover Slim"), 183.0, 266.0, SC_MM, catOther);
-}
-
-void PageSize::printSizeList() const
-{
-	for (auto it = m_pageSizeList.begin(); it != m_pageSizeList.end(); ++it)
-	{
-		std::cout << it.key().leftJustified(6).toStdString() << ": ";
-		std::cout << it.value().width << " x " << it.value().height << ",  ";
-		std::cout << it.value().width * unitGetRatioFromIndex(it.value().pageUnitIndex) << " x " << it.value().height * unitGetRatioFromIndex(it.value().pageUnitIndex) << ",  ";
-		std::cout << it.value().trSizeName.toStdString() << categoryToString(it.value().category).toStdString() << std::endl;
-	}
-}
-
diff --git a/scribus/pagesize.h b/scribus/pagesize.h
index 1507212f2..91963da8e 100644
--- a/scribus/pagesize.h
+++ b/scribus/pagesize.h
@@ -27,51 +27,7 @@ for which a new license (GPL+exception) is in place.
 #include <QSize>
 #include "scribusapi.h"
 #include "units.h"
-
-struct PageSizeInfo
-{
-	enum Category {
-
-		Custom = 0, // don't use for presets, it is reserved for custom sizes
-		Preferred = 1, // don't use for presets, it is reserved for user favorite sizes
-
-		IsoA = 10,
-		IsoB = 11,
-		IsoC = 12,
-		IsoEnvelope = 13,
-
-		USStandard = 20,
-		USPress = 21,
-		USEnvelope = 22,
-
-		Book = 30,
-		BusinessCards = 31,
-		Newspaper = 32,
-		Transitional = 33,
-
-		Other = 40,
-
-		Canadian = 50,
-		Chinese = 51,
-		Colombian = 52,
-		French = 53,
-		German = 54,
-		Imperial = 55,
-		Japanese = 56,
-		Swedish = 57,
-	};
-
-	double width;
-	double height;
-	QString trSizeName;
-	QString sizeName;
-	QString sizeLabel;
-	int pageUnitIndex;
-	Category category;
-};
-
-using PageSizeInfoMap = QMap<QString, PageSizeInfo>;
-using PageSizeCategoriesMap = QMap<PageSizeInfo::Category, QString>;
+#include "manager/pagepreset_manager.h"
 
 class SCRIBUS_API PageSize
 {
@@ -80,36 +36,17 @@ 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; };
-	QString categoryToString(PageSizeInfo::Category category) const;
-	double width() const { return m_width; }
-	double height() const { return m_height; }
-	double originalWidth() const { return m_width * unitGetRatioFromIndex(m_pageUnitIndex); }
-	double originalHeight() const { return m_height * unitGetRatioFromIndex(m_pageUnitIndex); }
-	QString originalUnit() const { return unitGetSuffixFromIndex(m_pageUnitIndex); }
-	static QStringList defaultSizesList();
-	PageSizeCategoriesMap categories() const;
-	PageSizeInfoMap sizesByCategory(PageSizeInfo::Category category) const;
-	PageSizeInfoMap sizesByDimensions(QSize sizePt) const;
-	PageSizeInfoMap activePageSizes() const;
-	const PageSizeInfoMap& pageSizes() const { return m_pageSizeList; };
-	void printSizeList() const;
+	const QString& name() const { return m_pageInfo.id; }
+	const QString& nameTR() const { return m_pageInfo.displayName; }
+	QString categoryId() const { return m_pageInfo.categoryId; }
+	double width() const { return m_pageInfo.width; }
+	double height() const { return m_pageInfo.height; }
+	double originalWidth() const { return width() * unitGetRatioFromIndex(m_pageInfo.pageUnitIndex); }
+	double originalHeight() const { return height() * unitGetRatioFromIndex(m_pageInfo.pageUnitIndex); }
+	QString originalUnit() const { return unitGetSuffixFromIndex(m_pageInfo.pageUnitIndex); }
 
 private:
-	PageSizeInfoMap m_pageSizeList;
-	double m_width { 0.0 };
-	double m_height { 0.0 };
-	int m_pageUnitIndex { -1 };
-	QString m_pageSizeName;
-	QString m_trPageSizeName;
-	PageSizeInfo::Category m_category {PageSizeInfo::Custom};
-
-	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);
+	PageSizeInfo m_pageInfo;
 };
 
 #endif
diff --git a/scribus/plugins/fileloader/scribus171format/scribus171format.cpp b/scribus/plugins/fileloader/scribus171format/scribus171format.cpp
index 06336482a..d43975c09 100644
--- a/scribus/plugins/fileloader/scribus171format/scribus171format.cpp
+++ b/scribus/plugins/fileloader/scribus171format/scribus171format.cpp
@@ -2529,7 +2529,7 @@ void Scribus171Format::readDocAttributes(ScribusDoc* doc, const ScXmlStreamAttri
 	//Remove uppercase in 1.8
 	if (attrs.hasAttribute("PAGESIZE"))
 	{
-		m_Doc->setPageSize(attrs.valueAsString("PAGESIZE"));
+		// 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));
@@ -2569,6 +2569,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);
@@ -2595,7 +2598,7 @@ void Scribus171Format::readDocAttributes(ScribusDoc* doc, const ScXmlStreamAttri
 	}
 	else
 	{
-		m_Doc->setPageSize(attrs.valueAsString("PageSize"));
+		// m_Doc->setPageSize(attrs.valueAsString("PageSize"));
 		m_Doc->setPageOrientation(attrs.valueAsInt("PageOrientation", 0));
 		m_Doc->FirstPnum = attrs.valueAsInt("FirstPageNumber", 1);
 		m_Doc->setPagePositioning(attrs.valueAsInt("PagePositioning", 0));
@@ -4771,8 +4774,6 @@ bool Scribus171Format::readPage(ScribusDoc* doc, ScXmlStreamReader& reader)
 	else
 		mpName = attrs.valueAsString("MasterPageName", "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"));
 
@@ -4800,16 +4801,8 @@ bool Scribus171Format::readPage(ScribusDoc* doc, ScXmlStreamReader& reader)
 	else
 		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 ea195db72..70e4b8b86 100644
--- a/scribus/plugins/fileloader/scribus171format/scribus171format_save.cpp
+++ b/scribus/plugins/fileloader/scribus171format/scribus171format_save.cpp
@@ -333,7 +333,7 @@ bool Scribus171Format::saveFile(const QString & fileName, const FileFormat & /*
 	docu.writeAttribute("BleedRight", m_Doc->bleeds()->right());
 	docu.writeAttribute("BleedBottom", m_Doc->bleeds()->bottom());
 	docu.writeAttribute("PageOrientation", m_Doc->pageOrientation());
-	docu.writeAttribute("PageSize", m_Doc->pageSize());
+	// docu.writeAttribute("PageSize", m_Doc->pageSize());
 	docu.writeAttribute("FirstPageNumber", m_Doc->FirstPnum);
 	docu.writeAttribute("PagePositioning", m_Doc->pagePositioning());
 	if (m_Doc->usesAutomaticTextFrames())
@@ -1797,7 +1797,7 @@ void Scribus171Format::WritePages(ScribusDoc *doc, ScXmlStreamWriter& docu, QPro
 		docu.writeAttribute("PageNumber",page->pageNr());
 		docu.writeAttribute("PageName",page->pageName());
 		docu.writeAttribute("MasterPageName",page->masterPageName());
-		docu.writeAttribute("Size", page->size());
+		// docu.writeAttribute("Size", page->size());
 		docu.writeAttribute("Orientation", page->orientation());
 		docu.writeAttribute("LeftPage", page->LeftPg);
 		docu.writeAttribute("Preset", page->marginPreset);
diff --git a/scribus/plugins/import/ai/importai.cpp b/scribus/plugins/import/ai/importai.cpp
index db3ccbbdd..f6ba46a07 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);
@@ -377,7 +377,7 @@ bool AIPlug::importFile(const QString& fNameIn, const TransactionSettings& trSet
 	}
 	else 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 61825db5c..421e2d134 100644
--- a/scribus/plugins/import/cdr/importcdr.cpp
+++ b/scribus/plugins/import/cdr/importcdr.cpp
@@ -50,7 +50,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);
@@ -157,7 +157,7 @@ bool CdrPlug::importFile(const QString& fNameIn, const TransactionSettings& trSe
 	}
 	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 e83a5b608..e0b9c3b2a 100644
--- a/scribus/plugins/import/cgm/importcgm.cpp
+++ b/scribus/plugins/import/cgm/importcgm.cpp
@@ -96,7 +96,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);
@@ -201,7 +201,7 @@ bool CgmPlug::importFile(const QString& fNameIn, const TransactionSettings& trSe
 	}
 	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/cvg/importcvg.cpp b/scribus/plugins/import/cvg/importcvg.cpp
index 17a62c6e5..7d4b3885c 100644
--- a/scribus/plugins/import/cvg/importcvg.cpp
+++ b/scribus/plugins/import/cvg/importcvg.cpp
@@ -56,7 +56,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);
@@ -166,7 +166,7 @@ bool CvgPlug::importFile(const QString& fNameIn, const TransactionSettings& trSe
 	}
 	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/drw/importdrw.cpp b/scribus/plugins/import/drw/importdrw.cpp
index 77bd66025..bd49af05a 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);
@@ -177,7 +177,7 @@ bool DrwPlug::importFile(const QString& fNameIn, const TransactionSettings& trSe
 	}
 	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/emf/importemf.cpp b/scribus/plugins/import/emf/importemf.cpp
index 6a81906d5..0d1ee43ad 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::importFile(const QString& fNameIn, const TransactionSettings& trSe
 	}
 	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 dca6813e1..3c321905d 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::importFile(const QString& fNameIn, const TransactionSettings& trSet
 	}
 	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/idml/importidml.cpp b/scribus/plugins/import/idml/importidml.cpp
index 8b12d38c6..ff543e4db 100644
--- a/scribus/plugins/import/idml/importidml.cpp
+++ b/scribus/plugins/import/idml/importidml.cpp
@@ -152,7 +152,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);
@@ -239,7 +239,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);
@@ -336,7 +336,7 @@ bool IdmlPlug::importFile(const QString& fNameIn, const TransactionSettings& trS
 	}
 	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/odg/importodg.cpp b/scribus/plugins/import/odg/importodg.cpp
index e2c79975a..cd89a9878 100644
--- a/scribus/plugins/import/odg/importodg.cpp
+++ b/scribus/plugins/import/odg/importodg.cpp
@@ -172,7 +172,7 @@ bool OdgPlug::importFile(const QString& fNameIn, const TransactionSettings& trSe
 	}
 	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/oodraw/oodrawimp.cpp b/scribus/plugins/import/oodraw/oodrawimp.cpp
index 6fa2721d9..f939d4589 100644
--- a/scribus/plugins/import/oodraw/oodrawimp.cpp
+++ b/scribus/plugins/import/oodraw/oodrawimp.cpp
@@ -292,7 +292,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);
@@ -441,7 +441,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 899cb6e8f..4aea6e486 100644
--- a/scribus/plugins/import/pages/importpages.cpp
+++ b/scribus/plugins/import/pages/importpages.cpp
@@ -239,7 +239,7 @@ bool PagesPlug::importFile(const QString& fNameIn, const TransactionSettings& tr
 	{
 		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 5a073ce31..7810657f2 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::importFile(const QString& fNameIn, const TransactionSettings& trSe
 	{
 		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 4d8aad820..2da1c319c 100644
--- a/scribus/plugins/import/pdf/importpdf.cpp
+++ b/scribus/plugins/import/pdf/importpdf.cpp
@@ -164,7 +164,7 @@ bool PdfPlug::importFile(const QString& fNameIn, const TransactionSettings& trSe
 	{
 		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 f78c8000f..4a35af547 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::importFile(const QString& fNameIn, const TransactionSettings& trSet
 	{
 		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 257999efe..1a135c1c1 100644
--- a/scribus/plugins/import/pub/importpub.cpp
+++ b/scribus/plugins/import/pub/importpub.cpp
@@ -58,7 +58,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);
@@ -165,7 +165,7 @@ bool PubPlug::importFile(const QString& fNameIn, const TransactionSettings& trSe
 	{
 		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 c11a75d32..ad4c9e8bf 100644
--- a/scribus/plugins/import/qxp/importqxp.cpp
+++ b/scribus/plugins/import/qxp/importqxp.cpp
@@ -75,7 +75,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);
@@ -185,7 +185,7 @@ bool QxpPlug::importFile(const QString& fNameIn, const TransactionSettings& trSe
 	{
 		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 42e68e67f..ddfe710b8 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::importFile(const QString& fNameIn, const TransactionSettings& tr
 	{
 		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 150c370b2..983e1a789 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::importFile(const QString& fNameIn, const TransactionSettings& trSe
 	{
 		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 b0a1c8fd0..33d77dd42 100644
--- a/scribus/plugins/import/svg/svgplugin.cpp
+++ b/scribus/plugins/import/svg/svgplugin.cpp
@@ -243,7 +243,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);
@@ -425,7 +425,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 eaae61083..f1d98348e 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::importFile(const QString& fNameIn, const TransactionSettings& trSe
 	{
 		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 5dc9d9a9f..fe2f30a68 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::importFile(const QString& fNameIn, const TransactionSettings& trS
 	{
 		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 5a70df6c7..b427bc058 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::importFile(const QString& fNameIn, const TransactionSettings& trSe
 	{
 		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 62e8e3eab..84402e9db 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 8d53d1a6e..5bb54df73 100644
--- a/scribus/plugins/import/wpg/importwpg.cpp
+++ b/scribus/plugins/import/wpg/importwpg.cpp
@@ -419,7 +419,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);
@@ -526,7 +526,7 @@ bool WpgPlug::importFile(const QString& fNameIn, const TransactionSettings& trSe
 	{
 		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 3621757bb..54ce1cf27 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::importFile(const QString& fNameIn, const TransactionSettings& trSe
 	{
 		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 2ca483bbb..447d37c77 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::importFile(const QString& fNameIn, const TransactionSettings& trS
 	{
 		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/xps/importxps.cpp b/scribus/plugins/import/xps/importxps.cpp
index a35da14d9..ee6fa75df 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::importFile(const QString& fNameIn, const TransactionSettings& trSe
 	{
 		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 483682ed9..b3d7e0349 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::importFile(const QString& fNameIn, const TransactionSettings& trSe
 	{
 		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 00b63cd7e..e893d9eb1 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 bb5532833..39db15963 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 f078f9572..a538ca85b 100644
--- a/scribus/prefsmanager.cpp
+++ b/scribus/prefsmanager.cpp
@@ -42,6 +42,7 @@ for which a new license (GPL+exception) is in place.
 #include "latexhelpers.h"
 #include "langmgr.h"
 #include "localemgr.h"
+#include "manager/pagepreset_manager.h"
 #include "pagesize.h"
 #include "pagestructs.h"
 #include "pdfoptions.h"
@@ -325,9 +326,9 @@ void PrefsManager::initDefaults()
 		appPrefs.docSetupPrefs.language = "en_GB";
 	appPrefs.docSetupPrefs.pageSize = LocaleManager::instance().pageSizeForLocale(ScQApp->currGUILanguage());
 	appPrefs.docSetupPrefs.pageOrientation = 0;
-	PageSize defaultPageSize(appPrefs.docSetupPrefs.pageSize);
-	appPrefs.docSetupPrefs.pageWidth = defaultPageSize.width();
-	appPrefs.docSetupPrefs.pageHeight = defaultPageSize.height();
+	PageSizeInfo psi = PagePresetManager::instance().pageInfoByName(appPrefs.docSetupPrefs.pageSize);
+	appPrefs.docSetupPrefs.pageWidth = psi.width;
+	appPrefs.docSetupPrefs.pageHeight = psi.height;
 	appPrefs.docSetupPrefs.margins.set(40, 40, 40, 40);
 	appPrefs.docSetupPrefs.marginPreset = 0;
 	appPrefs.docSetupPrefs.bleeds.set(0, 0, 0, 0);
@@ -533,7 +534,7 @@ void PrefsManager::initDefaults()
 	appPrefs.imageCachePrefs.maxCacheEntries = 1000;
 	appPrefs.imageCachePrefs.compressionLevel = 1;
 	appPrefs.activePageSizes.clear();
-	appPrefs.activePageSizes = PageSize::defaultSizesList();
+	appPrefs.activePageSizes = PagePresetManager::defaultSizesList();
 
 	//Attribute setup
 	appPrefs.itemAttrPrefs.defaultItemAttributes.clear();
@@ -1378,8 +1379,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()));
@@ -2070,11 +2071,11 @@ bool PrefsManager::readPref(const QString& filePath)
 			if (appPrefs.docSetupPrefs.language.isEmpty())
 				appPrefs.docSetupPrefs.language = "en_GB";
 			appPrefs.docSetupPrefs.docUnitIndex = dc.attribute("UnitIndex", "0").toInt();
-			PageSize ps( dc.attribute("PageSize", PageSize::defaultSizesList().at(1)) );
-			appPrefs.docSetupPrefs.pageSize = (ps.name() == CommonStrings::customPageSize ) ? PageSize::defaultSizesList().at(1) : ps.name();
+			PageSizeInfo psi = PagePresetManager::instance().pageInfoByName(dc.attribute("PageSize", PagePresetManager::defaultSizesList().at(1)));
+			appPrefs.docSetupPrefs.pageSize = (psi.id.isEmpty() || psi.id == CommonStrings::customPageSize ) ? PagePresetManager::defaultSizesList().at(1) : psi.id;
 			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));
@@ -2797,12 +2798,12 @@ bool PrefsManager::readPref(const QString& filePath)
 			// check if page sizes existing
 			for (const auto& item : appPrefs.activePageSizes)
 			{
-				PageSize ps(item);
-				if (ps.name() != CommonStrings::customPageSize)
-					checkedPageSizes.append(ps.name());
+				PageSizeInfo psi = PagePresetManager::instance().pageInfoByName(item);
+				if (!psi.id.isEmpty() || psi.id != CommonStrings::customPageSize)
+					checkedPageSizes.append(psi.id);
 			}
 
-			appPrefs.activePageSizes = (checkedPageSizes.count() == 0) ? PageSize::defaultSizesList() : checkedPageSizes;
+			appPrefs.activePageSizes = (checkedPageSizes.count() == 0) ? PagePresetManager::defaultSizesList() : checkedPageSizes;
 
 		}
 		// experimental features
diff --git a/scribus/sampleitem.cpp b/scribus/sampleitem.cpp
index 691994b08..807b34f88 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/scpaths.cpp b/scribus/scpaths.cpp
index 4addf4af1..ac9fe8f5a 100644
--- a/scribus/scpaths.cpp
+++ b/scribus/scpaths.cpp
@@ -80,6 +80,7 @@ ScPaths::ScPaths()
 	m_docDir = appPath + "/../" + QString(DOCDIR);
 	m_iconDir = appPath + "/../" + QString(ICONDIR);
 	m_libDir = appPath + "/../" + QString(LIBDIR);
+	m_pagePresetsDir = appPath + "/../" + QString(PAGEPRESETSDIR);
 	m_pluginDir = appPath + "/../" + QString(PLUGINDIR);
 	m_qmlDir = appPath + "/../" + QString(QMLDIR);
 	m_sampleScriptDir = appPath + "/../" + QString(SAMPLESDIR);
@@ -90,6 +91,7 @@ ScPaths::ScPaths()
 	m_docDir = QString(DOCDIR);
 	m_iconDir = QString(ICONDIR);
 	m_libDir = QString(LIBDIR);
+	m_pagePresetsDir = QString(PAGEPRESETSDIR);
 	m_pluginDir = QString(PLUGINDIR);
 	m_qmlDir = QString(QMLDIR);
 	m_sampleScriptDir = QString(SAMPLESDIR);
@@ -111,6 +113,7 @@ ScPaths::ScPaths()
 	m_scriptDir = QString("%1/Contents/share/scribus/scripts/").arg(pathPtr);
 	m_templateDir = QString("%1/Contents/share/scribus/templates/").arg(pathPtr);
 	m_libDir = QString("%1/Contents/lib/").arg(pathPtr);
+	m_pagePresetsDir = QString("%1/Contents/share/scribus/pagepresets/").arg(pathPtr);
 	m_pluginDir = QString("%1/Contents/lib/").arg(pathPtr);
 	m_qmlDir = QString("%1/Contents/share/scribus/qml/").arg(pathPtr);
 	//QApplication::setLibraryPaths(QStringList(QString("%1/Contents/lib/qtplugins/").arg(pathPtr)));
@@ -123,6 +126,7 @@ ScPaths::ScPaths()
 	qDebug() << QString("scpaths: script dir=%1").arg(m_scriptDir);
 	qDebug() << QString("scpaths: template dir=%1").arg(m_templateDir);
 	qDebug() << QString("scpaths: lib dir=%1").arg(m_libDir);
+	qDebug() << QString("scpaths: pagepresets dir=%1").arg(m_pagePresetsDir);
 	qDebug() << QString("scpaths: plugin dir=%1").arg(m_pluginDir);
 	qDebug() << QString("scpaths: QML dir=%1").arg(m_qmlDir);
 	qDebug() << QString("scpaths: qtplugins=%1").arg(QApplication::libraryPaths().join(":"));
@@ -142,6 +146,7 @@ ScPaths::ScPaths()
 	m_scriptDir = QString("%1/share/scripts/").arg(appPath);
 	m_templateDir = QString("%1/share/templates/").arg(appPath);
 	m_libDir = QString("%1/libs/").arg(appPath);
+	m_pagePresetsDir = QString("%1/share/pagepresets/").arg(appPath);
 	m_pluginDir = QString("%1/plugins/").arg(appPath);
 	m_qmlDir = QString("%1/share/qml/").arg(appPath);
 
@@ -249,6 +254,11 @@ const QString&  ScPaths::libDir() const
 	return m_libDir;
 }
 
+const QString& ScPaths::pagePresetsDir() const
+{
+	return m_pagePresetsDir;
+}
+
 const QString&  ScPaths::pluginDir() const
 {
 	return m_pluginDir;
@@ -618,6 +628,14 @@ QString ScPaths::userHelpFilesDir(bool createIfNotExists)
 	return useFilesDirectory.absolutePath() + "/";
 }
 
+QString ScPaths::userPagePresetsDir(bool createIfNotExists)
+{
+	QDir useFilesDirectory(applicationDataDir() + "pagepresets/");
+	if (createIfNotExists && !useFilesDirectory.exists())
+		useFilesDirectory.mkpath(useFilesDirectory.absolutePath());
+	return useFilesDirectory.absolutePath() + "/";
+}
+
 QString ScPaths::userPaletteFilesDir(bool createIfNotExists)
 {
 	QDir useFilesDirectory(applicationDataDir() + "palettes/");
diff --git a/scribus/scpaths.h b/scribus/scpaths.h
index e4f1f918b..053ea7049 100644
--- a/scribus/scpaths.h
+++ b/scribus/scpaths.h
@@ -39,6 +39,8 @@ public:
 	const QString& fontDir() const;
 	/** @brief Return path to lib directory containing translations, keysets, etc. */
 	const QString& libDir() const;
+	/** @brief Return path to page preset directory containing page presets */
+	const QString& pagePresetsDir() const;
 	/** @brief Return path to dir containing plugins. */
 	const QString& pluginDir() const;
 	/** @brief Return path to dir containing sample Python scripts */
@@ -81,6 +83,8 @@ public:
 	static QString userFontDir(bool createIfNotExists);
 	/** @brief Return path to application data dir for downloaded docs*/
 	static QString userHelpFilesDir(bool createIfNotExists);
+	/** @brief Return path to page preset dir for custom page presets */
+	static QString userPagePresetsDir(bool createIfNotExists);
 	/** @brief Return path to application data dir for downloaded palettes */
 	static QString userPaletteFilesDir(bool createIfNotExists);
 	/** @brief Return path to user template dir */
@@ -121,6 +125,7 @@ protected:
 	QString m_fontDir;
 	QString m_iconDir;
 	QString m_libDir;
+	QString m_pagePresetsDir;
 	QString m_pluginDir;
 	QString m_qmlDir;
 	QString m_sampleScriptDir;
diff --git a/scribus/scpreview.cpp b/scribus/scpreview.cpp
index aaae57281..af035a77c 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 2e54c8ed6..a00ca7747 100644
--- a/scribus/scribus.cpp
+++ b/scribus/scribus.cpp
@@ -113,6 +113,7 @@ for which a new license (GPL+exception) is in place.
 #include "langmgr.h"
 #include "localemgr.h"
 #include "loadsaveplugin.h"
+#include "manager/pagepreset_manager.h"
 #include "marks.h"
 #include "nfttemplate.h"
 #include "notesstyles.h"
@@ -121,7 +122,6 @@ for which a new license (GPL+exception) is in place.
 #include "pageitem_latexframe.h"
 #include "pageitem_table.h"
 #include "pageitem_textframe.h"
-#include "pagesize.h"
 #include "pdflib.h"
 #include "pdfoptions.h"
 #include "pluginmanager.h"
@@ -339,7 +339,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);
@@ -414,6 +414,11 @@ int ScribusMainWindow::initScMW(bool primaryMainWindow)
 	if (primaryMainWindow)
 		ScCore->setSplashStatus( tr("Reading Scrapbook") );
 	initScrapbook();
+
+	if (primaryMainWindow)
+		ScCore->setSplashStatus( tr("Initializing Page Presets") );
+	PagePresetManager::instance();
+
 	scrActions["helpTooltips"]->setChecked(m_prefsManager.appPrefs.displayPrefs.showToolTips);
 	scrActions["showMouseCoordinates"]->setChecked(m_prefsManager.appPrefs.displayPrefs.showMouseCoordinates);
 	scrActions["stickyTools"]->setChecked(m_prefsManager.appPrefs.uiPrefs.stickyTools);
@@ -2027,10 +2032,10 @@ void ScribusMainWindow::startUpDialog()
 			int facingPages = dia->choosenLayout();
 			int firstPage = dia->layoutFirstPage();
 			docSet = dia->startDocSetup->isChecked();
-			double topMargin = dia->marginGroup->margins().top();
-			double bottomMargin = dia->marginGroup->margins().bottom();
-			double leftMargin = dia->marginGroup->margins().left();
-			double rightMargin = dia->marginGroup->margins().right();
+			double topMargin = dia->margins().top();
+			double bottomMargin = dia->margins().bottom();
+			double leftMargin = dia->margins().left();
+			double rightMargin = dia->margins().right();
 			double columnDistance = dia->distance();
 			double pageWidth = dia->pageWidth();
 			double pageHeight = dia->pageHeight();
@@ -2038,10 +2043,10 @@ 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());
+			doc->bleeds()->set(dia->bleeds().top(), dia->bleeds().left(), dia->bleeds().bottom(), dia->bleeds().right());
 			HaveNewDoc();
 			doc->reformPages(true);
 			// Don's disturb user with "save?" dialog just after new doc
@@ -2103,10 +2108,10 @@ bool ScribusMainWindow::slotFileNew()
 	int facingPages = dia->choosenLayout();
 	int firstPage = dia->layoutFirstPage();
 	bool docSet = dia->startDocSetup->isChecked();
-	double topMargin = dia->marginGroup->margins().top();
-	double bottomMargin = dia->marginGroup->margins().bottom();
-	double leftMargin = dia->marginGroup->margins().left();
-	double rightMargin = dia->marginGroup->margins().right();
+	double topMargin = dia->margins().top();
+	double bottomMargin = dia->margins().bottom();
+	double leftMargin = dia->margins().left();
+	double rightMargin = dia->margins().right();
 	double columnDistance = dia->distance();
 	double pageWidth = dia->pageWidth();
 	double pageHeight = dia->pageHeight();
@@ -2114,12 +2119,12 @@ 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()))
 	{
 		doc->setPageSetFirstPage(facingPages, firstPage);
-		doc->bleeds()->set(dia->bleedTop(), dia->bleedLeft(), dia->bleedBottom(), dia->bleedRight());
+		doc->bleeds()->set(dia->bleeds().top(), dia->bleeds().left(), dia->bleeds().bottom(), dia->bleeds().right());
 		m_mainWindowStatusLabel->setText( tr("Ready"));
 		HaveNewDoc();
 		doc->reformPages(true);
@@ -2136,12 +2141,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();
@@ -8651,7 +8656,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);
@@ -8689,7 +8694,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);
@@ -9203,7 +9208,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 89ea48590..0e998d0fa 100644
--- a/scribus/scribus.h
+++ b/scribus/scribus.h
@@ -154,8 +154,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 dc19e7d93..6b175e24b 100644
--- a/scribus/scribusdoc.cpp
+++ b/scribus/scribusdoc.cpp
@@ -56,6 +56,7 @@ for which a new license (GPL+exception) is in place.
 #include "filewatcher.h"
 #include "fpoint.h"
 #include "hyphenator.h"
+#include "manager/pagepreset_manager.h"
 #include "notesstyles.h"
 #include "numeration.h"
 #include "pageitem.h"
@@ -233,7 +234,7 @@ ScribusDoc::ScribusDoc() : UndoObject( tr("Document")), Observable<ScribusDoc>(n
 }
 
 
-ScribusDoc::ScribusDoc(const QString& docName, int unitindex, const PageSize& pagesize, const MarginStruct& margins, const DocPagesSetup& pagesSetup) : UndoObject( tr("Document")),
+ScribusDoc::ScribusDoc(const QString& docName, int unitindex, const PageSizeInfo& pagesize, const MarginStruct& margins, const DocPagesSetup& pagesSetup) : UndoObject( tr("Document")),
 	m_appPrefsData(PrefsManager::instance().appPrefs),
 	m_docPrefsData(PrefsManager::instance().appPrefs),
 	m_undoManager(UndoManager::instance()),
@@ -253,9 +254,9 @@ ScribusDoc::ScribusDoc(const QString& docName, int unitindex, const PageSize& pa
 	m_alignTransaction(nullptr)
 {
 	m_docPrefsData.docSetupPrefs.docUnitIndex = unitindex;
-	m_docPrefsData.docSetupPrefs.pageHeight = pagesize.height();
-	m_docPrefsData.docSetupPrefs.pageWidth = pagesize.width();
-	m_docPrefsData.docSetupPrefs.pageSize = pagesize.name();
+	m_docPrefsData.docSetupPrefs.pageHeight = pagesize.height;
+	m_docPrefsData.docSetupPrefs.pageWidth = pagesize.width;
+	m_docPrefsData.docSetupPrefs.pageSize = pagesize.id;
 	m_docPrefsData.docSetupPrefs.margins = margins;
 	maxCanvasCoordinate = FPoint(m_docPrefsData.displayPrefs.scratch.left() + m_docPrefsData.displayPrefs.scratch.right(), m_docPrefsData.displayPrefs.scratch.top() + m_docPrefsData.displayPrefs.scratch.bottom());
 	setPageSetFirstPage(pagesSetup.pageArrangement, pagesSetup.firstPageLocation);
@@ -680,12 +681,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;
+	PageSizeInfo psi = PagePresetManager::instance().pageInfoByDimensions(pageSize.width(), pageSize.height());
+	m_docPrefsData.docSetupPrefs.pageSize = psi.id;
 	FirstPnum = firstPageNumber;
 	m_docPrefsData.docSetupPrefs.pagePositioning = fp;
 	setDocumentFileName(documentName);
diff --git a/scribus/scribusdoc.h b/scribus/scribusdoc.h
index 917d9459d..d66adb526 100644
--- a/scribus/scribusdoc.h
+++ b/scribus/scribusdoc.h
@@ -80,7 +80,7 @@ class Selection;
 class ScribusView;
 class ScribusMainWindow;
 class ResourceCollection;
-class PageSize;
+struct PageSizeInfo;
 class ScPattern;
 class Serializer;
 class QProgressBar;
@@ -98,7 +98,7 @@ class SCRIBUS_API ScribusDoc : public QObject, public UndoObject, public Observa
 
 public:
 	ScribusDoc();
-	ScribusDoc(const QString& docName, int unitIndex, const PageSize& pagesize, const MarginStruct& margins, const DocPagesSetup& pagesSetup);
+	ScribusDoc(const QString& docName, int unitIndex, const PageSizeInfo& pagesize, const MarginStruct& margins, const DocPagesSetup& pagesSetup);
 	~ScribusDoc();
 
 	void init();
@@ -107,7 +107,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);
@@ -222,10 +222,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 632c403d1..c43bf057e 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/delegates/sclistitemdelegate.cpp b/scribus/ui/delegates/sclistitemdelegate.cpp
index 83efe7fdd..015057bab 100644
--- a/scribus/ui/delegates/sclistitemdelegate.cpp
+++ b/scribus/ui/delegates/sclistitemdelegate.cpp
@@ -6,6 +6,9 @@
 #include <QFlags>
 #include <QFontMetrics>
 #include <QTextLayout>
+#include "iconmanager.h"
+#include "manager/pagepreset_manager.h"
+#include "ui/widgets/pagesizelist.h"
 
 
 ScListItemDelegate::ScListItemDelegate(QListView::ViewMode mode, QSize iconSize, TextPosition textPosition, Style style, QObject *parent) : QItemDelegate (parent)
@@ -84,7 +87,8 @@ void ScListItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &op
 	// Item Data
 	QIcon ic = qvariant_cast<QIcon>(index.data(Qt::DecorationRole));
 	QString title = index.data(Qt::DisplayRole).toString();
-	QString subTitle = index.data(Qt::UserRole).toString();
+	QString subTitle = index.data(PageSizeList::ItemData::SizeLabel).toString();
+	PageSizeType type = qvariant_cast<PageSizeType>(index.data(PageSizeList::ItemData::Type));
 
 	switch (m_textPosition)
 	{
@@ -144,7 +148,8 @@ void ScListItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &op
 		QTextLayout textLayout(title, painter->font());
 		textLayout.beginLayout();
 
-		while (++lineCount < rText.height() / fm.lineSpacing()) {
+		while (++lineCount < rText.height() / fm.lineSpacing())
+		{
 			QTextLine line = textLayout.createLine();
 			if (!line.isValid())
 				break;
@@ -162,6 +167,15 @@ void ScListItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &op
 
 	}
 
+	// User Marker
+	if (type == PageSizeType::User)
+	{
+		QRect rMarker(0, 0, 16, 16);
+		rMarker.moveTop(rSaveArea.top() + 4);
+		rMarker.moveRight(rSaveArea.right() - 4);
+		painter->drawPixmap(rMarker, IconManager::instance().loadPixmap("user-page-preset"));
+	}
+
 	painter->restore();
 }
 
diff --git a/scribus/ui/inspage.cpp b/scribus/ui/inspage.cpp
index cd9d65210..d487ca903 100644
--- a/scribus/ui/inspage.cpp
+++ b/scribus/ui/inspage.cpp
@@ -17,7 +17,7 @@ for which a new license (GPL+exception) is in place.
 
 #include "commonstrings.h"
 #include "iconmanager.h"
-#include "pagesize.h"
+#include "manager/pagepreset_manager.h"
 #include "scpage.h"
 #include "scribusdoc.h"
 #include "scrspinbox.h"
@@ -225,17 +225,8 @@ InsPage::InsPage( QWidget* parent, ScribusDoc* currentDoc, int currentPage, int
 		}
 	}
 
-	QScopedPointer<PageSize> ps(new PageSize(m_doc->pageSize()));
-
-	// try to find corresponding page size by dimensions
-	if (ps->name() == CommonStrings::customPageSize)
-	{
-		PageSizeInfoMap pages = ps->sizesByDimensions(QSize(m_doc->pageWidth(), m_doc->pageHeight()));
-		if (pages.count() > 0)
-			prefsPageSizeName = pages.firstKey();
-	}
-	else
-		prefsPageSizeName = ps->name();
+	PageSizeInfo psi = PagePresetManager::instance().pageInfoByDimensions(QSize(m_doc->pageWidth(), m_doc->pageHeight()));
+	prefsPageSizeName = psi.id;
 
 	dialogLayout->addWidget(masterPageGroup);
 	overrideMPSizingCheckBox = new QCheckBox( tr("Override Master Page Sizing"));
@@ -248,7 +239,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);
@@ -282,7 +273,7 @@ InsPage::InsPage( QWidget* parent, ScribusDoc* currentDoc, int currentPage, int
 	dialogLayout->addWidget(dsGroupBox7);
 
 	dsGroupBox7->setEnabled(false);
-	bool b = (pageSizeSelector->pageSizeTR() == CommonStrings::trCustomPageSize);
+	bool b = (pageSizeSelector->pageSize() == CommonStrings::customPageSize);
 	heightSpinBox->setEnabled(b);
 	widthSpinBox->setEnabled(b);
 
@@ -302,20 +293,19 @@ InsPage::InsPage( QWidget* parent, ScribusDoc* currentDoc, int currentPage, int
 
 void InsPage::setSize(const QString & gr)
 {
-	PageSize ps2(gr);
-	prefsPageSizeName = ps2.name();
-	if (gr == CommonStrings::trCustomPageSize)
+	PageSizeInfo psi = PagePresetManager::instance().pageInfoByName(gr);
+	prefsPageSizeName = psi.id;
+	if (psi.id == CommonStrings::customPageSize)
 	{
 		widthSpinBox->setEnabled(true);
 		heightSpinBox->setEnabled(true);
-		prefsPageSizeName = CommonStrings::customPageSize;
 	}
 	else
 	{
 		widthSpinBox->setEnabled(false);
 		heightSpinBox->setEnabled(false);
-		double w = ps2.width() * m_unitRatio;
-		double h = ps2.height() * m_unitRatio;
+		double w = psi.width * m_unitRatio;
+		double h = psi.height * m_unitRatio;
 		if (orientationQComboBox->currentIndex() == 1)
 		{
 			double t = h;
diff --git a/scribus/ui/inspage.h b/scribus/ui/inspage.h
index 2a8e9d581..2999bbfec 100644
--- a/scribus/ui/inspage.h
+++ b/scribus/ui/inspage.h
@@ -73,7 +73,6 @@ private:
 	QLabel*     textLabel1 { nullptr };
 	QLabel*     textLabel2 { nullptr };
 	PageSizeSelector* pageSizeSelector { nullptr };
-//	QComboBox*  sizeQComboBox { nullptr };
 	QComboBox*  orientationQComboBox { nullptr };
 	QCheckBox*  moveObjectsCheckBox { nullptr };
 	QCheckBox*  overrideMPSizingCheckBox { nullptr };
diff --git a/scribus/ui/newdocdialog.cpp b/scribus/ui/newdocdialog.cpp
index 4a5c52eb9..55659912b 100644
--- a/scribus/ui/newdocdialog.cpp
+++ b/scribus/ui/newdocdialog.cpp
@@ -38,10 +38,11 @@ for which a new license (GPL+exception) is in place.
 #include "fileloader.h"
 #include "iconmanager.h"
 #include "newmarginwidget.h"
-#include "pagesize.h"
 #include "pagestructs.h"
 #include "prefsfile.h"
 #include "prefsmanager.h"
+#include "scmessagebox.h"
+#include "scpaths.h"
 #include "scrspinbox.h"
 #include "units.h"
 #include "ui/widgets/pagesizelist.h"
@@ -69,9 +70,12 @@ NewDocDialog::NewDocDialog(QWidget* parent, const QStringList& recentDocs, bool
 	buttonSinglePage->setIcon(iconManager.loadIcon("page-simple"));
 	buttonDoublePageLeft->setIcon(iconManager.loadIcon("page-first-left"));
 	buttonDoublePageRight->setIcon(iconManager.loadIcon("page-first-right"));
+	buttonSavePagePreset->setIcon(iconManager.loadIcon("save"));
 	labelColumns->setPixmap(iconManager.loadPixmap("paragraph-columns"));
+	labelName->setPixmap(iconManager.loadPixmap("name"));
 
 	createNewDocPage();
+
 	if (startUp)
 	{
 		nftGui->setupSettings(lang);
@@ -87,7 +91,6 @@ NewDocDialog::NewDocDialog(QWidget* parent, const QStringList& recentDocs, bool
 		tabWidget->removeTab(1);
 	}
 
-
 	tabWidget->setCurrentIndex(0);
 	startUpDialog->setVisible(startUp);
 
@@ -112,15 +115,17 @@ NewDocDialog::NewDocDialog(QWidget* parent, const QStringList& recentDocs, bool
 
 	connect(pageOrientationButtons, &QButtonGroup::idClicked, this, &NewDocDialog::setOrientation);
 	connect(pageLayoutButtons, &QButtonGroup::idClicked, this, &NewDocDialog::setLayout);
-	connect(unitOfMeasureComboBox, SIGNAL(activated(int)), this, SLOT(setUnit(int)));
-	connect(Distance, SIGNAL(valueChanged(double)), this, SLOT(setDistance(double)));
-	connect(autoTextFrame, SIGNAL(clicked()), this, SLOT(handleAutoFrame()));
+	connect(unitOfMeasureComboBox, &QComboBox::activated, this, &NewDocDialog::setUnit);
+	connect(Distance, &ScrSpinBox::valueChanged, this, &NewDocDialog::setDistance);
+	connect(autoTextFrame, &QCheckBox::checkStateChanged, this, &NewDocDialog::handleAutoFrame);
 	connect(listPageFormats, &PageSizeList::clicked, this, &NewDocDialog::changePageSize);
+	connect(listPageFormats, &PageSizeList::changedCategories, this, &NewDocDialog::updateCategorySelector);
 	connect(pageSizeSelector, &PageSizeSelector::pageCategoryChanged, this, &NewDocDialog::changeCategory);
-	connect(marginGroup, &NewMarginWidget::marginChanged, this, &NewDocDialog::changeMargin);
-	connect(bleedGroup, &NewMarginWidget::marginChanged, this, &NewDocDialog::changeBleed);
+	connect(marginGroup, &NewMarginWidget::valuesChanged, this, &NewDocDialog::changeMargin);
 	connect(bleedGroup, &NewMarginWidget::valuesChanged, this, &NewDocDialog::changeBleed);
 	connect(comboSortSizes, &QComboBox::currentIndexChanged, this, &NewDocDialog::changeSortMode);
+	connect(buttonSavePagePreset, &QToolButton::clicked, this, &NewDocDialog::savePagePreset);
+
 	if (startUp)
 	{
 		connect(nftGui, SIGNAL(leaveOK()), this, SLOT(ExitOK()));
@@ -133,7 +138,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,12 +169,14 @@ void NewDocDialog::createNewDocPage()
 		pageLayoutButtons->button(2)->setChecked(true);
 	}
 
-	listPageFormats->setValues(pageSize, orientation, PageSizeInfo::Preferred, PageSizeList::NameAsc);
+	PageCollectionInfo pciPreferred = PagePresetManager::instance().categoryInfoPreferred();
+
+	listPageFormats->setValues(QSizeF(pageWidth, pageHeight), orientation, pciPreferred.id, PageSizeList::NameAsc);
 
 	pageSizeSelector->setHasFormatSelector(false);
 	pageSizeSelector->setHasCustom(false);
-	pageSizeSelector->setPageSize(pageSize);
-	pageSizeSelector->setCurrentCategory(PageSizeInfo::Preferred);
+	pageSizeSelector->setPageSize(pageWidth, pageHeight);
+	pageSizeSelector->setCurrentCategory(pciPreferred.id);
 
 	widthSpinBox->setMinimum(pts2value(1.0, m_unitIndex));
 	widthSpinBox->setMaximum(16777215);
@@ -194,17 +200,14 @@ void NewDocDialog::createNewDocPage()
 	marginGroup->setPageHeight(pageHeight);
 	marginGroup->setPageWidth(pageWidth);
 	marginGroup->setFacingPages(!(pagePositioning == singlePage));
-	marginGroup->setPageSize(pageSize);
 	marginGroup->setMarginPreset(prefsManager.appPrefs.docSetupPrefs.marginPreset);
 
-	MarginStruct bleed;
-	bleed.resetToZero();
+	MarginStruct bleed(prefsManager.appPrefs.docSetupPrefs.bleeds);
 	bleedGroup->setup(bleed, !(pagePositioning == singlePage), m_unitIndex, NewMarginWidget::BleedWidgetFlags);
 	bleedGroup->toggleLabelVisibility(false);
 	bleedGroup->setPageHeight(pageHeight);
 	bleedGroup->setPageWidth(pageWidth);
 	bleedGroup->setFacingPages(!(pagePositioning == singlePage));
-	bleedGroup->setPageSize(pageSize);
 	bleedGroup->setMarginPreset(prefsManager.appPrefs.docSetupPrefs.marginPreset);
 
 	pageCountSpinBox->setMaximum( 10000 );
@@ -214,7 +217,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 +344,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)
@@ -351,8 +354,6 @@ void NewDocDialog::setWidth(double)
 
 		QSignalBlocker sigOri(pageOrientationButtons);
 		pageOrientationButtons->button(newOrientation)->setChecked(true);
-		QSignalBlocker sigFormats(listPageFormats);
-		listPageFormats->setOrientation(m_orientation);
 	}
 
 }
@@ -363,8 +364,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)
@@ -373,22 +374,75 @@ void NewDocDialog::setHeight(double)
 
 		QSignalBlocker sigOri(pageOrientationButtons);
 		pageOrientationButtons->button(newOrientation)->setChecked(true);
-		QSignalBlocker sigFormats(listPageFormats);
-		listPageFormats->setOrientation(m_orientation);
 	}
 }
 
 void NewDocDialog::changePageSize(const QModelIndex &ic)
 {
 	int unit = ic.data(PageSizeList::Unit).toInt();
-	QString sizeName = ic.data(PageSizeList::Name).toString();
+	int layout = ic.data(PageSizeList::Layout).toInt();
+	int firstPage = ic.data(PageSizeList::FirstPage).toInt();
+	double width = ic.data(PageSizeList::Width).toDouble();
+	double height = ic.data(PageSizeList::Height).toDouble();
+	textPagePresetName->setText(ic.data(Qt::DisplayRole).toString());
+
+	// Margins
+	MarginStruct margins(prefsManager.appPrefs.docSetupPrefs.margins);
+	marginGroup->setPageWidth(width);
+	marginGroup->setPageHeight(height);
+	marginGroup->setMarginPreset(prefsManager.appPrefs.docSetupPrefs.marginPreset);
+	QVariant dataMargins = ic.data(PageSizeList::Margins);
+	if (dataMargins.canConvert<QList<double>>())
+	{
+		QList<double> m = dataMargins.value<QList<double>>();
+		if (!QVariant(m.at(0)).toBool())
+		{
+			margins.set(m.at(1), m.at(2), m.at(3), m.at(4));
+			marginGroup->setMarginPreset(ic.data(PageSizeList::MarginPreset).toInt());
+		}
+	}
+	marginGroup->setNewValues(margins);
 
-	setUnit(unit);
-	setPageSize(sizeName);
+	// Bleeds
+	MarginStruct bleeds(prefsManager.appPrefs.docSetupPrefs.bleeds);
+	QVariant dataBleeds = ic.data(PageSizeList::Bleeds);
+	if (dataBleeds.canConvert<QList<double>>())
+	{
+		QList<double> m = dataBleeds.value<QList<double>>();
+		if (!QVariant(m.at(0)).toBool())
+			bleeds.set(m.at(1), m.at(2), m.at(3), m.at(4));
+	}
+	bleedGroup->setNewValues(bleeds);
 
-	QSignalBlocker sig(unitOfMeasureComboBox);
-	unitOfMeasureComboBox->setCurrentIndex(unit);
+	// Text Frame
+	autoTextFrame->setChecked(false);
+	numberOfCols->setValue( 1 );
+	Distance->setValue(11 * m_unitRatio);
+	QVariant dataTextFrame = ic.data(PageSizeList::TextFrame);
+	if (dataTextFrame.canConvert<QList<double>>())
+	{
+		QList<double> tf = dataTextFrame.value<QList<double>>();
+		if (!tf.isEmpty())
+		{
+			autoTextFrame->setChecked(true);
+			numberOfCols->setValue(QVariant(tf.at(0)).toInt());
+			setDistance(QVariant(tf.at(1)).toDouble() * m_unitRatio);
+		}
+	}
+
+	setPageSize(QSizeF(width, height));
+	setUnit(unit);
 
+	// Layout + First Page
+	if (layout == 0)
+		setLayout(0);
+	else
+	{
+		if (firstPage == 0)
+			setLayout(1);
+		else
+			setLayout(2);
+	}
 }
 
 void NewDocDialog::changeSortMode(int ic)
@@ -397,6 +451,65 @@ void NewDocDialog::changeSortMode(int ic)
 	listPageFormats->setSortMode(static_cast<PageSizeList::SortMode>(comboSortSizes->currentData().toInt()));
 }
 
+void NewDocDialog::savePagePreset()
+{
+	if (textPagePresetName->text().isEmpty())
+	{
+		ScMessageBox::warning(this, tr("Empty Preset Name"), tr("The preset name must not be empty!\nEnter a preset name."), QMessageBox::Ok);
+		return;
+	}
+
+	const QString presetUserFolder = QDir::toNativeSeparators(ScPaths::userPagePresetsDir(true));
+
+	QString uuid;
+
+	// Collection
+	// If another user collection should be updated change the collection information here:
+	PageCollectionInfo pci;
+	pci.author = tr("User");
+	pci.license = tr("Copyright by user");
+	pci.name = tr("User");
+	pci.filePath = presetUserFolder % u"user.xml";
+
+	PagePresetManager::instance().createOrUpdateCollection(pci.filePath, pci, uuid);
+
+	// Page Preset
+	PageSizeInfo psi;
+	psi.pageUnitIndex = m_unitIndex;
+	psi.name = textPagePresetName->text();
+	psi.width = m_pageWidth;
+	psi.height = m_pageHeight;
+	psi.margins = marginGroup->margins();
+	psi.bleeds = bleedGroup->margins();
+	psi.layout = m_choosenLayout;
+	psi.firstPage = m_layoutFirstPage;
+	psi.marginPreset = marginGroup->marginPreset();
+
+	QList<double> textFrame;
+	if (autoTextFrame->isChecked())
+	{
+		textFrame.append(numberOfCols->value());
+		textFrame.append(m_distance);
+	}
+	psi.textFrame = textFrame;
+
+	PagePresetManager::instance().addCollectionPage(pci.filePath, psi);
+
+	// Refresh UI
+	PagePresetManager::instance().reloadAllPresets();
+	pageSizeSelector->setPageSize(m_pageWidth, m_pageHeight);
+	pageSizeSelector->setCurrentCategory(uuid);
+	updateCategory(uuid, true);
+}
+
+void NewDocDialog::updateCategorySelector()
+{
+	PageCollectionInfo pciPreferred = PagePresetManager::instance().categoryInfoPreferred();
+	pageSizeSelector->setPageSize(m_pageWidth, m_pageHeight);
+	pageSizeSelector->setCurrentCategory(pciPreferred.id);
+	updateCategory(pciPreferred.id, true);
+}
+
 bool NewDocDialog::eventFilter(QObject *object, QEvent *event)
 {
 	if (object->objectName() == "scrollAreaWidgetContents" && event->type() == QEvent::Resize)
@@ -417,13 +530,19 @@ void NewDocDialog::handleAutoFrame()
 	numberOfCols->setEnabled(setter);
 }
 
-void NewDocDialog::setDistance(double)
+void NewDocDialog::setDistance(double value)
 {
-	m_distance = Distance->value() / m_unitRatio;
+	QSignalBlocker sig(Distance);
+	Distance->setValue(value);
+
+	m_distance = value / m_unitRatio;
 }
 
 void NewDocDialog::setUnit(int newUnitIndex)
 {
+	QSignalBlocker sig(unitOfMeasureComboBox);
+	unitOfMeasureComboBox->setCurrentIndex(newUnitIndex);
+
 	disconnect(widthSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setWidth(double)));
 	disconnect(heightSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setHeight(double)));
 	widthSpinBox->setNewUnit(newUnitIndex);
@@ -496,24 +615,23 @@ void NewDocDialog::setOrientation(int ori)
 {
 	disconnect(widthSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setWidth(double)));
 	disconnect(heightSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setHeight(double)));
-	if (ori != m_orientation)
-	{
-		double w  = widthSpinBox->value(), h = heightSpinBox->value();
-		double pw = m_pageWidth, ph = m_pageHeight;
-		widthSpinBox->setValue((ori == portraitPage) ? qMin(w, h) : qMax(w, h));
-		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);
-	}
-	// #869 pv - defined constants added + code repeat (check w/h)
-	(ori == portraitPage) ? m_orientation = portraitPage : m_orientation = landscapePage;
-	// end of #869
+
+	bool isPortrait = ori == portraitPage;
+	double w = widthSpinBox->value(), h = heightSpinBox->value();
+	double pw = m_pageWidth, ph = m_pageHeight;
+	widthSpinBox->setValue(isPortrait ? qMin(w, h) : qMax(w, h));
+	heightSpinBox->setValue(isPortrait ? qMax(w, h) : qMin(w, h));
+
+	m_pageWidth = isPortrait ? qMin(pw, ph) : qMax(pw, ph);
+	m_pageHeight = isPortrait ? qMax(pw, ph) : qMin(pw, ph);
+
+	m_orientation = ori;
+
 	marginGroup->setPageHeight(m_pageHeight);
 	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)));
@@ -525,66 +643,53 @@ void NewDocDialog::setLayout(int layoutId)
 	{
 		case 0:
 			setDocLayout(0);
+			pageLayoutButtons->button(0)->setChecked(true); // single page
 		break;
 		case 1:
 			setDocLayout(1);
 			pagePreview->setFirstPage(0);
 			setDocFirstPage(0);
+			pageLayoutButtons->button(1)->setChecked(true); // double page + first page left
 		break;
 		case 2:
 			setDocLayout(1);
 			pagePreview->setFirstPage(1);
 			setDocFirstPage(1);
+			pageLayoutButtons->button(2)->setChecked(true); // double page + first page right
 		break;
 	}
 }
 
-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);
+	if (size.width() < size.height())
+		pageOrientationButtons->button(portraitPage)->setChecked(true);
+	else
+		pageOrientationButtons->button(landscapePage)->setChecked(true);
 
+	setSize(size);
 }
 
-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;
 
 	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)
-	{
-		widthSpinBox->setEnabled(true);
-		heightSpinBox->setEnabled(true);
-	}
-	else
-	{
-		PageSize ps2(m_pageSize);
-		if (pageOrientationButtons->checkedId() == portraitPage)
-		{
-			m_pageWidth = ps2.width();
-			m_pageHeight = ps2.height();
-		}
-		else
-		{
-			m_pageWidth = ps2.height();
-			m_pageHeight = ps2.width();
-		}
-	}
+
+	m_pageWidth = size.width();
+	m_pageHeight = size.height();
+
 	widthSpinBox->setValue(m_pageWidth * m_unitRatio);
 	heightSpinBox->setValue(m_pageHeight * m_unitRatio);
 	marginGroup->setPageHeight(m_pageHeight);
 	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 +702,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)
@@ -689,11 +794,13 @@ void NewDocDialog::changeBleed(MarginStruct bleed)
 	pagePreview->setBleeds(bleed);
 }
 
-void NewDocDialog::changeCategory(PageSizeInfo::Category category)
+void NewDocDialog::changeCategory(const QString &category)
 {
-	if (listPageFormats->category() == category)
-		return;
+	updateCategory(category);
+}
 
-	listPageFormats->setFormat(m_pageSize);
-	listPageFormats->setCategory(category);
+void NewDocDialog::updateCategory(const QString &category, bool forceUpdate)
+{
+	if (listPageFormats->category() != category || forceUpdate)
+		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 a65550f3d..bd2fb4adc 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};
 
@@ -80,10 +79,8 @@ public:
 	double pageWidth() const { return m_pageWidth;}
 	double pageHeight() const { return m_pageHeight;}
 	double distance() const { return m_distance;}
-	double bleedBottom() const { return m_bleedBottom;}
-	double bleedTop() const { return m_bleedTop;}
-	double bleedLeft() const { return m_bleedLeft;}
-	double bleedRight() const { return m_bleedRight;}
+	MarginStruct margins() const { return marginGroup->margins(); }
+	MarginStruct bleeds() const { return bleedGroup->margins(); }
 
 public slots:
 	void setHeight(double v);
@@ -94,7 +91,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
@@ -113,9 +110,11 @@ public slots:
 private slots:
 	void changeMargin(MarginStruct margin);
 	void changeBleed(MarginStruct bleed);
-	void changeCategory(PageSizeInfo::Category category);
+	void changeCategory(const QString& category);
 	void changePageSize(const QModelIndex &ic);
 	void changeSortMode(int ic);
+	void savePagePreset();
+	void updateCategorySelector();
 
 protected:
 	PrefsManager& prefsManager;
@@ -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 };
@@ -143,6 +141,7 @@ protected:
 	bool m_labelVisibity {true};
 
 	bool eventFilter(QObject *object, QEvent *event);
+	void updateCategory(const QString& category, bool forceUpdate = false);
 };
 
 #endif // NEWDOC_H
diff --git a/scribus/ui/newdocdialog.ui b/scribus/ui/newdocdialog.ui
index 53c60dcff..afdc50f53 100644
--- a/scribus/ui/newdocdialog.ui
+++ b/scribus/ui/newdocdialog.ui
@@ -123,8 +123,8 @@
            <rect>
             <x>0</x>
             <y>0</y>
-            <width>267</width>
-            <height>564</height>
+            <width>319</width>
+            <height>620</height>
            </rect>
           </property>
           <layout class="QVBoxLayout" name="verticalLayout_7">
@@ -201,6 +201,60 @@
                <property name="bottomMargin">
                 <number>8</number>
                </property>
+               <item>
+                <layout class="QHBoxLayout" name="horizontalLayout_10">
+                 <item>
+                  <widget class="FormWidget" name="labelName">
+                   <property name="sizePolicy">
+                    <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
+                     <horstretch>0</horstretch>
+                     <verstretch>0</verstretch>
+                    </sizepolicy>
+                   </property>
+                   <property name="label" stdset="0">
+                    <string/>
+                   </property>
+                   <layout class="QHBoxLayout" name="horizontalLayout_11">
+                    <property name="leftMargin">
+                     <number>0</number>
+                    </property>
+                    <property name="topMargin">
+                     <number>0</number>
+                    </property>
+                    <property name="rightMargin">
+                     <number>0</number>
+                    </property>
+                    <property name="bottomMargin">
+                     <number>0</number>
+                    </property>
+                    <item>
+                     <widget class="QLineEdit" name="textPagePresetName"/>
+                    </item>
+                   </layout>
+                  </widget>
+                 </item>
+                 <item>
+                  <widget class="QToolButton" name="buttonSavePagePreset">
+                   <property name="text">
+                    <string/>
+                   </property>
+                  </widget>
+                 </item>
+                 <item>
+                  <spacer name="horizontalSpacer_2">
+                   <property name="orientation">
+                    <enum>Qt::Orientation::Horizontal</enum>
+                   </property>
+                   <property name="sizeHint" stdset="0">
+                    <size>
+                     <width>40</width>
+                     <height>20</height>
+                    </size>
+                   </property>
+                  </spacer>
+                 </item>
+                </layout>
+               </item>
                <item>
                 <layout class="QGridLayout" name="gridLayout">
                  <item row="0" column="3">
@@ -430,6 +484,9 @@
                     <string>Layout</string>
                    </property>
                    <layout class="QHBoxLayout" name="horizontalLayout_9">
+                    <property name="spacing">
+                     <number>4</number>
+                    </property>
                     <property name="leftMargin">
                      <number>0</number>
                     </property>
@@ -443,38 +500,34 @@
                      <number>0</number>
                     </property>
                     <item>
-                     <layout class="QHBoxLayout" name="horizontalLayout_10">
-                      <item>
-                       <widget class="QToolButton" name="buttonSinglePage">
-                        <property name="text">
-                         <string/>
-                        </property>
-                        <property name="checkable">
-                         <bool>true</bool>
-                        </property>
-                       </widget>
-                      </item>
-                      <item>
-                       <widget class="QToolButton" name="buttonDoublePageLeft">
-                        <property name="text">
-                         <string/>
-                        </property>
-                        <property name="checkable">
-                         <bool>true</bool>
-                        </property>
-                       </widget>
-                      </item>
-                      <item>
-                       <widget class="QToolButton" name="buttonDoublePageRight">
-                        <property name="text">
-                         <string/>
-                        </property>
-                        <property name="checkable">
-                         <bool>true</bool>
-                        </property>
-                       </widget>
-                      </item>
-                     </layout>
+                     <widget class="QToolButton" name="buttonSinglePage">
+                      <property name="text">
+                       <string/>
+                      </property>
+                      <property name="checkable">
+                       <bool>true</bool>
+                      </property>
+                     </widget>
+                    </item>
+                    <item>
+                     <widget class="QToolButton" name="buttonDoublePageLeft">
+                      <property name="text">
+                       <string/>
+                      </property>
+                      <property name="checkable">
+                       <bool>true</bool>
+                      </property>
+                     </widget>
+                    </item>
+                    <item>
+                     <widget class="QToolButton" name="buttonDoublePageRight">
+                      <property name="text">
+                       <string/>
+                      </property>
+                      <property name="checkable">
+                       <bool>true</bool>
+                      </property>
+                     </widget>
                     </item>
                    </layout>
                   </widget>
diff --git a/scribus/ui/newmarginwidget.cpp b/scribus/ui/newmarginwidget.cpp
index 9f92cbf97..a5d42b3af 100644
--- a/scribus/ui/newmarginwidget.cpp
+++ b/scribus/ui/newmarginwidget.cpp
@@ -6,419 +6,463 @@ for which a new license (GPL+exception) is in place.
 */
 
 #include "newmarginwidget.h"
-#include "iconmanager.h"
+#include "iconmanager.h"
+#include "manager/pagepreset_manager.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)
+NewMarginWidget::NewMarginWidget(QWidget* parent) : QWidget(parent)
 {
 	setupUi(this);
 }
 
 void NewMarginWidget::setup(const MarginStruct& margs, int layoutType, int unitIndex, int flags)
 {
-	m_marginData = m_savedMarginData = margs;
 	m_unitIndex = unitIndex;
 	m_unitRatio = unitGetRatioFromIndex(unitIndex);
 	m_flags = flags;
-	leftMarginSpinBox->setMaximum(1000);
-	rightMarginSpinBox->setMaximum(1000);
-	topMarginSpinBox->setMaximum(1000);
-	bottomMarginSpinBox->setMaximum(1000);
+	m_marginData = margs;
+	m_savedMarginData = margs;
+
 	leftMarginSpinBox->init(unitIndex);
 	rightMarginSpinBox->init(unitIndex);
 	topMarginSpinBox->init(unitIndex);
 	bottomMarginSpinBox->init(unitIndex);
-	updateMarginSpinValues();
-	if ((m_flags & ShowPreset) == 0)
+
+	if (!(m_flags & ShowPreset))
 	{
-		presetLayoutComboBox->blockSignals(true);
-		presetLayoutComboBox->resize(0,0);
-		presetLayoutLabel->resize(0,0);
 		presetLayoutComboBox->hide();
 		presetLayoutLabel->hide();
-		horizontalLayout->removeWidget(presetLayoutComboBox);
-		horizontalLayout->removeWidget(presetLayoutLabel);
 	}
-	if ((m_flags & ShowPrinterMargins) == 0)
-	{
-		printerMarginsPushButton->blockSignals(true);
-		printerMarginsPushButton->resize(0,0);
+
+	if (!(m_flags & ShowPrinterMargins))
 		printerMarginsPushButton->hide();
-		horizontalLayout->removeWidget(printerMarginsPushButton);
-	}
+
 	setFacingPages(!(layoutType == singlePage));
 
+	disconnect(topMarginSpinBox, &ScrSpinBox::valueChanged, this, &NewMarginWidget::onSpinBoxChanged);
+	disconnect(bottomMarginSpinBox, &ScrSpinBox::valueChanged, this, &NewMarginWidget::onSpinBoxChanged);
+	disconnect(leftMarginSpinBox, &ScrSpinBox::valueChanged, this, &NewMarginWidget::onSpinBoxChanged);
+	disconnect(rightMarginSpinBox, &ScrSpinBox::valueChanged, this, &NewMarginWidget::onSpinBoxChanged);
+
+	updateUIFromState();
+
+	connect(ScQApp, &ScribusQApp::iconSetChanged, this, &NewMarginWidget::iconSetChange);
+	connect(topMarginSpinBox, &ScrSpinBox::valueChanged, this, &NewMarginWidget::onSpinBoxChanged);
+	connect(bottomMarginSpinBox, &ScrSpinBox::valueChanged, this, &NewMarginWidget::onSpinBoxChanged);
+	connect(leftMarginSpinBox, &ScrSpinBox::valueChanged, this, &NewMarginWidget::onSpinBoxChanged);
+	connect(rightMarginSpinBox, &ScrSpinBox::valueChanged, this, &NewMarginWidget::onSpinBoxChanged);
+	connect(presetLayoutComboBox, &QComboBox::activated, this, &NewMarginWidget::setPreset);
+	connect(marginLinkButton, &QToolButton::clicked, this, &NewMarginWidget::onLinkMarginsClicked);
+	connect(printerMarginsPushButton, &QPushButton::clicked, this, &NewMarginWidget::onPrinterMarginsClicked);
+
 	languageChange();
-	iconSetChange();
-	toggleLabelVisibility(true);
-
-	connect(ScQApp, SIGNAL(iconSetChanged()), this, SLOT(iconSetChange()));
-//	connect(ScQApp, SIGNAL(labelVisibilityChanged(bool)), this, SLOT(toggleLabelVisibility(bool)));
-	connect(topMarginSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setTop()));
-	connect(bottomMarginSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setBottom()));
-	connect(leftMarginSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setLeft()));
-	connect(rightMarginSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setRight()));
-	connect(presetLayoutComboBox, SIGNAL(activated(int)), this, SLOT(setPreset()));
-	connect(marginLinkButton, SIGNAL(clicked()), this, SLOT(slotLinkMargins()));
-	connect(printerMarginsPushButton, SIGNAL(clicked()), this, SLOT(setMarginsToPrinterMargins()));
+	iconSetChange();
+	toggleLabelVisibility(true);
 }
 
-void NewMarginWidget::languageChange()
+void NewMarginWidget::blockSpinBoxSignals(bool block)
 {
-	if (m_flags & MarginWidgetFlags)
+	leftMarginSpinBox->blockSignals(block);
+	rightMarginSpinBox->blockSignals(block);
+	topMarginSpinBox->blockSignals(block);
+	bottomMarginSpinBox->blockSignals(block);
+	presetLayoutComboBox->blockSignals(block);
+	marginLinkButton->blockSignals(block);
+}
+
+MarginStruct NewMarginWidget::calculateMarginsForPreset(int preset, double w, double h, double refLeft) const
+{
+	if (preset != PresetLayout::none && (m_flags & ShowPreset))
+		return presetLayoutComboBox->getMargins(preset, w, h, refLeft);
+
+	return m_marginData;
+}
+
+MarginStruct NewMarginWidget::sanitizeMargins(const MarginStruct& margins, double w, double h) const
+{
+	MarginStruct safe = margins;
+	bool validW = w > 0.001;
+	bool validH = h > 0.001;
+
+	if (!validW && !validH)
+		return safe;
+
+	if (marginLinkButton->isChecked() && !m_facingPages)
 	{
-		topMarginSpinBox->setToolTip( "<qt>" + tr( "Distance between the top margin guide and the edge of the page" ) + "</qt>");
-		bottomMarginSpinBox->setToolTip( "<qt>" + tr( "Distance between the bottom margin guide and the edge of the page" ) + "</qt>");
-		leftMarginSpinBox->setToolTip( "<qt>" + tr( "Distance between the left margin guide and the edge of the page. If a double-sided layout is selected, this margin space can be used to achieve the correct margins for binding.") + "</qt>");
-		rightMarginSpinBox->setToolTip( "<qt>" + tr( "Distance between the right margin guide and the edge of the page. If a double-sided layout is selected, this margin space can be used to achieve the correct margins for binding.") + "</qt>");
-		marginLinkButton->setToolTip( "<qt>" + tr( "Ensure all margins have the same value" ) + "</qt>");
+		double limit = (validW && validH) ? qMin(w, h) : (validW ? w : h);
+		double maxVal = limit / 2.0;
+		double val = qMin(safe.left(), maxVal);
+		safe.set(val, val, val, val);
+		return safe;
 	}
-	else if (m_flags & BleedWidgetFlags)
+
+	auto adjustDimension = [](double val1, double val2, double maxDim, double& out1, double& out2)
 	{
-		topMarginSpinBox->setToolTip( "<qt>" + tr( "Distance for bleed from the top of the physical page" ) + "</qt>" );
-		bottomMarginSpinBox->setToolTip( "<qt>" + tr( "Distance for bleed from the bottom of the physical page" ) + "</qt>" );
-		leftMarginSpinBox->setToolTip( "<qt>" + tr( "Distance for bleed from the left of the physical page" ) + "</qt>" );
-		rightMarginSpinBox->setToolTip( "<qt>" + tr( "Distance for bleed from the right of the physical page" )  + "</qt>");
-		marginLinkButton->setToolTip( "<qt>" + tr( "Ensure all bleeds have the same value" ) + "</qt>");
-	}
-	else
-	{
-		topMarginSpinBox->setToolTip( "<qt>" + tr( "Distance from the top" ) + "</qt>" );
-		bottomMarginSpinBox->setToolTip( "<qt>" + tr( "Distance from the bottom" ) + "</qt>" );
-		leftMarginSpinBox->setToolTip( "<qt>" + tr( "Distance from the left" ) + "</qt>" );
-		rightMarginSpinBox->setToolTip( "<qt>" + tr( "Distance from the right" )  + "</qt>");
-		marginLinkButton->setToolTip( "<qt>" + tr( "Ensure all distances have the same value" ) + "</qt>");
-	}
-	printerMarginsPushButton->setToolTip( "<qt>" + tr( "Import the margins for the selected page size from the available printers" ) + "</qt>");
-
-	leftMarginLabel->setText( m_facingPages ? tr("Inside") : tr("Left"));
-	rightMarginLabel->setText( m_facingPages ? tr("Outside") : tr("Right"));
+		if (val1 + val2 > maxDim)
+		{
+			if (val1 > maxDim)
+			{
+				out1 = maxDim;
+				out2 = 0.0;
+			}
+			else
+			{
+				out1 = val1;
+				out2 = maxDim - val1;
+			}
+		}
+		else
+		{
+			out1 = val1;
+			out2 = val2;
+		}
+	};
+
+	double l = safe.left(), r = safe.right(), t = safe.top(), b = safe.bottom();
+	if (validW)
+		adjustDimension(l, r, w, l, r);
+	if (validH)
+		adjustDimension(t, b, h, t, b);
+	safe.set(t, l, b, r);
+
+	return safe;
 }
 
-void NewMarginWidget::iconSetChange()
-{
-	IconManager &im = IconManager::instance();
-
-	leftMarginLabel->setPixmap(im.loadPixmap(m_facingPages ? "border-inside" : "border-left"));
-	rightMarginLabel->setPixmap(im.loadPixmap(m_facingPages ? "border-outside" : "border-right"));
-	topMarginLabel->setPixmap(im.loadPixmap("border-top"));
-	bottomMarginLabel->setPixmap(im.loadPixmap("border-bottom"));
-}
-
-void NewMarginWidget::toggleLabelVisibility(bool v)
-{
-	formWidget->setLabelVisibility(v);
-	leftMarginLabel->setLabelVisibility(v);
-	rightMarginLabel->setLabelVisibility(v);
-	topMarginLabel->setLabelVisibility(v);
-	bottomMarginLabel->setLabelVisibility(v);
-
-	leftMarginLabel->setIconVisibility(!v);
-	rightMarginLabel->setIconVisibility(!v);
-	topMarginLabel->setIconVisibility(!v);
-	bottomMarginLabel->setIconVisibility(!v);
-
-}
-
-void NewMarginWidget::setNewValues(const MarginStruct& margs)
+void NewMarginWidget::setPageWidth(double newWidth)
 {
-	m_marginData = m_savedMarginData = margs;
-	updateMarginSpinValues();
+	MarginStruct targetMargins = m_marginData;
+
+	if ((m_flags & ShowPreset) && m_savedPresetItem != PresetLayout::none)
+	{
+		double currentLeft = leftMarginSpinBox->value() / m_unitRatio;
+		targetMargins = calculateMarginsForPreset(m_savedPresetItem, newWidth, m_pageHeight, currentLeft);
+	}
+
+	setInternalState(newWidth, m_pageHeight, targetMargins, m_savedPresetItem);
 }
 
-void NewMarginWidget::setPageWidth(double newWidth)
+void NewMarginWidget::setPageHeight(double newHeight)
 {
-	// if ((m_flags & MarginWidgetFlags) == 0 || (m_flags & BleedWidgetFlags) == 0)
-	// {
-		leftMarginSpinBox->setMaximum(qMax(0.0, newWidth * m_unitRatio - rightMarginSpinBox->value()));
-		rightMarginSpinBox->setMaximum(qMax(0.0, newWidth * m_unitRatio - leftMarginSpinBox->value()));
-//	}
-	m_pageWidth = newWidth;
-	setPreset();
-	emit valuesChanged(m_marginData);
-
+	MarginStruct targetMargins = m_marginData;
+
+	if ((m_flags & ShowPreset) && m_savedPresetItem != PresetLayout::none)
+	{
+		double currentLeft = leftMarginSpinBox->value() / m_unitRatio;
+		targetMargins = calculateMarginsForPreset(m_savedPresetItem, m_pageWidth, newHeight, currentLeft);
+	}
+
+	setInternalState(m_pageWidth, newHeight, targetMargins, m_savedPresetItem);
 }
 
-void NewMarginWidget::setPageHeight(double newHeight)
+void NewMarginWidget::setNewValues(const MarginStruct& margs)
 {
-	// if ((m_flags & MarginWidgetFlags) == 0 || (m_flags & BleedWidgetFlags) == 0)
-	// {
-		topMarginSpinBox->setMaximum(qMax(0.0, newHeight * m_unitRatio - bottomMarginSpinBox->value()));
-		bottomMarginSpinBox->setMaximum(qMax(0.0,newHeight * m_unitRatio - topMarginSpinBox->value()));
-//	}
-	m_pageHeight = newHeight;
-	setPreset();
-	emit valuesChanged(m_marginData);
-
+	setInternalState(m_pageWidth, m_pageHeight, margs, m_savedPresetItem);
 }
 
-void NewMarginWidget::setTop()
+void NewMarginWidget::setNewUnit(int unitIndex)
 {
-	double newVal = topMarginSpinBox->value() / m_unitRatio;
-//	if ((m_flags & MarginWidgetFlags) == 0 || (m_flags & BleedWidgetFlags) == 0)
-		bottomMarginSpinBox->setMaximum(qMax(0.0, m_pageHeight * m_unitRatio - topMarginSpinBox->value()));
-	if (marginLinkButton->isChecked() && m_savedPresetItem == PresetLayout::none)
-	{
-		m_marginData.set(newVal, newVal, newVal, newVal);
-		updateMarginSpinValues();
-	}
-	else
-		m_marginData.setTop(newVal);
-	setPreset();
-	emit valuesChanged(m_marginData);
-
+	m_unitIndex = unitIndex;
+	m_unitRatio = unitGetRatioFromIndex(unitIndex);
+
+	blockSpinBoxSignals(true);
+	leftMarginSpinBox->setNewUnit(unitIndex);
+	rightMarginSpinBox->setNewUnit(unitIndex);
+	topMarginSpinBox->setNewUnit(unitIndex);
+	bottomMarginSpinBox->setNewUnit(unitIndex);
+	blockSpinBoxSignals(false);
+
+	setInternalState(m_pageWidth, m_pageHeight, m_marginData, m_savedPresetItem);
 }
 
-void NewMarginWidget::setBottom()
+void NewMarginWidget::setMarginPreset(int p)
 {
-	double newVal = bottomMarginSpinBox->value() / m_unitRatio;
-//	if ((m_flags & MarginWidgetFlags) == 0 || (m_flags & BleedWidgetFlags) == 0)
-		topMarginSpinBox->setMaximum(qMax(0.0, m_pageHeight * m_unitRatio - bottomMarginSpinBox->value()));
-	if (marginLinkButton->isChecked() && m_savedPresetItem == PresetLayout::none)
+	if (!(m_flags & ShowPreset))
+		return;
+
+	MarginStruct targetMargins = m_marginData;
+
+	if (p == PresetLayout::none || m_facingPages == false)
 	{
-		m_marginData.set(newVal, newVal, newVal, newVal);
-		updateMarginSpinValues();
+		if (m_savedPresetItem != PresetLayout::none)
+			targetMargins = m_savedMarginData;
 	}
 	else
-		m_marginData.setBottom(newVal);
-	setPreset();
-	emit valuesChanged(m_marginData);
-
+	{
+		if (m_savedPresetItem == PresetLayout::none)
+			m_savedMarginData = m_marginData;
+
+		double currentLeft = leftMarginSpinBox->value() / m_unitRatio;
+		targetMargins = calculateMarginsForPreset(p, m_pageWidth, m_pageHeight, currentLeft);
+	}
+
+	setInternalState(m_pageWidth, m_pageHeight, targetMargins, p);
 }
 
-void NewMarginWidget::setLeft()
+void NewMarginWidget::setFacingPages(bool facing, int pageType)
 {
-	double newVal = leftMarginSpinBox->value() / m_unitRatio;
-//	if ((m_flags & MarginWidgetFlags) == 0 || (m_flags & BleedWidgetFlags) == 0)
-		rightMarginSpinBox->setMaximum(qMax(0.0, m_pageWidth * m_unitRatio - leftMarginSpinBox->value()));
-	if (marginLinkButton->isChecked() && m_savedPresetItem == PresetLayout::none)
+	m_facingPages = facing;
+	m_pageType = pageType;
+
+	iconSetChange();
+	languageChange();
+
+	if (m_flags & ShowPreset)
 	{
-		m_marginData.set(newVal, newVal, newVal, newVal);
-		updateMarginSpinValues();
+		presetLayoutComboBox->setEnabled(m_facingPages);
+
+		if (m_facingPages)
+			setPreset();
+		else
+			setInternalState(m_pageWidth, m_pageHeight, m_marginData, m_savedPresetItem);
 	}
-	else
-		m_marginData.setLeft(newVal);
-	setPreset();
-	emit valuesChanged(m_marginData);
-
 }
 
-void NewMarginWidget::setRight()
+void NewMarginWidget::setInternalState(double width, double height, const MarginStruct& margins, int presetIndex)
 {
-	double newVal = rightMarginSpinBox->value() / m_unitRatio;
-//	if ((m_flags & MarginWidgetFlags) == 0 || (m_flags & BleedWidgetFlags) == 0)
-		leftMarginSpinBox->setMaximum(qMax(0.0, m_pageWidth * m_unitRatio - rightMarginSpinBox->value()));
-	if (marginLinkButton->isChecked() && m_savedPresetItem == PresetLayout::none)
+	blockSpinBoxSignals(true);
+
+	m_pageWidth = width;
+	m_pageHeight = height;
+	m_marginData = sanitizeMargins(margins, width, height);
+	m_savedPresetItem = presetIndex;
+
+	bool noPreset = presetIndex == PresetLayout::none || m_facingPages == false;
+
+	if (noPreset)
+		m_savedMarginData = margins;
+
+	if (m_flags & ShowPreset)
 	{
-		m_marginData.set(newVal, newVal, newVal, newVal);
-		updateMarginSpinValues();
+		presetLayoutComboBox->setCurrentIndex(presetIndex);
+		marginLinkButton->setEnabled(noPreset);
+		if (presetIndex != PresetLayout::none && m_facingPages)
+			marginLinkButton->setChecked(false);
 	}
-	else
-		m_marginData.setRight(newVal);
-	setPreset();
-	emit valuesChanged(m_marginData);
-
+
+	updateUIFromState();
+	updateSpinBoxLimits();
+
+	blockSpinBoxSignals(false);
+
+	emit valuesChanged(m_marginData);
 }
 
-void NewMarginWidget::setNewUnit(int newUnitIndex)
+void NewMarginWidget::updateUIFromState()
 {
-	bool leftSigBlocked   = leftMarginSpinBox->blockSignals(true);
-	bool rightSigBlocked  = rightMarginSpinBox->blockSignals(true);
-	bool topSigBlocked    = topMarginSpinBox->blockSignals(true);
-	bool bottomSigBlocked = bottomMarginSpinBox->blockSignals(true);
-
-	m_unitIndex = newUnitIndex;
-	m_unitRatio = unitGetRatioFromIndex(newUnitIndex);
-	topMarginSpinBox->setNewUnit(newUnitIndex);
-	bottomMarginSpinBox->setNewUnit(newUnitIndex);
-	leftMarginSpinBox->setNewUnit(newUnitIndex);
-	rightMarginSpinBox->setNewUnit(newUnitIndex);
-
-	leftMarginSpinBox->blockSignals(leftSigBlocked);
-	rightMarginSpinBox->blockSignals(rightSigBlocked);
-	topMarginSpinBox->blockSignals(topSigBlocked);
-	bottomMarginSpinBox->blockSignals(bottomSigBlocked);
+	double maxVal = qMax(m_pageWidth, m_pageHeight) * m_unitRatio;
+	if (maxVal <= 0) maxVal = 99999;
+
+	leftMarginSpinBox->setMaximum(maxVal);
+	rightMarginSpinBox->setMaximum(maxVal);
+	topMarginSpinBox->setMaximum(maxVal);
+	bottomMarginSpinBox->setMaximum(maxVal);
+
+	leftMarginSpinBox->setValue(m_marginData.left() * m_unitRatio);
+	topMarginSpinBox->setValue(m_marginData.top() * m_unitRatio);
+	rightMarginSpinBox->setValue(m_marginData.right() * m_unitRatio);
+	bottomMarginSpinBox->setValue(m_marginData.bottom() * m_unitRatio);
+
+	bool hasPreset = (m_savedPresetItem != PresetLayout::none) && (m_flags & ShowPreset) && (m_facingPages == true);
+	bool isNineParts = (m_savedPresetItem == PresetLayout::nineparts) && (m_facingPages == true);
+
+	leftMarginSpinBox->setEnabled(!(hasPreset && isNineParts));
+	topMarginSpinBox->setEnabled(!hasPreset);
+	bottomMarginSpinBox->setEnabled(!hasPreset);
+	rightMarginSpinBox->setEnabled(!hasPreset);
+
+	marginLinkButton->setEnabled(!hasPreset);
+	if (hasPreset) marginLinkButton->setChecked(false);
 }
 
-void NewMarginWidget::setPreset()
+void NewMarginWidget::updateSpinBoxLimits()
 {
-	if ((m_flags & ShowPreset) == 0)
-		return;
-	leftMarginSpinBox->blockSignals(true);
-	rightMarginSpinBox->blockSignals(true);
-	topMarginSpinBox->blockSignals(true);
-	bottomMarginSpinBox->blockSignals(true);
-	if (m_savedPresetItem == PresetLayout::none)
-		m_savedMarginData = m_marginData;
-	int item = presetLayoutComboBox->currentIndex();
-
-	MarginStruct marg = presetLayoutComboBox->getMargins(item, m_pageWidth, m_pageHeight, leftMarginSpinBox->value() / m_unitRatio);
-	presetLayoutComboBox->setEnabled(m_facingPages);
-
-	bool restoringValues = false;
-	if (item == PresetLayout::none && m_savedPresetItem != PresetLayout::none)
-	{
-		marg = m_savedMarginData;
-		restoringValues = true;
-	}
-	if (restoringValues || (presetLayoutComboBox->needUpdate() && m_facingPages))
+	double h = m_pageHeight * m_unitRatio;
+	double w = m_pageWidth * m_unitRatio;
+
+	bool validW = w > 0.001;
+	bool validH = h > 0.001;
+
+	double fallbackMax = 99999.0;
+
+	if (marginLinkButton->isChecked())
 	{
-		m_marginData.set(qMax(0.0, marg.top()), qMax(0.0, marg.left()), qMax(0.0, marg.bottom()), qMax(0.0, marg.right()));
-		updateMarginSpinValues();
-
-		bottomMarginSpinBox->setMaximum(qMax(0.0, m_pageHeight * m_unitRatio - topMarginSpinBox->value()));
-		topMarginSpinBox->setMaximum(qMax(0.0, m_pageHeight * m_unitRatio - bottomMarginSpinBox->value()));
-		rightMarginSpinBox->setMaximum(qMax(0.0, m_pageWidth * m_unitRatio - leftMarginSpinBox->value()));
-		leftMarginSpinBox->setMaximum(qMax(0.0, m_pageWidth * m_unitRatio - rightMarginSpinBox->value()));
-		rightMarginSpinBox->setEnabled(restoringValues);
-		topMarginSpinBox->setEnabled(restoringValues);
-		bottomMarginSpinBox->setEnabled(restoringValues);
+		double limit = fallbackMax;
+		if (validW && validH)
+			limit = qMin(w, h);
+		else if (validW)
+			limit = w;
+		else if (validH)
+			limit = h;
+
+		double maxAllowed = (validW || validH) ? (limit / 2.0) : fallbackMax;
+
+		topMarginSpinBox->setMaximum(maxAllowed);
+		bottomMarginSpinBox->setMaximum(maxAllowed);
+		leftMarginSpinBox->setMaximum(maxAllowed);
+		rightMarginSpinBox->setMaximum(maxAllowed);
 	}
 	else
 	{
-		rightMarginSpinBox->setEnabled(true);
-		topMarginSpinBox->setEnabled(true);
-		bottomMarginSpinBox->setEnabled(true);
+		if (validH)
+		{
+			topMarginSpinBox->setMaximum(qMax(0.0, h - bottomMarginSpinBox->value()));
+			bottomMarginSpinBox->setMaximum(qMax(0.0, h - topMarginSpinBox->value()));
+		}
+		else
+		{
+			topMarginSpinBox->setMaximum(fallbackMax);
+			bottomMarginSpinBox->setMaximum(fallbackMax);
+		}
+
+		if (validW)
+		{
+			leftMarginSpinBox->setMaximum(qMax(0.0, w - rightMarginSpinBox->value()));
+			rightMarginSpinBox->setMaximum(qMax(0.0, w - leftMarginSpinBox->value()));
+		}
+		else
+		{
+			leftMarginSpinBox->setMaximum(fallbackMax);
+			rightMarginSpinBox->setMaximum(fallbackMax);
+		}
 	}
-	if (m_pageType == 1)
-		rightMarginSpinBox->setEnabled(false);
-	leftMarginSpinBox->setEnabled(item != PresetLayout::nineparts);
-	if (item != PresetLayout::none)
-		marginLinkButton->setChecked(false);
-	marginLinkButton->setEnabled(item == PresetLayout::none || !presetLayoutComboBox->isEnabled());
-	leftMarginSpinBox->blockSignals(false);
-	rightMarginSpinBox->blockSignals(false);
-	topMarginSpinBox->blockSignals(false);
-	bottomMarginSpinBox->blockSignals(false);
-	m_savedPresetItem = item;
-
-	emit marginChanged(m_marginData);
 }
 
-void NewMarginWidget::setPageSize(const QString& pageSize)
+void NewMarginWidget::setPreset()
 {
-	m_pageSize = pageSize;
+	setMarginPreset(presetLayoutComboBox->currentIndex());
 }
 
-
-void NewMarginWidget::updateMarginSpinValues()
+void NewMarginWidget::onSpinBoxChanged()
 {
-	bool leftBlocked = leftMarginSpinBox->blockSignals(true);
-	bool rightBlocked = rightMarginSpinBox->blockSignals(true);
-	bool topBlocked = topMarginSpinBox->blockSignals(true);
-	bool bottomBlocked = bottomMarginSpinBox->blockSignals(true);
+	double val = 0.0;
 
-	topMarginSpinBox->setValue(m_marginData.top() * m_unitRatio);
-	rightMarginSpinBox->setValue(m_marginData.right() * m_unitRatio);
-	bottomMarginSpinBox->setValue(m_marginData.bottom() * m_unitRatio);
-	leftMarginSpinBox->setValue(m_marginData.left() * m_unitRatio);
+	QObject* s = sender();
+	if (s == topMarginSpinBox) val = topMarginSpinBox->value();
+	else if (s == bottomMarginSpinBox) val = bottomMarginSpinBox->value();
+	else if (s == rightMarginSpinBox) val = rightMarginSpinBox->value();
+	else val = leftMarginSpinBox->value();
 
-	leftMarginSpinBox->blockSignals(leftBlocked);
-	rightMarginSpinBox->blockSignals(rightBlocked);
-	topMarginSpinBox->blockSignals(topBlocked);
-	bottomMarginSpinBox->blockSignals(bottomBlocked);
+	double valInPoints = val / m_unitRatio;
+
+	if ((m_flags & ShowPreset) && m_savedPresetItem != PresetLayout::none && m_facingPages)
+	{
+		MarginStruct newMargins = calculateMarginsForPreset(m_savedPresetItem, m_pageWidth, m_pageHeight, valInPoints);
+		setInternalState(m_pageWidth, m_pageHeight, newMargins, m_savedPresetItem);
+	}
+	else
+	{
+		MarginStruct newM;
+
+		if (marginLinkButton->isChecked())
+		{
+			double maxAllowed = qMin(m_pageWidth, m_pageHeight) / 2.0;
+			valInPoints = qMin(maxAllowed, valInPoints);
+
+			newM.set(valInPoints, valInPoints, valInPoints, valInPoints);
+		}
+		else
+		{
+			double t = topMarginSpinBox->value() / m_unitRatio;
+			double b = bottomMarginSpinBox->value() / m_unitRatio;
+			double l = leftMarginSpinBox->value() / m_unitRatio;
+			double r = rightMarginSpinBox->value() / m_unitRatio;
+
+			if (s == topMarginSpinBox) t = valInPoints;
+			else if (s == bottomMarginSpinBox) b = valInPoints;
+			else if (s == leftMarginSpinBox) l = valInPoints;
+			else if (s == rightMarginSpinBox) r = valInPoints;
+
+			newM.set(t, l, b, r);
+		}
+
+		m_savedMarginData = newM;
+		setInternalState(m_pageWidth, m_pageHeight, newM, m_savedPresetItem);
+	}
 }
 
-void NewMarginWidget::slotLinkMargins()
+void NewMarginWidget::onLinkMarginsClicked()
 {
-	bool leftBlocked = leftMarginSpinBox->blockSignals(true);
-	bool rightBlocked = rightMarginSpinBox->blockSignals(true);
-	bool topBlocked = topMarginSpinBox->blockSignals(true);
-	bool bottomBlocked = bottomMarginSpinBox->blockSignals(true);
-
 	if (marginLinkButton->isChecked())
 	{
-		bottomMarginSpinBox->setValue(leftMarginSpinBox->value());
-		topMarginSpinBox->setValue(leftMarginSpinBox->value());
-		rightMarginSpinBox->setValue(leftMarginSpinBox->value());
-		double newVal = leftMarginSpinBox->value() / m_unitRatio;
-		m_marginData.set(newVal, newVal, newVal, newVal);
-
-		emit marginChanged(m_marginData);
+
+		double maxAllowed = qMin(m_pageWidth, m_pageHeight) / 2.0;
+		double val = qMin(maxAllowed, leftMarginSpinBox->value() / m_unitRatio);
+
+		MarginStruct newM(val, val, val, val);
+		setInternalState(m_pageWidth, m_pageHeight, newM, m_savedPresetItem);
 	}
+	else
+		updateSpinBoxLimits();
 
-	leftMarginSpinBox->blockSignals(leftBlocked);
-	rightMarginSpinBox->blockSignals(rightBlocked);
-	topMarginSpinBox->blockSignals(topBlocked);
-	bottomMarginSpinBox->blockSignals(bottomBlocked);
 }
 
-void NewMarginWidget::setMarginPreset(int p)
+void NewMarginWidget::languageChange()
 {
-	if ((m_flags & ShowPreset) == 0)
-		return;
-	presetLayoutComboBox->blockSignals(true);
-	m_savedPresetItem = p;
-	presetLayoutComboBox->setCurrentIndex(p);
-	if (m_savedPresetItem == PresetLayout::none)
-		m_savedMarginData = m_marginData;
-	int item = presetLayoutComboBox->currentIndex();
-	presetLayoutComboBox->setEnabled(m_facingPages);
-
-	bool restoringValues = false;
-	if ((item == PresetLayout::none) && (m_savedPresetItem != PresetLayout::none))
+	if (m_flags & MarginWidgetFlags)
 	{
-		restoringValues = true;
+		topMarginSpinBox->setToolTip("<qt>" + tr("Distance between the top margin guide and the edge of the page") + "</qt>");
+		bottomMarginSpinBox->setToolTip("<qt>" + tr("Distance between the bottom margin guide and the edge of the page") + "</qt>");
+		leftMarginSpinBox->setToolTip("<qt>" + tr("Distance between the left margin guide and the edge of the page. If a double-sided layout is selected, this margin space can be used to achieve the correct margins for binding.") + "</qt>");
+		rightMarginSpinBox->setToolTip("<qt>" + tr("Distance between the right margin guide and the edge of the page. If a double-sided layout is selected, this margin space can be used to achieve the correct margins for binding.") + "</qt>");
+		marginLinkButton->setToolTip("<qt>" + tr("Ensure all margins have the same value") + "</qt>");
 	}
-	if (restoringValues || (presetLayoutComboBox->needUpdate() && m_facingPages))
+	else if (m_flags & BleedWidgetFlags)
 	{
-		rightMarginSpinBox->setEnabled(restoringValues);
-		topMarginSpinBox->setEnabled(restoringValues);
-		bottomMarginSpinBox->setEnabled(restoringValues);
+		topMarginSpinBox->setToolTip("<qt>" + tr("Distance for bleed from the top of the physical page") + "</qt>");
+		bottomMarginSpinBox->setToolTip("<qt>" + tr("Distance for bleed from the bottom of the physical page") + "</qt>");
+		leftMarginSpinBox->setToolTip("<qt>" + tr("Distance for bleed from the left of the physical page") + "</qt>");
+		rightMarginSpinBox->setToolTip("<qt>" + tr("Distance for bleed from the right of the physical page") + "</qt>");
+		marginLinkButton->setToolTip("<qt>" + tr("Ensure all bleeds have the same value") + "</qt>");
 	}
 	else
 	{
-		rightMarginSpinBox->setEnabled(true);
-		topMarginSpinBox->setEnabled(true);
-		bottomMarginSpinBox->setEnabled(true);
+		topMarginSpinBox->setToolTip("<qt>" + tr("Distance from the top") + "</qt>");
+		bottomMarginSpinBox->setToolTip("<qt>" + tr("Distance from the bottom") + "</qt>");
+		leftMarginSpinBox->setToolTip("<qt>" + tr("Distance from the left") + "</qt>");
+		rightMarginSpinBox->setToolTip("<qt>" + tr("Distance from the right") + "</qt>");
+		marginLinkButton->setToolTip("<qt>" + tr("Ensure all distances have the same value") + "</qt>");
 	}
-	if (m_pageType == 1)
-		rightMarginSpinBox->setEnabled(false);
-	leftMarginSpinBox->setEnabled(item != PresetLayout::nineparts);
-	if (item != PresetLayout::none)
-		marginLinkButton->setChecked(false);
-	marginLinkButton->setEnabled(item == PresetLayout::none);
-	presetLayoutComboBox->blockSignals(false);
+	printerMarginsPushButton->setToolTip("<qt>" + tr("Import the margins for the selected page size from the available printers") + "</qt>");
+
+	leftMarginLabel->setText(m_facingPages ? tr("Inside") : tr("Left"));
+	rightMarginLabel->setText(m_facingPages ? tr("Outside") : tr("Right"));
 }
 
-void NewMarginWidget::setFacingPages(bool facing, int pageType)
+void NewMarginWidget::iconSetChange()
 {
-	m_facingPages = facing;
-	m_pageType = pageType;
-
-	leftMarginLabel->setText( m_facingPages ? tr("Inside") : tr("Left"));
-	rightMarginLabel->setText( m_facingPages ? tr("Outside") : tr("Right"));
-
-	iconSetChange();
-	setPreset();
+	IconManager& im = IconManager::instance();
+
+	leftMarginLabel->setPixmap(im.loadPixmap(m_facingPages ? "border-inside" : "border-left"));
+	rightMarginLabel->setPixmap(im.loadPixmap(m_facingPages ? "border-outside" : "border-right"));
+	topMarginLabel->setPixmap(im.loadPixmap("border-top"));
+	bottomMarginLabel->setPixmap(im.loadPixmap("border-bottom"));
 }
 
-void NewMarginWidget::setMarginsToPrinterMargins()
+void NewMarginWidget::toggleLabelVisibility(bool v)
 {
-	QSizeF pageDimensions(m_pageWidth, m_pageHeight);
-	UsePrinterMarginsDialog upm(parentWidget(), pageDimensions, m_pageSize, unitGetRatioFromIndex(m_unitIndex), unitGetSuffixFromIndex(m_unitIndex));
-	if (upm.exec() != QDialog::Accepted)
-		return;
-
-	double t, b, l, r;
-	upm.getNewPrinterMargins(t, b, l, r);
-	presetLayoutComboBox->setCurrentIndex(PresetLayout::none);
-	m_marginData.set(t, l, b, r);
+	formWidget->setLabelVisibility(v);
+	leftMarginLabel->setLabelVisibility(v);
+	rightMarginLabel->setLabelVisibility(v);
+	topMarginLabel->setLabelVisibility(v);
+	bottomMarginLabel->setLabelVisibility(v);
+}
 
-	updateMarginSpinValues();
+void NewMarginWidget::onPrinterMarginsClicked()
+{
+	QSizeF pageDimensions(m_pageWidth, m_pageHeight);
+	PageSizeInfo psi = PagePresetManager::instance().pageInfoByDimensions(m_pageWidth, m_pageHeight);
 
-	bottomMarginSpinBox->setMaximum((qMax(0.0, m_pageHeight - t) * m_unitRatio));
-	topMarginSpinBox->setMaximum((qMax(0.0, m_pageHeight - b) * m_unitRatio));
-	rightMarginSpinBox->setMaximum((qMax(0.0, m_pageWidth - l) * m_unitRatio));
-	leftMarginSpinBox->setMaximum((qMax(0.0, m_pageWidth - r) * m_unitRatio));
+	UsePrinterMarginsDialog upm(this, pageDimensions, psi.displayName, m_unitRatio, unitGetSuffixFromIndex(m_unitIndex));
 
-	rightMarginSpinBox->setEnabled(true);
-	topMarginSpinBox->setEnabled(true);
-	bottomMarginSpinBox->setEnabled(true);
+	if (upm.exec() == QDialog::Accepted)
+	{
+		double t, b, l, r;
+		upm.getNewPrinterMargins(t, b, l, r);
+		MarginStruct newMargins(t, l, b, r);
+		setInternalState(m_pageWidth, m_pageHeight, newMargins, PresetLayout::none);
+	}
 }
-
diff --git a/scribus/ui/newmarginwidget.h b/scribus/ui/newmarginwidget.h
index e778c444b..6b186da61 100644
--- a/scribus/ui/newmarginwidget.h
+++ b/scribus/ui/newmarginwidget.h
@@ -10,76 +10,76 @@ for which a new license (GPL+exception) is in place.
 
 #include "ui_newmarginwidgetbase.h"
 #include "scribusapi.h"
-#include "scribusstructs.h"
 
 class SCRIBUS_API NewMarginWidget : public QWidget, Ui::NewMarginWidget
 {
 	Q_OBJECT
 
-	public:
-		NewMarginWidget(QWidget* parent = nullptr);
-		~NewMarginWidget() = default;
-
-		enum SetupFlags
-		{
-			DistanceWidgetFlags	= 0,
-			ShowPreset			= 1,
-			ShowPrinterMargins	= 2,
-			MarginWidgetFlags	= 3,
-			BleedWidgetFlags	= 4
-		};
-
-		void setup(const MarginStruct& margs, int layoutType, int unitIndex, int flags = MarginWidgetFlags);
-		/*! \brief Setup the labels by facing pages option */
-		void setFacingPages(bool facing, int pageType = 0);
-		/*! \brief Setup the spinboxes properties (min/max value etc.) by width */
-		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 */
-		void setMarginPreset(int p);
-		int marginPreset() { return m_savedPresetItem; };
-		const MarginStruct & margins() const { return m_marginData; };
-
-	public slots:
-		void languageChange();
-		void iconSetChange();
-		void toggleLabelVisibility(bool v);
-		void setTop();
-		void setBottom();
-		void setLeft();
-		void setRight();
-		void slotLinkMargins();
-		void setPreset();
-
-	protected slots:
-		void setMarginsToPrinterMargins();
-
-	protected:
-		void updateMarginSpinValues();
-
-		MarginStruct m_marginData;
-		MarginStruct m_savedMarginData;
-		QString m_pageSize;
-		bool   m_facingPages {false};
-		double m_pageHeight {0.0};
-		double m_pageWidth {0.0};
-		double m_unitRatio {1.0};
-		int    m_flags {MarginWidgetFlags};
-		int    m_pageType {0};
-		int    m_savedPresetItem {PresetLayout::none};
-		int    m_unitIndex {0};
+public:
+	NewMarginWidget(QWidget* parent = nullptr);
+	~NewMarginWidget() = default;
 
-signals:
-		void marginChanged(MarginStruct);
-		void valuesChanged(MarginStruct);
-};
+	enum SetupFlags
+	{
+		DistanceWidgetFlags = 0,
+		ShowPreset          = 1,
+		ShowPrinterMargins  = 2,
+		MarginWidgetFlags   = 3,
+		BleedWidgetFlags    = 4
+	};
 
-#endif // NEWMARGINWIDGET_H
+	void setup(const MarginStruct& margs, int layoutType, int unitIndex, int flags = MarginWidgetFlags);
+	/*! \brief Setup the labels by facing pages option */
+	void setFacingPages(bool facing, int pageType = 0);
+	/*! \brief Setup the spinboxes properties (min/max value etc.) by width */
+	void setPageWidth(double width);
+	/*! \brief Setup the spinboxes properties (min/max value etc.) by height */
+	void setPageHeight(double height);
+	void setNewUnit(int unitIndex);
+	void setNewValues(const MarginStruct& margs);
+	/*! \brief Setup the presetCombo without changing the margin values */
+	void setMarginPreset(int p);
+
+	int marginPreset() const { return m_savedPresetItem; };
+
+	const MarginStruct& margins() const { return m_marginData; };
+
+public slots:
+	void languageChange();
+	void iconSetChange();
+	void toggleLabelVisibility(bool v);
+
+protected slots:
+
+	void onSpinBoxChanged();
+	void onLinkMarginsClicked();
+	void onPrinterMarginsClicked();
+	void setPreset();
 
+protected:
 
+	bool m_facingPages {false};
+	double m_pageHeight {0.0};
+	double m_pageWidth {0.0};
+	double m_unitRatio {1.0};
+	int m_flags {MarginWidgetFlags};
+	int m_pageType {0};
+	int m_savedPresetItem {PresetLayout::none};
+	int m_unitIndex {0};
 
+	MarginStruct m_marginData;
+	MarginStruct m_savedMarginData;
+
+	MarginStruct calculateMarginsForPreset(int preset, double w, double h, double refLeft) const;
+	MarginStruct sanitizeMargins(const MarginStruct& margins, double w, double h) const;
+
+	void setInternalState(double width, double height, const MarginStruct& margins, int presetIndex);
+	void updateUIFromState();
+	void updateSpinBoxLimits();
+	void blockSpinBoxSignals(bool block);
+
+signals:
+	void valuesChanged(MarginStruct);
+};
+
+#endif // NEWMARGINWIDGET_H
diff --git a/scribus/ui/newmarginwidgetbase.ui b/scribus/ui/newmarginwidgetbase.ui
index f903fd3be..87603be2f 100644
--- a/scribus/ui/newmarginwidgetbase.ui
+++ b/scribus/ui/newmarginwidgetbase.ui
@@ -37,6 +37,9 @@
    </property>
    <item row="0" column="1" colspan="3">
     <layout class="QHBoxLayout" name="horizontalLayout">
+     <property name="spacing">
+      <number>4</number>
+     </property>
      <item>
       <widget class="QLabel" name="presetLayoutLabel">
        <property name="text">
@@ -206,6 +209,9 @@
    </item>
    <item row="4" column="1" colspan="3">
     <layout class="QHBoxLayout" name="horizontalLayout_4">
+     <property name="spacing">
+      <number>4</number>
+     </property>
      <item>
       <widget class="QPushButton" name="printerMarginsPushButton">
        <property name="text">
@@ -324,7 +330,7 @@
   <customwidget>
    <class>ScrSpinBox</class>
    <extends>QDoubleSpinBox</extends>
-   <header location="global">ui/scrspinbox.h</header>
+   <header>ui/scrspinbox.h</header>
   </customwidget>
   <customwidget>
    <class>LinkButton</class>
diff --git a/scribus/ui/pagepropertiesdialog.cpp b/scribus/ui/pagepropertiesdialog.cpp
index 32f5216e1..cf0c19da8 100644
--- a/scribus/ui/pagepropertiesdialog.cpp
+++ b/scribus/ui/pagepropertiesdialog.cpp
@@ -19,7 +19,7 @@ for which a new license (GPL+exception) is in place.
 #include "iconmanager.h"
 #include "newmarginwidget.h"
 #include "pagepropertiesdialog.h"
-#include "pagesize.h"
+#include "manager/pagepreset_manager.h"
 #include "pagestructs.h"
 #include "scpage.h"
 #include "scribusdoc.h"
@@ -38,17 +38,8 @@ PagePropertiesDialog::PagePropertiesDialog( QWidget* parent, ScribusDoc* doc )
 	dialogLayout->setContentsMargins(9, 9, 9, 9);
 	dialogLayout->setSpacing(4);
 	
-	PageSize ps(doc->currentPage()->size());
-
-	// try to find corresponding page size by dimensions
-	if (ps.name() == CommonStrings::customPageSize)
-	{
-		PageSizeInfoMap pages = ps.sizesByDimensions(QSize(doc->currentPage()->width(), doc->currentPage()->height()));
-		if (pages.count() > 0)
-			prefsPageSizeName = pages.firstKey();
-	}
-	else
-		prefsPageSizeName = ps.name();
+	PageSizeInfo psi = PagePresetManager::instance().pageInfoByDimensions(QSize(doc->currentPage()->width(), doc->currentPage()->height()));
+	prefsPageSizeName = psi.id;
 
 	dsGroupBox7 = new QGroupBox(this);
 	dsGroupBox7->setTitle( tr( "Page Size" ) );
@@ -59,7 +50,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 );
@@ -111,13 +102,11 @@ PagePropertiesDialog::PagePropertiesDialog( QWidget* parent, ScribusDoc* doc )
 	}
 	dialogLayout->addWidget( dsGroupBox7 );
 	
-//	marginWidget = new MarginWidget(this,  tr( "Margin Guides" ), &doc->currentPage()->initialMargins, doc->unitIndex(), false, false);
 	marginWidget = new NewMarginWidget();
-	marginWidget->setup(doc->currentPage()->initialMargins, doc->currentPage()->marginPreset, doc->unitIndex(), NewMarginWidget::MarginWidgetFlags );
+	marginWidget->setup(doc->currentPage()->initialMargins, !(doc->pagePositioning() == singlePage), doc->unitIndex(), NewMarginWidget::MarginWidgetFlags );
 	marginWidget->setPageHeight(doc->currentPage()->height());
 	marginWidget->setPageWidth(doc->currentPage()->width());
-	marginWidget->setFacingPages(!(doc->pagePositioning() == singlePage), doc->locationOfPage(doc->currentPage()->pageNr()));
-//	marginWidget->setMarginPreset(doc->currentPage()->marginPreset);
+	marginWidget->setMarginPreset(doc->currentPage()->marginPreset);
 	dialogLayout->addWidget( marginWidget );
 
 	groupMaster = new QGroupBox( this );
@@ -165,7 +154,7 @@ PagePropertiesDialog::PagePropertiesDialog( QWidget* parent, ScribusDoc* doc )
 	m_pageWidth = widthSpinBox->value() / m_unitRatio;
 	m_pageHeight = heightSpinBox->value() / m_unitRatio;
 
-	bool isCustom = (pageSizeSelector->pageSizeTR() == CommonStrings::trCustomPageSize);
+	bool isCustom = (pageSizeSelector->pageSize() == CommonStrings::customPageSize);
 	heightSpinBox->setEnabled(isCustom);
 	widthSpinBox->setEnabled(isCustom);
 	// signals and slots connections
@@ -219,7 +208,7 @@ void PagePropertiesDialog::setPageHeight(double)
 
 void PagePropertiesDialog::setPageSize()
 {
-	if (pageSizeSelector->pageSizeTR() != CommonStrings::trCustomPageSize)
+	if (pageSizeSelector->pageSize() != CommonStrings::customPageSize)
 		oldOri++;
 	setOrientation(orientationQComboBox->currentIndex());
 }
@@ -230,18 +219,19 @@ void PagePropertiesDialog::setSize(const QString & gr)
 	m_pageHeight = heightSpinBox->value() / m_unitRatio;
 	widthSpinBox->setEnabled(false);
 	heightSpinBox->setEnabled(false);
-	PageSize ps2(gr);
-	prefsPageSizeName = ps2.name();
-	if (gr == CommonStrings::trCustomPageSize)
+
+	PageSizeInfo psi = PagePresetManager::instance().pageInfoByName(gr);
+
+	prefsPageSizeName = psi.id;
+	if (gr == CommonStrings::customPageSize)
 	{
 		widthSpinBox->setEnabled(true);
 		heightSpinBox->setEnabled(true);
-		prefsPageSizeName = CommonStrings::customPageSize;
 	}
 	else
 	{
-		m_pageWidth = ps2.width();
-		m_pageHeight = ps2.height();
+		m_pageWidth = psi.width;
+		m_pageHeight = psi.height;
 	}
 	disconnect(widthSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setPageWidth(double)));
 	disconnect(heightSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setPageHeight(double)));
@@ -249,17 +239,16 @@ 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)));
 }
 
 void PagePropertiesDialog::setOrientation(int ori)
 {
-	setSize(pageSizeSelector->pageSizeTR());
+	setSize(pageSizeSelector->pageSize());
 	disconnect(widthSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setPageWidth(double)));
 	disconnect(heightSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setPageHeight(double)));
-	if ((pageSizeSelector->pageSizeTR() == CommonStrings::trCustomPageSize) && (ori != oldOri))
+	if ((pageSizeSelector->pageSize() == CommonStrings::customPageSize) && (ori != oldOri))
 	{
 		double w = widthSpinBox->value(), h = heightSpinBox->value();
 		widthSpinBox->setValue((ori == portraitPage) ? qMin(w, h) : qMax(w, h));
diff --git a/scribus/ui/preferences/prefs_documentsetup.cpp b/scribus/ui/preferences/prefs_documentsetup.cpp
index 3418fbce3..ae4c23eb8 100644
--- a/scribus/ui/preferences/prefs_documentsetup.cpp
+++ b/scribus/ui/preferences/prefs_documentsetup.cpp
@@ -11,7 +11,7 @@ for which a new license (GPL+exception) is in place.
 
 #include "commonstrings.h"
 #include "langmgr.h"
-#include "pagesize.h"
+#include "manager/pagepreset_manager.h"
 #include "prefsfile.h"
 #include "prefsmanager.h"
 #include "prefsstructs.h"
@@ -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())
 	{
@@ -332,7 +321,7 @@ void Prefs_DocumentSetup::setPageOrientation(int orientation)
 	setSize(pageSizeSelector->pageSize());
 	pageWidthSpinBox->blockSignals(true);
 	pageHeightSpinBox->blockSignals(true);
-	if ((orientation==0 && pageSizeSelector->pageSizeTR() == CommonStrings::trCustomPageSize) || orientation!=0)
+	if ((orientation == 0 && pageSizeSelector->pageSize() == CommonStrings::customPageSize) || orientation != 0)
 	{
 		double w = pageWidthSpinBox->value(), h = pageHeightSpinBox->value();
 		pageWidthSpinBox->setValue((orientation == portraitPage) ? qMin(w, h) : qMax(w, h));
@@ -354,15 +343,14 @@ void Prefs_DocumentSetup::setSize(const QString &newSize)
 	pageW = pageWidthSpinBox->value() / unitRatio;
 	pageH = pageHeightSpinBox->value() / unitRatio;
 
-	PageSize ps2(newSize);
-	prefsPageSizeName = ps2.name();
-	if (newSize != CommonStrings::customPageSize && newSize != CommonStrings::trCustomPageSize)
+	PageSizeInfo psi = PagePresetManager::instance().pageInfoByName(newSize);
+
+	prefsPageSizeName = psi.id;
+	if (psi.id != CommonStrings::customPageSize)
 	{
-		pageW = ps2.width();
-		pageH = ps2.height();
+		pageW = psi.width;
+		pageH = psi.height;
 	}
-	else
-		prefsPageSizeName = CommonStrings::customPageSize;
 
 	pageWidthSpinBox->blockSignals(true);
 	pageHeightSpinBox->blockSignals(true);
@@ -370,7 +358,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/preferences/prefs_pagesizes.cpp b/scribus/ui/preferences/prefs_pagesizes.cpp
index d0f7ccef4..cffe85543 100644
--- a/scribus/ui/preferences/prefs_pagesizes.cpp
+++ b/scribus/ui/preferences/prefs_pagesizes.cpp
@@ -9,9 +9,9 @@ for which a new license (GPL+exception) is in place.
 #include <QStringList>
 
 #include "iconmanager.h"
-#include "pagesize.h"
 #include "prefsstructs.h"
 #include "scribusdoc.h"
+#include "manager/pagepreset_manager.h"
 #include "ui/preferences/prefs_pagesizes.h"
 
 
@@ -41,20 +41,28 @@ void Prefs_PageSizes::languageChange()
 	QString textSize = tr("Page Format");
 	QString textDimension = tr("Dimension");
 
-	if(QTreeWidgetItem* header = treeAvailableSizes->headerItem()) {
+	if(QTreeWidgetItem* header = treeAvailableSizes->headerItem())
+	{
 		header->setText(0, textSize);
 
 		if (header->columnCount() > 1)
 			header->setText(1, textDimension);
+
+		treeAvailableSizes->resizeColumnToContents(0);
+		treeAvailableSizes->resizeColumnToContents(1);
 	}
 	else
 		treeAvailableSizes->setHeaderLabel( textSize );
 
 
-	if(QTreeWidgetItem* header = treeActiveSizes->headerItem()) {
+	if(QTreeWidgetItem* header = treeActiveSizes->headerItem())
+	{
 		header->setText(0, textSize);
 		if (header->columnCount() > 1)
 			header->setText(1, textDimension);
+
+		treeActiveSizes->resizeColumnToContents(0);
+		treeActiveSizes->resizeColumnToContents(1);
 	}
 	else
 		treeActiveSizes->setHeaderLabel( textSize );
@@ -63,66 +71,51 @@ void Prefs_PageSizes::languageChange()
 
 void Prefs_PageSizes::restoreDefaults(struct ApplicationPrefs *prefsData)
 {
-	PageSize ps(prefsData->docSetupPrefs.pageSize);
-
 	treeAvailableSizes->clear();
 	treeActiveSizes->clear();
 
-	auto cats = ps.categories();
+	auto& ppm = PagePresetManager::instance();
+	auto categories = ppm.categoriesOrder();
+	auto activeSizesMap = ppm.activePageSizes();
 
-	// Available Page Sizes
-	for (auto it = cats.begin(); it != cats.end(); ++it)
+	for (int i = 0; i < categories.size(); i++)
 	{
-		QTreeWidgetItem* tlItem = new QTreeWidgetItem();
-		tlItem->setText(0, it.value());
-		tlItem->setData(0, Qt::UserRole, it.key());
+		QString id = categories.at(i);
+		if (id == "-")
+			continue;
 
-		treeAvailableSizes->addTopLevelItem(tlItem);
+		PageCollectionInfo pci = ppm.categoryInfoById(id);
 
-		PageSizeInfoMap sizes = ps.sizesByCategory(it.key());
+		QTreeWidgetItem* tlItemAvailable = new QTreeWidgetItem();
+		tlItemAvailable->setText(0, pci.displayName);
+		tlItemAvailable->setData(0, Qt::UserRole, id);
+		treeAvailableSizes->addTopLevelItem(tlItemAvailable);
 
-		for (auto s = sizes.begin(); s != sizes.end(); ++s)
-		{
-			if (!ps.activePageSizes().contains(s.key()))
-			{
-				QTreeWidgetItem* sItem = new QTreeWidgetItem();
-				sItem->setText(0, s.value().trSizeName);
-				sItem->setText(1, s.value().sizeLabel);
-				sItem->setData(0, Qt::UserRole, s.key());
+		QTreeWidgetItem* tlItemActive = new QTreeWidgetItem();
+		tlItemActive->setText(0, pci.displayName);
+		tlItemActive->setData(0, Qt::UserRole, id);
+		treeActiveSizes->addTopLevelItem(tlItemActive);
 
-				tlItem->addChild(sItem);
-			}
-		}
-	}
+		PageSizeInfoMap catSizes = ppm.sizesByCategory(id);
 
-	// Active page Sizes
-	for (auto it = cats.begin(); it != cats.end(); ++it)
-	{
-		PageSizeInfo::Category cat = it.key();
-
-		QTreeWidgetItem* tlItem = new QTreeWidgetItem();
-		tlItem->setText(0, it.value());
-		tlItem->setData(0, Qt::UserRole, cat);
-
-		treeActiveSizes->addTopLevelItem(tlItem);
-
-		PageSizeInfoMap sizes = ps.activePageSizes();
-
-		for (auto s = sizes.begin(); s != sizes.end(); ++s)
+		for (auto s = catSizes.begin(); s != catSizes.end(); ++s)
 		{
-			if (s.value().category == cat)
-			{
-				QTreeWidgetItem* sItem = new QTreeWidgetItem();
-				sItem->setText(0, s.value().trSizeName);
-				sItem->setText(1, s.value().sizeLabel);
-				sItem->setData(0, Qt::UserRole, s.key());
-
-				tlItem->addChild(sItem);
-			}
-
+			QTreeWidgetItem* sItem = new QTreeWidgetItem();
+			sItem->setText(0, s.value().displayName);
+			sItem->setText(1, s.value().label);
+			sItem->setData(0, Qt::UserRole, s.key());
+
+			if (activeSizesMap.contains(s.key()))
+				tlItemActive->addChild(sItem);
+			else
+				tlItemAvailable->addChild(sItem);
 		}
 	}
 
+	treeAvailableSizes->resizeColumnToContents(0);
+	treeAvailableSizes->resizeColumnToContents(1);
+	treeActiveSizes->resizeColumnToContents(0);
+	treeActiveSizes->resizeColumnToContents(1);
 }
 
 void Prefs_PageSizes::saveGuiToPrefs(struct ApplicationPrefs *prefsData) const
@@ -131,7 +124,7 @@ void Prefs_PageSizes::saveGuiToPrefs(struct ApplicationPrefs *prefsData) const
 
 	for (int i = 0; i < treeActiveSizes->topLevelItemCount(); ++i)
 	{
-		QTreeWidgetItem* item = treeActiveSizes->takeTopLevelItem(i);
+		QTreeWidgetItem* item = treeActiveSizes->topLevelItem(i);
 
 		for (int j = 0; j < item->childCount(); ++j)
 			newActivePageSizes << item->child(j)->data(0, Qt::UserRole).toString();
diff --git a/scribus/ui/preferences/prefs_pdfexport.cpp b/scribus/ui/preferences/prefs_pdfexport.cpp
index 8f142d2d4..00f6314dd 100644
--- a/scribus/ui/preferences/prefs_pdfexport.cpp
+++ b/scribus/ui/preferences/prefs_pdfexport.cpp
@@ -411,13 +411,12 @@ void Prefs_PDFExport::restoreDefaults(struct ApplicationPrefs *prefsData, const
 	}
 	convertSpotsToProcessCheckBox->setChecked(!prefsData->pdfPrefs.UseSpotColors);
 
-	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);
+	bleedsWidget->setup(prefsData->pdfPrefs.bleeds, prefsData->docSetupPrefs.pagePositioning, prefsData->docSetupPrefs.docUnitIndex, NewMarginWidget::BleedWidgetFlags);
+	bleedsWidget->setPageWidth(prefsData->docSetupPrefs.pageWidth);
+	bleedsWidget->setPageHeight(prefsData->docSetupPrefs.pageHeight);
+	bleedsWidget->setMarginPreset(prefsData->docSetupPrefs.marginPreset);
+//
+	useCustomRenderingCheckBox->setChecked(prefsData->pdfPrefs.UseLPI);
 	customRenderingColorComboBox->clear();
 	for (auto itlp = prefsData->pdfPrefs.LPISettings.begin(); itlp != prefsData->pdfPrefs.LPISettings.end(); ++itlp)
 		customRenderingColorComboBox->addItem( itlp.key() );
diff --git a/scribus/ui/widgets/pagesizelist.cpp b/scribus/ui/widgets/pagesizelist.cpp
index cf40f7102..ed84a7942 100644
--- a/scribus/ui/widgets/pagesizelist.cpp
+++ b/scribus/ui/widgets/pagesizelist.cpp
@@ -7,9 +7,9 @@ for which a new license (GPL+exception) is in place.
 #include <QApplication>
 #include <QPainter>
 
-#include "pagesize.h"
 #include "pagesizelist.h"
 #include "prefsmanager.h"
+#include "manager/pagepreset_manager.h"
 #include "ui/delegates/sclistitemdelegate.h"
 
 
@@ -37,25 +37,28 @@ PageSizeList::PageSizeList(QWidget* parent) :
 #endif
 	setItemDelegate(new ScListItemDelegate(QListWidget::IconMode, iconSize()));
 	setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
+	setContextMenuPolicy(Qt::CustomContextMenu);
+
+	connect(this, &QListView::customContextMenuRequested, this, &PageSizeList::showContextMenu);
 }
 
-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)
+void PageSizeList::setCategory(const QString& category)
 {
-	loadPageSizes(m_name, m_orientation, category);
+	loadPageSizes(m_dimensions, m_orientation, category);
 	m_category = category;
 	setSortMode(m_sortMode);
 }
@@ -87,21 +90,23 @@ void PageSizeList::setSortMode(SortMode sortMode)
 	}
 }
 
-void PageSizeList::setValues(QString format, int orientation, PageSizeInfo::Category category, SortMode sortMode)
+void PageSizeList::setValues(QSizeF dimensions, int orientation, const QString& 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, const QString& category)
 {
 	QSignalBlocker sig(this);
 
-	PageSize ps(name);
-	PageSize pref(PrefsManager::instance().appPrefs.docSetupPrefs.pageSize);
+	auto &ppm = PagePresetManager::instance();
+
+	PageSizeInfo pref = ppm.pageInfoByDimensions(PrefsManager::instance().appPrefs.docSetupPrefs.pageWidth, PrefsManager::instance().appPrefs.docSetupPrefs.pageHeight);
+	PageSizeInfo ps = ppm.pageInfoByDimensions(dimensions.width(), dimensions.height());
 
 	int sel = -1;
 
@@ -109,35 +114,65 @@ 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();
 
-	foreach (auto item, ps.pageSizes())
+	PageCollectionInfo pciPreferred = ppm.categoryInfoPreferred();
+
+	foreach (auto item, ppm.pageSizes())
 	{
 		QSize size;
 		size.setWidth(orientation == 0 ? item.width : item.height);
 		size.setHeight(orientation == 0 ? item.height : item.width);
 
 		// Add items of selected category or all preferred and defaults
-		if (item.category == category ||
-				(category == PageSizeInfo::Preferred && ps.activePageSizes().contains(item.sizeName)) ||
-				(category == PageSizeInfo::Preferred && item.sizeName == pref.name()))
+		if (item.categoryId == category ||
+				(category == pciPreferred.id && ppm.activePageSizes().contains(item.id)) ||
+				(category == pciPreferred.id && item.id == pref.id))
 		{
+			QList<double> margins;
+			margins.append(item.margins.isNull());
+			margins.append(item.margins.top());
+			margins.append(item.margins.left());
+			margins.append(item.margins.bottom());
+			margins.append(item.margins.right());
+
+			QList<double> bleeds;
+			bleeds.append(item.bleeds.isNull());
+			bleeds.append(item.bleeds.top());
+			bleeds.append(item.bleeds.left());
+			bleeds.append(item.bleeds.bottom());
+			bleeds.append(item.bleeds.right());
+
 			QStandardItem* itemA = new QStandardItem();
-			itemA->setText(item.trSizeName);
+			itemA->setText(item.displayName);
 			itemA->setEditable(false);
-			itemA->setIcon(sizePreview(this->iconSize(), size));
-			itemA->setData(QVariant(item.sizeLabel), ItemData::SizeLabel);
+			itemA->setIcon(sizePreview(this->iconSize(), size, margins));
+			itemA->setData(QVariant(item.label), ItemData::SizeLabel);
 			itemA->setData(QVariant(item.pageUnitIndex), ItemData::Unit);
-			itemA->setData(QVariant(item.category), ItemData::Category);
-			itemA->setData(QVariant(item.sizeName), ItemData::Name);
+			itemA->setData(QVariant(item.categoryId), ItemData::Category);
+			itemA->setData(QVariant(item.id), ItemData::ID);
 			itemA->setData(QVariant(item.width * item.height), ItemData::Dimension);
+			itemA->setData(QVariant(item.width), ItemData::Width);
+			itemA->setData(QVariant(item.height), ItemData::Height);
+			itemA->setData(QVariant(item.type), ItemData::Type);
+			itemA->setData(QVariant(item.displayName), ItemData::Name);
+			itemA->setData(QVariant(item.marginPreset), ItemData::MarginPreset);
+			itemA->setData(QVariant::fromValue(margins), ItemData::Margins);
+			itemA->setData(QVariant::fromValue(bleeds), ItemData::Bleeds);
+			itemA->setData(QVariant(item.layout), ItemData::Layout);
+			itemA->setData(QVariant(item.firstPage), ItemData::FirstPage);
+			itemA->setData(QVariant::fromValue(item.textFrame), ItemData::TextFrame);
+
 			m_model->appendRow(itemA);
 
-			if (sel == -1 && item.sizeName == ps.name())
+			// select item with name match OR equal size
+			if (sel == -1 && (item.id == ps.id || (item.width == ps.width && item.height == ps.height)))
 				sel = itemA->row();
+
 		}
 	}
 
@@ -151,7 +186,7 @@ void PageSizeList::updateGeometries()
 	verticalScrollBar()->setSingleStep(10);
 }
 
-QIcon PageSizeList::sizePreview(QSize iconSize, QSize pageSize) const
+QIcon PageSizeList::sizePreview(QSize iconSize, QSize pageSize, QList<double> dataMargins) const
 {
 	double devicePixelRatio = qApp->devicePixelRatio();
 	double max = mm2pts(500 * devicePixelRatio); // reference for scale: large side of B3
@@ -193,7 +228,71 @@ QIcon PageSizeList::sizePreview(QSize iconSize, QSize pageSize) const
 	painter.setPen(QPen(palette().text().color()));
 	painter.setBrush(m_gradient);
 	painter.drawRect(page.adjusted(0, 0, -1, -1));
+
+	if (!QVariant(dataMargins.at(0)).toBool())
+	{
+
+		int t = ceil(dataMargins.at(1) / height * devicePixelRatio);
+		int l = ceil(dataMargins.at(2) / width * devicePixelRatio);
+		int b = ceil(dataMargins.at(3) / height * devicePixelRatio);
+		int r = ceil(dataMargins.at(4) / width * devicePixelRatio);
+
+		QColor colMargin = PrefsManager::instance().appPrefs.guidesPrefs.marginColor;
+		painter.setPen(colMargin);
+		painter.setBrush(Qt::NoBrush);
+		painter.drawRect(page.adjusted(l, t, -r - 1, -b - 1));
+	}
+
 	painter.end();
 
 	return QIcon(pix);
 }
+
+void PageSizeList::showContextMenu(const QPoint &pos)
+{
+	QModelIndex index = indexAt(pos);
+
+	if (!index.isValid())
+		return;
+
+	m_modelIndex = index;
+
+	int itemType = index.data(ItemData::Type).toInt();
+
+	QMenu contextMenu(this);
+	QAction *deleteAction = contextMenu.addAction(tr("Delete Preset"));
+
+	if (itemType == PageSizeType::User)
+		deleteAction->setEnabled(true);
+	else
+	{
+		deleteAction->setEnabled(false);
+		deleteAction->setToolTip("This preset cannot be deleted");
+	}
+
+	connect(deleteAction, &QAction::triggered, this, &PageSizeList::deleteItem);
+
+	contextMenu.exec(mapToGlobal(pos));
+}
+
+void PageSizeList::deleteItem()
+{
+	if (m_modelIndex.isValid())
+	{
+		QString categoryId = m_modelIndex.data(PageSizeList::Category).toString();
+		QString pageId = m_modelIndex.data(PageSizeList::ID).toString();
+		PageCollectionInfo pci = PagePresetManager::instance().categoryInfoById(categoryId);
+
+		PagePresetManager::instance().removeCollectionPage(pci.filePath, pageId);
+		model()->removeRow(m_modelIndex.row());
+
+		bool isEmpty = PagePresetManager::instance().isCollectionsEmpty(pci.filePath);
+		if (isEmpty)
+			PagePresetManager::instance().removeCollection(pci.filePath);
+
+		PagePresetManager::instance().reloadAllPresets();
+
+		if (isEmpty)
+			emit changedCategories();
+	}
+}
diff --git a/scribus/ui/widgets/pagesizelist.h b/scribus/ui/widgets/pagesizelist.h
index 8f2bd8b7a..9e91ab2e2 100644
--- a/scribus/ui/widgets/pagesizelist.h
+++ b/scribus/ui/widgets/pagesizelist.h
@@ -11,7 +11,6 @@ for which a new license (GPL+exception) is in place.
 #include <QScrollBar>
 #include <QStandardItemModel>
 
-#include "pagesize.h"
 #include "scribusapi.h"
 
 class SCRIBUS_API PageSizeList : public QListView
@@ -20,49 +19,69 @@ class SCRIBUS_API PageSizeList : public QListView
 
 public:
 
-	enum SortMode {
+	enum SortMode
+	{
 		NameAsc = 0,
 		NameDesc = 1,
 		DimensionAsc = 2,
 		DimensionDesc = 3
 	};
 
-	enum ItemData {
+	enum ItemData
+	{
 		SizeLabel = Qt::UserRole,
-		Unit = Qt::UserRole + 1,
-		Category = Qt::UserRole + 2,
-		Name = Qt::UserRole + 3,
-		Dimension = Qt::UserRole + 4,
+		Type = Qt::UserRole + 1,
+		Unit = Qt::UserRole + 2,
+		Category = Qt::UserRole + 3,
+		ID = Qt::UserRole + 4,
+		Dimension = Qt::UserRole + 5,
+		Width = Qt::UserRole + 6,
+		Height = Qt::UserRole + 7,
+		Name = Qt::UserRole + 8,
+		MarginPreset = Qt::UserRole + 9,
+		Margins = Qt::UserRole + 10,
+		Bleeds = Qt::UserRole + 11,
+		Layout = Qt::UserRole + 12,
+		FirstPage = Qt::UserRole + 13,
+		TextFrame = Qt::UserRole + 14
 	};
 
 	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; };
 
-	void setCategory(PageSizeInfo::Category category);
-	PageSizeInfo::Category category() const { return m_category; };
+	void setCategory(const QString& category);
+	const QString& category() const { return m_category; };
 
 	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, const QString& category, SortMode sortMode);
 
 	void updateGeometries() override;
 
+private slots:
+
+	void showContextMenu(const QPoint &pos);
+	void deleteItem();
+
 private:
-	QString m_name {PageSize::defaultSizesList().at(1)};
+	QSizeF m_dimensions;
 	int m_orientation {0};
-	PageSizeInfo::Category m_category {PageSizeInfo::Preferred};
+	QString m_category;
 	SortMode m_sortMode {SortMode::NameAsc};
 	QStandardItemModel* m_model { nullptr };
+	QModelIndex m_modelIndex;
+
+	QIcon sizePreview(QSize iconSize, QSize pageSize, QList<double> dataMargins) const;
+	void loadPageSizes(QSizeF dimensions, int orientation, const QString& category);
 
-	QIcon sizePreview(QSize iconSize, QSize pageSize) const;
-	void loadPageSizes(QString name, int orientation, PageSizeInfo::Category category);
+signals:
+	void changedCategories();
 };
 
 
diff --git a/scribus/ui/widgets/pagesizepreview.cpp b/scribus/ui/widgets/pagesizepreview.cpp
index ab0f86682..72b31bb62 100644
--- a/scribus/ui/widgets/pagesizepreview.cpp
+++ b/scribus/ui/widgets/pagesizepreview.cpp
@@ -41,32 +41,32 @@ void PageSizePreview::paintEvent(QPaintEvent *event)
 		// Left Page
 		if (i == 0 && count > 1)
 		{
-			rMargin.setLeft(rPage.left() + m_margins.right() * ratio);
-			rMargin.setRight(rPage.right() - m_margins.left() * ratio);
-			rBleed.setLeft(rPage.left() - m_bleeds.left() * ratio);
+			rMargin.setLeft(rPage.left() + ceil(m_margins.right() * ratio));
+			rMargin.setRight(rPage.right() - ceil(m_margins.left() * ratio));
+			rBleed.setLeft(rPage.left() - ceil(m_bleeds.left() * ratio));
 			rBleed.setRight(rPage.right());
 		}
 		// Right Page
 		else if (i == 1 && count > 1)
 		{
-			rMargin.setLeft(rPage.left() + m_margins.left() * ratio);
-			rMargin.setRight(rPage.right() - m_margins.right() * ratio);
+			rMargin.setLeft(rPage.left() + ceil(m_margins.left() * ratio));
+			rMargin.setRight(rPage.right() - ceil(m_margins.right() * ratio));
 			rBleed.setLeft(rPage.left());
-			rBleed.setRight(rPage.right() + m_bleeds.right() * ratio);
+			rBleed.setRight(rPage.right() + ceil(m_bleeds.right() * ratio));
 		}
 		// Single Page
 		else
 		{
-			rMargin.setLeft(rPage.left() + m_margins.left() * ratio);
-			rMargin.setRight(rPage.right() - m_margins.right() * ratio);
-			rBleed.setLeft(rPage.left() - m_bleeds.left() * ratio);
-			rBleed.setRight(rPage.right() + m_bleeds.right() * ratio);
+			rMargin.setLeft(rPage.left() + ceil(m_margins.left() * ratio));
+			rMargin.setRight(rPage.right() - ceil(m_margins.right() * ratio));
+			rBleed.setLeft(rPage.left() - ceil(m_bleeds.left() * ratio));
+			rBleed.setRight(rPage.right() + ceil(m_bleeds.right() * ratio));
 		}
 
-		rMargin.setTop(rPage.top() + m_margins.top() * ratio);
-		rMargin.setBottom(rPage.bottom() - m_margins.bottom() * ratio);
-		rBleed.setTop(rPage.top() - m_bleeds.top() * ratio);
-		rBleed.setBottom(rPage.bottom() + m_bleeds.bottom() * ratio);
+		rMargin.setTop(rPage.top() + ceil(m_margins.top() * ratio));
+		rMargin.setBottom(rPage.bottom() - ceil(m_margins.bottom() * ratio));
+		rBleed.setTop(rPage.top() - ceil(m_bleeds.top() * ratio));
+		rBleed.setBottom(rPage.bottom() + ceil(m_bleeds.bottom() * ratio));
 
 		// Draw Bleeds
 		painter.setBrush( colPage );
diff --git a/scribus/ui/widgets/pagesizepreview.h b/scribus/ui/widgets/pagesizepreview.h
index 665f39df0..7fcbb19a4 100644
--- a/scribus/ui/widgets/pagesizepreview.h
+++ b/scribus/ui/widgets/pagesizepreview.h
@@ -4,7 +4,7 @@
 #include <QWidget>
 
 #include "margins.h"
-#include "pagesize.h"
+#include "manager/pagepreset_manager.h"
 
 class PageSizePreview : public QWidget
 {
@@ -13,26 +13,27 @@ class PageSizePreview : public QWidget
 public:
 	explicit PageSizePreview(QWidget *parent = nullptr);
 
-	void setPageHeight(double height) { m_height = height; update(); };
+	void setPageHeight(double height)
+	{
+		PageSizeInfo psi = PagePresetManager::instance().pageInfoByDimensions(QSizeF(m_width, height));
+		m_name = psi.displayName;
+		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);
-		m_name = ps.nameTR();
-		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);
+		PageSizeInfo psi = PagePresetManager::instance().pageInfoByDimensions(QSizeF(width, height));
 
 		m_height = height;
 		m_width = width;
 		m_margins = margins;
 		m_bleeds = bleeds;
-		m_name = ps.nameTR();
+		m_name = psi.displayName;
 		m_layout = layout;
 		m_firstPage = firstPage;
 		update();
diff --git a/scribus/ui/widgets/pagesizeselector.cpp b/scribus/ui/widgets/pagesizeselector.cpp
index 5ca25c57f..1cddfc849 100644
--- a/scribus/ui/widgets/pagesizeselector.cpp
+++ b/scribus/ui/widgets/pagesizeselector.cpp
@@ -17,8 +17,6 @@ for which a new license (GPL+exception) is in place.
 #include <QVBoxLayout>
 
 #include "pagesizeselector.h"
-#include "pagesize.h"
-#include "commonstrings.h"
 
 PageSizeSelector::PageSizeSelector(QWidget *parent)
 	: QWidget{parent}
@@ -49,23 +47,21 @@ 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)
+void PageSizeSelector::setCurrentCategory(const QString &categoryId)
 {
-	int index = comboCategory->findData(category);
+	int index = comboCategory->findData(categoryId);
 	if (index != -1)
 		comboCategory->setCurrentIndex(index);
 }
 
-void PageSizeSelector::setPageSize(QString name)
+void PageSizeSelector::setup(PageSizeInfo psi)
 {
-	PageSize ps(name);
-
-	m_sizeName = ps.name();
-	m_sizeCategory = ps.category();
-	m_trSizeName = ps.nameTR();
+	m_sizeName = psi.id;
+	m_sizeCategory = psi.categoryId;
+	m_trSizeName = psi.displayName;
 
 	// Load category list
 	int index = -1;
@@ -75,34 +71,48 @@ void PageSizeSelector::setPageSize(QString name)
 	// Add Custom
 	if (hasCustom())
 	{
-		comboCategory->addItem(CommonStrings::trCustomPageSize, PageSizeInfo::Custom);
-		if (m_sizeName == CommonStrings::customPageSize || m_sizeName == CommonStrings::trCustomPageSize)
+		PageCollectionInfo pciCustom = PagePresetManager::instance().categoryInfoCustom();
+		comboCategory->addItem(pciCustom.displayName, pciCustom.id);
+		if (m_sizeName == pciCustom.id || m_sizeName == pciCustom.displayName)
 			index = comboCategory->count() - 1;
 	}
 
 	// Add Preferred
-	comboCategory->addItem(ps.categoryToString(PageSizeInfo::Preferred), PageSizeInfo::Preferred);
+	PageCollectionInfo pciPreferred = PagePresetManager::instance().categoryInfoPreferred();
+	comboCategory->addItem(pciPreferred.displayName, pciPreferred.id);
+	comboCategory->insertSeparator(comboCategory->count());
 
 	// Add all available categories
-	PageSizeCategoriesMap categories = ps.categories();
-	for (auto it = categories.begin(); it != categories.end(); ++it)
+	QList<QString> orderList = PagePresetManager::instance().categoriesOrder();
+	for (int i = 0; i < orderList.size(); i++)
 	{
-		comboCategory->addItem(it.value(), it.key());
-		if (it.key() == m_sizeCategory)
-			index = comboCategory->count() - 1;			
+		QString item = orderList.at(i);
+		if (item == "-")
+			comboCategory->insertSeparator(comboCategory->count());
+		else
+		{
+			PageCollectionInfo pci = PagePresetManager::instance().categoryInfoById(item);
+			comboCategory->addItem(pci.displayName, pci.id);
+			if (pci.id == m_sizeCategory)
+				index = comboCategory->count() - 1;
+		}
+
 	}
 
 	comboCategory->setCurrentIndex(index);
-	comboCategory->insertSeparator(comboCategory->findData(PageSizeInfo::Preferred) + 1);
-	comboCategory->insertSeparator(comboCategory->findData(PageSizeInfo::IsoEnvelope) + 1);
-	comboCategory->insertSeparator(comboCategory->findData(PageSizeInfo::USEnvelope) + 1);
-	comboCategory->insertSeparator(comboCategory->findData(PageSizeInfo::Other) + 1);
 
 	// Load size format list
 	setFormat(m_sizeCategory, m_sizeName);
 }
 
-void PageSizeSelector::setFormat(PageSizeInfo::Category category, QString name)
+void PageSizeSelector::setPageSize(double width, double height)
+{
+	m_size = QSizeF(width, height);
+	PageSizeInfo psi = PagePresetManager::instance().pageInfoByDimensions(m_size);
+	setup(psi);
+}
+
+void PageSizeSelector::setFormat(const QString& categoryId, QString name)
 {
 	if (!hasFormatSelector())
 		return;
@@ -110,11 +120,13 @@ void PageSizeSelector::setFormat(PageSizeInfo::Category category, QString name)
 	QSignalBlocker sigFormat(comboFormat);
 	comboFormat->clear();
 
-	if (category == PageSizeInfo::Custom)
+	PageCollectionInfo pciCustom = PagePresetManager::instance().categoryInfoCustom();
+
+	if (categoryId == pciCustom.id)
 	{
 		comboFormat->setEnabled(false);
-		m_sizeName = CommonStrings::customPageSize;
-		m_trSizeName = CommonStrings::trCustomPageSize;
+		m_sizeName = pciCustom.id;
+		m_trSizeName = pciCustom.displayName;
 		return;
 	}
 	else
@@ -122,14 +134,15 @@ void PageSizeSelector::setFormat(PageSizeInfo::Category category, QString name)
 		comboFormat->setEnabled(true);
 	}
 
-	PageSize ps(name);
+	// PageSize ps(name);
+	PageCollectionInfo pciPreferred = PagePresetManager::instance().categoryInfoPreferred();
 	int index = -1;
-	for (const auto &item : ps.pageSizes())
+	for (const auto &item : PagePresetManager::instance().pageSizes())
 	{
-		if (item.category == category || (category == PageSizeInfo::Preferred && ps.activePageSizes().contains(item.sizeName)))
+		if (item.categoryId == categoryId || (categoryId == pciPreferred.id && PagePresetManager::instance().activePageSizes().contains(item.id)))
 		{
-			comboFormat->addItem(item.trSizeName, item.sizeName);
-			if (item.sizeName == name)
+			comboFormat->addItem(item.displayName, item.id);
+			if (item.id == name)
 				index = comboFormat->count() - 1;
 		}
 	}
@@ -145,7 +158,7 @@ void PageSizeSelector::setFormat(PageSizeInfo::Category category, QString name)
 
 void PageSizeSelector::categorySelected(int index)
 {
-	m_sizeCategory = static_cast<PageSizeInfo::Category>(comboCategory->itemData(index).toInt());
+	m_sizeCategory = comboCategory->itemData(index).toString();
 
 	setFormat(m_sizeCategory, m_sizeName);
 	emit pageCategoryChanged(m_sizeCategory);
diff --git a/scribus/ui/widgets/pagesizeselector.h b/scribus/ui/widgets/pagesizeselector.h
index 8c9b99624..f527cfbc2 100644
--- a/scribus/ui/widgets/pagesizeselector.h
+++ b/scribus/ui/widgets/pagesizeselector.h
@@ -20,7 +20,7 @@ for which a new license (GPL+exception) is in place.
 #include <QComboBox>
 #include <QWidget>
 
-#include "pagesize.h"
+#include "manager/pagepreset_manager.h"
 
 class PageSizeSelector : public QWidget
 {
@@ -29,14 +29,14 @@ 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; };
 	bool hasFormatSelector() const { return m_hasFormatSelector; };
-	void setCurrentCategory(PageSizeInfo::Category category);
+	void setCurrentCategory(const QString& categoryId);
 
-	PageSizeInfo::Category category() const { return m_sizeCategory; };
+	const QString& category() const { return m_sizeCategory; };
 	QString pageSize() const { return m_sizeName; };
 	QString pageSizeTR() const { return m_trSizeName; };
 
@@ -46,15 +46,17 @@ private:
 
 	QString m_sizeName;
 	QString m_trSizeName;
-	PageSizeInfo::Category m_sizeCategory;
+	QSizeF m_size;
+	QString m_sizeCategory;
 	bool m_hasFormatSelector {true};
 	bool m_hasCustom {true};
 
-	void setFormat(PageSizeInfo::Category category, QString name);
+	void setup(PageSizeInfo psi);
+	void setFormat(const QString& category, QString name);
 
 signals:
 	void pageSizeChanged(QString);
-	void pageCategoryChanged(PageSizeInfo::Category);
+	void pageCategoryChanged(QString);
 
 private slots:
 	void categorySelected(int index);
diff --git a/scribus/util.cpp b/scribus/util.cpp
index 5291c4b16..818115b6f 100644
--- a/scribus/util.cpp
+++ b/scribus/util.cpp
@@ -1356,3 +1356,65 @@ bool inRange(unsigned min, unsigned value, unsigned max)
 {
 	return (min <= value && value <= max);
 }
+
+static const char* BASE62_ALPHABET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
+
+QString getShortUuidFromUuid(const QUuid& uuid)
+{
+	if (uuid.isNull())
+		return QString();
+
+	int length = 62;
+	QByteArray bytes = uuid.toRfc4122();
+	QByteArray result;
+	result.reserve(22);
+
+	bool isZero = false;
+	while (!isZero)
+	{
+		int remainder = 0;
+		isZero = true;
+
+		for (int i = 0; i < 16; ++i)
+		{
+			int val = ((unsigned char) bytes[i]) + (remainder << 8);
+
+			bytes[i] = val / length;
+			remainder = val % length;
+
+			if (bytes[i] != 0)
+				isZero = false;
+		}
+		result.append(BASE62_ALPHABET[remainder]);
+	}
+
+	std::reverse(result.begin(), result.end());
+	return QString::fromLatin1(result);
+}
+
+QUuid getUuidFromShortUuid(const QString& shortId)
+{
+	if (shortId.isEmpty())
+		return QUuid();
+
+	QByteArray bytes(16, 0);
+	int length = 62;
+
+	for (const QChar& c : shortId)
+	{
+		const char* p = strchr(BASE62_ALPHABET, c.toLatin1());
+		if (!p)
+			return QUuid();
+		int value = p - BASE62_ALPHABET;
+
+		int carry = value;
+		for (int i = 15; i >= 0; --i)
+		{
+			int val = ((unsigned char) bytes[i] * length) + carry;
+			bytes[i] = val & 0xFF;
+			carry = val >> 8;
+		}
+	}
+
+	return QUuid::fromRfc4122(bytes);
+}
diff --git a/scribus/util.h b/scribus/util.h
index 9f74b9c05..febf32db8 100644
--- a/scribus/util.h
+++ b/scribus/util.h
@@ -40,11 +40,6 @@ class  ScribusView;
 */
 QString cleanupLang(const QString& lang);
 
-/*! \brief Compare double values by pre-multiplying by 10000 and converting to long if possible.
-If premultiplication does not allow to store result in a long value, perform a standard comparison.
-*/
-bool SCRIBUS_API compareDouble(double a, double b);
-
 /*! \brief Returns a sorted list of QStrings - sorted by locale specific rules!
 Uses compareQStrings() as rule. There is STL used!
 \author Petr Vanek
@@ -212,4 +207,8 @@ void SCRIBUS_API getUniqueName(QString &name, const QStringList& list, const QSt
  */
 bool SCRIBUS_API inRange(unsigned min, unsigned value, unsigned max);
 
+
+QString SCRIBUS_API getShortUuidFromUuid(const QUuid &uuid);
+QUuid SCRIBUS_API getUuidFromShortUuid(const QString &shortId);
+
 #endif
pagepresets_2026-01-03_02.diff (313,128 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
2025-10-19 15:46 ale Relationship added related to 0017650
2025-10-21 20:14 cbradney Note Added: 0053097
2025-10-21 20:14 cbradney File Added: 17652_patchupdate.diff
2026-01-03 15:43 nitramr Note Added: 0053411
2026-01-03 15:43 nitramr File Added: user_page_preset.png
2026-01-03 15:43 nitramr File Added: pagepresets_2026-01-03_01.diff
2026-01-03 21:21 nitramr Note Added: 0053412
2026-01-03 21:21 nitramr File Added: pagepresets_2026-01-03_02.diff
2026-01-03 21:21 nitramr File Deleted: pagepresets_2026-01-03_01.diff