How do I programmaticaly scale resize PDF content

Q: How can I scale PDF content without going element by element. We want to scale the content and leave the page size as is, or change the page size and leave content as it is, without going element by element as shown in ElementEdit sample ().

To change page size and leave content as it is, call page.SetMedia/CropBox (e.g. see PDFRect sample ).

To keep the page size but scale content:

  • First change the page size page.SetMedia/CropBox () by scaling it with the inverse of the scaling factor (1.0/scale_f)

  • Call page.Scale(scale_f).