Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Tue May 05, 2015 5:23 am

Code: Select all
private void ProcessPdf()
        {
            var doc = new PdfDocument();
           
            doc.LoadFromFile(_fileName.ToString());
            _totaPages = doc.Pages.Count;
            PreparePagesToPrint();
            var greaterCount = _pagesList.FirstOrDefault(i => i > _totaPages);
            if (greaterCount > 0)
            {
                MessageBox.Show("File does not contain pages that u have entered " + string.Join(",", _pagesList));
                return;
            }
            try
            {
                for (int pageid = 0; pageid < _pagesList.Count; pageid++)
                {
                    _pagesList[pageid] = _pagesList[pageid] - 1;
                }
                doc.Pages.ReArrange(_pagesList.ToArray());
               
            }
            catch (Exception)
            {

            }


            var dialogPrint = new PrintDialog
            {
                AllowPrintToFile = true,
                AllowSomePages = true,
                PrinterSettings = { MinimumPage = 1, MaximumPage = doc.Pages.Count }
            };
            dialogPrint.AllowSomePages = true;
            dialogPrint.PrinterSettings.FromPage = 1;
            dialogPrint.PrinterSettings.ToPage = doc.Pages.Count;
            doc.PrintFromPage = dialogPrint.PrinterSettings.FromPage;
            doc.PrintToPage = dialogPrint.PrinterSettings.ToPage;
            doc.PrinterName = Printers.SelectedItem.ToString();
            var printDoc = doc.PrintDocument;
            dialogPrint.Document = printDoc;     
         
            dialogPrint.Document.PrinterSettings.PrintToFile= true;
            dialogPrint.Document.Print();       
            doc.Dispose();
            printDoc.Dispose();
            dialogPrint.Dispose();

        }

kotesh
 
Posts: 1
Joined: Tue May 05, 2015 5:15 am

Tue May 05, 2015 9:02 am

Hello,

Thanks for your inquiry.
Please tell us the taking memory data on your side. and list the below information in your message, it will help us to reproduce your issue quickly and resolve it.

Dll file list (name + version)
for example:
Spire.Doc.dll v4.9.32.3040
Spire.License.dll v4.9.32.3040
Spire.Pdf.dll v2.8.86.3040

Operation System
for example:
Windows 7 Enterprise Edition SP1 x64
Regional and Language Options

Project can reproduce the issue
All code about this problem, a simple project which can reproduce this problem will be better.

Test Document or Test data
Please provide your test document to us if convenient, it may help us reproduce your issue quickly. We promise to keep your document confidential and we will not use it for any other purpose. Besides, you could also remove the security data of your document and then send it to us.

Sincerely,
Sweety

E-iceblue support team
User avatar

sweety1
 
Posts: 539
Joined: Wed Mar 11, 2015 1:14 am

Thu May 07, 2015 9:31 am

Hello,

Has your issue been resolved? Could you please give us some feedback at your convenience?

Sincerely,
Sweety

E-iceblue support team
User avatar

sweety1
 
Posts: 539
Joined: Wed Mar 11, 2015 1:14 am

Return to Spire.PDF