I want to resize the PDFium control.

Asked 2 years ago, Updated 2 years ago, 67 views

I would like to use PDFium to create a PDF viewer Windows app.
I am having trouble changing the size of the PDFium.

pdfViewer1.Width=500;
pdfViewer1.Height=300;

Even so, the size does not.
How can I change the size?

windows pdf

2022-09-30 11:47

1 Answers

Update
You seem to use the Control.Size Property property.
And the starting position in the upper left corner seems to be Control.Location Property.
The first parameter is horizontal and the second parameter is vertical.

Form1.Designer.cs I extracted it from the source and it was written like this

this.pdfViewer1.Location=new System.Drawing.Point(1,1);
this.pdfViewer1.Size=new System.Drawing.Size(500,300);

The following is for your reference
If it is the page of the document you are viewing, isn't it possible to change the size by setting the SizeMode property to SizeModes.Zoom and specifying a value (magnification?) in the Zoom property?

PdfViewer Properties

  • SizeMode
    Control how the PdfViewer will handle pages placement and control sizing
  • Zoom
    This property allows you to scale the PDF page. To take effect the SizeMode property should be Zoom

Examples of forum questions (The purpose of the question is different)
Topic:PdfViewer.ScrollToPoint

 float x=pdfViewer1.CurrentPage.Width/2;
    float=pdfViewer1.CurrentPage.Height/2;
    pdfViewer1.SizeMode=SizeModes.Zoom;
    pdfViewer1.Zoom=4;
    pdfViewer1.ScrollToPoint(0, newPointF(x,y));

github WinForms sample
Pdf.WinForms/PdfViewer.cs


2022-09-30 11:47

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.