Foxit PDF SDK 5.3

How to render only a section of a PDF on Foxit PDF SDK?

Follow the steps outlined below to render a selection of a PDF on Foxit PDF SDK:

  1. Change the parameters of FSPDF_Page_GetMatrix before rendering
  2. Go to “samples\simple_sample\comm_src\fgsdk_common.cpp” and locate the call for FSPDF_Page_GetMatrix
  3. Change the parameters. For example, “FSPDF_Page_GetMatrix(page, -200, -100, (FS_INT32)width*1.5, (FS_INT32)height*3, 0, &mt)”
  4. Run the demo at “simple_sample\pdf2img” and look at the output to see what the changes has done to the rendering. Note: The parameter x and y specify the location. Setting (x,y) to (0,0) means to set the page left top to match the left top of the context(ie. Bmp). Setting the value to (-200,-100) means to render the page west by 200 points and north by 100 points of the origin. The SDK will only render items that lands on the context. If the position is not on the context at all, it is possible it will render nothing. Changing the width and height of the page will change the size of the page. If the context is smaller than the page, the part of the page that is too large to fit on the page will not be rendered. Note: To render only a section of a PDF, the concept is to have a context the size of the section you want to render it to and then adjust the position and size on what section you want to be render on the context. Another option is not to change the size of the rendering, but to make the context you are rendering to smaller or only representing what you need. This description is based on the fact that the context is the same size of the page size.

Note: This article refers to a deprecated version of a Foxit Product. If you are still using Foxit PDF SDK 5.3 or older, please refer to your download package documents for Developer Guide and API Reference.

Get a trial version of the new Foxit PDF SDK and see our latest generation SDK’s brand new features!

Updated on April 5, 2017

Was this article helpful?
Thanks for your feedback. If you have a comment on how to improve the article, you can write it here: