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.

Mon Jan 18, 2016 5:08 pm

Hello there,

I was just wondering whether and - if yes - how it is possible to set the Initial magnification level of a document to "Default" using Spire.PDF, as I have to format hundreds of PDF documents. I managed to set the other properties like PageLayout etc., however i did not find any documentation about magnification so far. Sorry to bother you in case I missed it.

Thanks in advance,
Crix

Crix
 
Posts: 4
Joined: Mon Jan 04, 2016 3:07 pm

Tue Jan 19, 2016 6:48 am

Hi Crix,

Thanks for your posting.
Please try the following solution.
Code: Select all
PdfDocument pdf = new PdfDocument();
            pdf.LoadFromFile("..\\..\\test.pdf");
            foreach (PdfPageBase page in pdf.Pages)
            {
                PdfDestination dest = new PdfDestination(page);
                dest.Location = new PointF(-40f, -40f);
                dest.Zoom = 0f;
                PdfGoToAction gotoAction = new PdfGoToAction(dest);
                pdf.AfterOpenAction = gotoAction;
            }
            pdf.SaveToFile("result.pdf");


Best Regards,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 3011
Joined: Wed Jun 27, 2012 8:50 am

Tue Jan 19, 2016 1:51 pm

Hey amy,

Works like a charm. Thank you!

Cheers,
Crix

Crix
 
Posts: 4
Joined: Mon Jan 04, 2016 3:07 pm

Wed Jan 20, 2016 2:03 am

Hi Crix,

Thanks for your feedback.
I am glad that the solution helps you.
Welcome to write to us again for further problems.

Best Regards,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 3011
Joined: Wed Jun 27, 2012 8:50 am

Return to Spire.PDF

cron