diff --git a/scribus/scribusdoc.cpp b/scribus/scribusdoc.cpp
index 1864f1152..f27c8c811 100644
--- a/scribus/scribusdoc.cpp
+++ b/scribus/scribusdoc.cpp
@@ -13775,8 +13775,6 @@ void ScribusDoc::createNewDocPages(int pageCount)
 
 void ScribusDoc::getClosestGuides(double xin, double yin, double *xout, double *yout, int *GxM, int *GyM, ScPage* refPage)
 {
-	*GxM = -1;
-	*GyM = -1;
 	ScPage* page = (refPage == nullptr) ? currentPage() : refPage;
 	QMap<double, uint> tmpGuidesSel;
 	Guides tmpGuides = page->guides.horizontals(GuideManagerCore::Standard);
@@ -13836,8 +13834,6 @@ void ScribusDoc::getClosestGuides(double xin, double yin, double *xout, double *
 
 void ScribusDoc::getClosestElementBorder(double xin, double yin, double *xout, double *yout, int *GxM, int *GyM, ScPage* refPage)
 {
-	*GxM = -1;
-	*GyM = -1;
 	ScPage* page = (refPage == nullptr) ? currentPage() : refPage;
 	QMap<double, uint> tmpGuidesSel;
 	double viewScale=m_View->scale();
@@ -13894,6 +13890,53 @@ void ScribusDoc::getClosestElementBorder(double xin, double yin, double *xout, d
 	}
 }
 
+void ScribusDoc::getClosestPageBoundaries(const double xin, const double yin, double &xout, double &yout, int &GxM, int &GyM, ScPage* refPage)
+{
+	ScPage* page = (refPage == nullptr) ? currentPage() : refPage;
+
+	const double snapDistance = m_docPrefsData.guidesPrefs.guideRad * 1/m_View->scale();
+	if (fabs(page->Margins.left() + page->xOffset() - xin) < snapDistance)
+	{
+		xout = page->Margins.left();
+		GxM = 1;
+	}
+	if (fabs((page->width() - page->Margins.right()) + page->xOffset() - xin) < snapDistance)
+	{
+		xout = page->width() - page->Margins.right();
+		GxM = 1;
+	}
+	if (fabs(page->width() + bleeds()->right() + page->xOffset() - xin) < snapDistance)
+	{
+		xout = page->width() + bleeds()->right();
+		GxM = 1;
+	}
+	if (fabs(page->xOffset() - bleeds()->left() - xin) < snapDistance)
+	{
+		xout = - bleeds()->left();
+		GxM = 1;
+	}
+	if (fabs(page->Margins.top() + page->yOffset() - yin) < snapDistance)
+	{
+		yout = page->Margins.top();
+		GyM = 1;
+	}
+	if (fabs((page->height() - page->Margins.bottom())+page->yOffset() - yin) < snapDistance)
+	{
+		yout = page->height() - page->Margins.bottom();
+		GyM = 1;
+	}
+	if (fabs(page->height() + bleeds()->bottom() + page->yOffset() - yin) < snapDistance)
+	{
+		yout = page->height() + bleeds()->bottom();
+		GyM = 1;
+	}
+	if (fabs(page->yOffset() - bleeds()->top() - yin) < snapDistance)
+	{
+		yout = - bleeds()->top();
+		GyM = 1;
+	}
+}
+
 void ScribusDoc::SnapToGuides(PageItem *currItem)
 {
 	int pg = OnPage(currItem);
@@ -13948,23 +13991,24 @@ void ScribusDoc::SnapToGuides(PageItem *currItem)
 
 bool ScribusDoc::ApplyGuides(double *x, double *y, bool elementSnap)
 {
-//	m_SnapCounter++;
 	bool ret = false;
 	double xout, yout;
 	int pg = OnPage(*x, *y);
 	if (pg == -1)
 		return ret;
 	ScPage* page = Pages->at(pg);
-	int GxM, GyM;
+	int GxM = -1, GyM = -1;
 
 	//	if ((SnapGuides) && (m_SnapCounter > 1))
 	if ((SnapGuides && !elementSnap) || (SnapElement && elementSnap))
 	{
-//		m_SnapCounter = 0;
 		if (!elementSnap)
 			getClosestGuides(*x, *y, &xout, &yout, &GxM, &GyM, page);
 		else
 			getClosestElementBorder(*x, *y, &xout, &yout, &GxM, &GyM, page);
+
+		getClosestPageBoundaries(*x, *y, xout, yout, GxM, GyM, page);
+
 		if (GxM != -1)
 		{
 			*x = xout+page->xOffset();
@@ -13975,50 +14019,7 @@ bool ScribusDoc::ApplyGuides(double *x, double *y, bool elementSnap)
 			*y = yout+page->yOffset();
 			ret = true;
 		}
-		double invViewScale=1/m_View->scale();
-		if (fabs(page->Margins.left() + page->xOffset() - *x) < (m_docPrefsData.guidesPrefs.guideRad * invViewScale))
-		{
-			*x = page->Margins.left()+page->xOffset();
-			ret = true;
-		}
-		if (fabs((page->width() - page->Margins.right()) + page->xOffset() - *x) < (m_docPrefsData.guidesPrefs.guideRad * invViewScale))
-		{
-			*x = page->width() - page->Margins.right()+page->xOffset();
-			ret = true;
-		}
-		if (fabs(page->width() + page->xOffset() - *x) < (m_docPrefsData.guidesPrefs.guideRad * invViewScale))
-		{
-			*x = page->width() + page->xOffset();
-			ret = true;
-		}
-		if (fabs(page->xOffset() - *x) < (m_docPrefsData.guidesPrefs.guideRad * invViewScale))
-		{
-			*x = page->xOffset();
-			ret = true;
-		}
-		if (fabs(page->Margins.top() + page->yOffset() - *y) < (m_docPrefsData.guidesPrefs.guideRad * invViewScale))
-		{
-			*y = page->Margins.top()+page->yOffset();
-			ret = true;
-		}
-		if (fabs((page->height() - page->Margins.bottom())+page->yOffset() - *y) < (m_docPrefsData.guidesPrefs.guideRad * invViewScale))
-		{
-			*y = page->height() - page->Margins.bottom()+page->yOffset();
-			ret = true;
-		}
-		if (fabs(page->height() + page->yOffset() - *y) < (m_docPrefsData.guidesPrefs.guideRad * invViewScale))
-		{
-			*y = page->height() + page->yOffset();
-			ret = true;
-		}
-		if (fabs(page->yOffset() - *y) < (m_docPrefsData.guidesPrefs.guideRad * invViewScale))
-		{
-			*y = page->yOffset();
-			ret = true;
-		}
 	}
-//	if (m_SnapCounter > 10)
-//		m_SnapCounter = 0;
 	return ret;
 }
 
diff --git a/scribus/scribusdoc.h b/scribus/scribusdoc.h
index 27b7d7a82..9160bd356 100644
--- a/scribus/scribusdoc.h
+++ b/scribus/scribusdoc.h
@@ -1171,6 +1171,8 @@ public:
 	void getClosestGuides(double xin, double yin, double *xout, double *yout, int *GxM, int *GyM, ScPage* refPage = nullptr);
 	//! \brief Get the closest border of another element to the given point
 	void getClosestElementBorder(double xin, double yin, double *xout, double *yout, int *GxM, int *GyM, ScPage* refPage = nullptr);
+	//! \brief Get the closest page margin or bleed
+	void getClosestPageBoundaries(const double xin, const double yin, double &xout, double &yout, int &GxM, int &GyM, ScPage* refPage);
 	//! \brief Snap an item to the guides
 	void SnapToGuides(PageItem *currItem);
 	bool ApplyGuides(double *x, double *y, bool elementSnap = false);
