Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
205
Image Sizing in PDF
posted

I have a report (PDF) into which I insert an image of a gantt chart.  For large images, where the chart is longer than A4, only the area of the chart which fits onto the first page is shown.

Is there a way for a large image to be  scaled to fit on a single page, or can an image be made to be visible over more than one page?

Thanks,

Richard

Parents
No Data
Reply
  • 5
    Suggested Answer
    posted

    There is a way to fit the image to one page.

    If you have an image with a height larger than the height of a page of your target format (e.g. Letter, A4, etc.) just try the following lines of code:

    IImage targetBranding = mainSection.AddImage(_img);
    targetBranding.KeepRatio = true;
    targetBranding.Height = MaxHeight.Instance;

    Try using

    targetBranding.Width = MaxWidth.Instance;

    instead.

    If you are intending to use other layout options you can aim this by using a combination of container elements, attributes and the declarations above.

Children
No Data