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 Apr 02, 2018 1:37 am
How can i make fit page width size to control width size? I want this to work dynamically with form(or control).
Thank you.
+ What is the difference between PdfViewer and PdfDocumnetViewer?
-

kelesym
-
- Posts: 12
- Joined: Thu Jan 04, 2018 1:42 am
Mon Apr 02, 2018 7:32 am
Hello,
Thanks for your inquiry. Please refer to the below code snippet to make the page width fit to the control width.
- Code: Select all
float controlWidth = this.pdfDocumentViewer1.Width;
float pageWidth = 815;
float rate = controlWidth / pageWidth*100;
var result = rate.ToString("#0");
int percentage = int.Parse(result);
this.pdfDocumentViewer1.ZoomTo(percentage);
The difference between PdfDocumnetViewer and PdfViewer is that PdfDocumnetViewer supports customized design and PdfViewer doesn't, it's not allowed to modify.
Best regards,
Simon
E-iceblue support team
-


Simon.yang
-
- Posts: 620
- Joined: Wed Jan 11, 2017 2:03 am
Wed Apr 04, 2018 2:42 am
Thanks! I found another method! //ZoomTo(Spire.PdfViewer.Forms.ZoomMode.FitWidth);
-

kelesym
-
- Posts: 12
- Joined: Thu Jan 04, 2018 1:42 am
Wed Apr 04, 2018 3:16 am
Hello,
Thanks for your feedback and sharing the workaround. If there is any other question, welcome to contact us.
Best regards,
Simon
E-iceblue support team
-


Simon.yang
-
- Posts: 620
- Joined: Wed Jan 11, 2017 2:03 am