Index: scribus/ui/pdfopts.cpp
===================================================================
--- scribus/ui/pdfopts.cpp	(revision 18743)
+++ scribus/ui/pdfopts.cpp	(working copy)
@@ -151,6 +151,24 @@
 
 void PDFExportDialog::DoExport()
 {
+    //starts here: checking validity of pagerangestring
+    if(Options->AllPages->isChecked()==0)
+    {
+    	QString pageRangeStringtoCheck=Options->PageNr->text();
+	  
+	    bool invalidPageRangeString=checkPageRangeStringValidity(pageRangeStringtoCheck,m_doc->Pages->count());
+	    if (invalidPageRangeString )//showing warning box if invalid pagerangestring
+	    {
+
+	        QMessageBox::warning(this,
+	                             CommonStrings::trWarning,
+	                             tr("Invalid pagerangeString: \n"),
+	                             CommonStrings::tr_OK);
+	        return;
+	    }
+	}
+    //ends here: checking validity of pagerangestring
+
 	bool createPath = false;
 	QString fn = QDir::fromNativeSeparators(fileNameLineEdit->text());
 	// Checking if the path exists
@@ -198,13 +216,149 @@
 		m_presEffects[Options->PgSel].Di = Options->EDirection_2_2->currentIndex();
 		m_opts.LPISettings[Options->SelLPIcolor].Frequency = Options->LPIfreq->value();
 		m_opts.LPISettings[Options->SelLPIcolor].Angle = Options->LPIangle->value();
-		m_opts.LPISettings[Options->SelLPIcolor].SpotFunc = Options->LPIfunc->currentIndex();
-		accept();
+        m_opts.LPISettings[Options->SelLPIcolor].SpotFunc = Options->LPIfunc->currentIndex();
+        accept();
 	}
-	else
+	else{
 		return;
+	}
 }
+bool PDFExportDialog::checkPageRangeStringValidity(QString pagerangestringtocheck,int sourcePageCount ){
+    QString tmp(pagerangestringtocheck);
+        QString token;
+        int from, to, pageNr;
+        do
+        {
 
+            if (tmp.indexOf(",") == -1)
+            {
+
+                token = tmp;
+                tmp = "";
+            }
+            else
+            {
+                token = tmp.left(tmp.indexOf(","));
+                tmp = tmp.right(tmp.length() - tmp.indexOf(",") - 1);
+            }
+
+            token = token.trimmed();
+            //start:
+            if(token.isEmpty()){
+                //error
+                return true;//for null string
+            }
+            //end:
+            if (token == "*") // Import all source doc pages
+            {
+
+            }
+            else if (token.indexOf("-") != -1) // import a range of source doc pages
+            {
+                //start:
+                //here strings 'from' and 'to' can only contain numeric characters and single dot
+                //also they must be in rage 1 to max doc pages
+                QString fromstring=QString(token.left(token.indexOf("-")));
+                fromstring=fromstring.trimmed();
+                QString tostring=QString(token.right(token.length() - token.indexOf("-") - 1));
+                tostring=tostring.trimmed();
+                int k;
+                int dotcount=0;
+                if(fromstring.isEmpty()){
+                    //error
+                    return true;
+                }
+                for(k=0;k<fromstring.size();k++){
+                   if(fromstring.at(k)=='.'){
+                       dotcount++;
+                   }
+                   else if((48<=fromstring.at(k))&&(fromstring.at(k)<=57)){
+                       //fine
+
+                   }
+                   else
+                       return true;//error
+
+                }
+                if(dotcount>1){
+                    return true;//error
+                }
+                dotcount=0;
+                if(tostring.isEmpty()){
+                    //error
+                    return true;
+                }
+                for(k=0;k<tostring.size();k++){
+                    if(tostring.at(k)=='.'){
+                        dotcount++;
+                    }
+                    else if((48<=tostring.at(k))&&(tostring.at(k)<=57)){
+                        //fine
+
+                    }
+                    else
+                        return true;//error
+
+                }
+                if(dotcount>1){
+                    return true;//error
+                }
+                //end:
+                from = QString(token.left(token.indexOf("-"))).toInt();
+                to = QString(token.right(token.length() - token.indexOf("-") - 1)).toInt();
+                //also they must be in rage 1 to max doc pages
+                //start : comparing with pages doc contain
+                if((from<=sourcePageCount)&&(1<=from)){
+
+                    //input page number is within range
+                }
+                else{
+
+                    return true; //out of range option
+                }
+                if((to<=sourcePageCount)&&(1<=to)){
+
+                    //input page number is within range
+                }
+                else{
+
+                    return true; //out of range option
+                }
+                //end : comparing with pages doc contain
+            }
+            else // import single source doc page
+            {
+                //start:
+                QString pageNrString=token;
+                int k;
+                int dotcount=0;
+                for(k=0;k<pageNrString.size();k++){
+                   if(pageNrString.at(k)=='.'){
+                       dotcount++;
+                   }
+                   else if((48<=pageNrString.at(k))&&(pageNrString.at(k)<=57)){
+                       //fine
+
+                   }
+                   else
+                       return true;//error
+
+                }
+                if(dotcount>1){
+                    return true;//error
+                }
+                //end:
+                pageNr = token.toInt();
+                if ((pageNr > 0) && (pageNr <= sourcePageCount)){
+
+                }
+                else{
+                    return true;//error
+                }
+            }
+        } while (!tmp.isEmpty());
+    return false;
+}
 void PDFExportDialog::ChangeFile()
 {
 	QString fn;
@@ -231,6 +385,8 @@
 	fileNameLineEdit->setText( QDir::toNativeSeparators(fileName) );
 }
 
+
+
 void PDFExportDialog::updateDocOptions()
 {
 	m_opts.fileName = QDir::fromNativeSeparators(fileNameLineEdit->text());
Index: scribus/ui/pdfopts.h
===================================================================
--- scribus/ui/pdfopts.h	(revision 18743)
+++ scribus/ui/pdfopts.h	(working copy)
@@ -60,6 +60,7 @@
 	void fileNameChanged();
 	void enableSave();
 	void disableSave();
+    bool checkPageRangeStringValidity(QString pagerangestringtocheck,int sourcePageCount);
 
 protected:
 	// Widgets
