zoom to page width

(7 posts) (2 voices)

Tags:

No tags yet.

  1. chadwickhung, Member

    Dear support,
    My user would normally print the report and we asked them to export it to Pdf before printing.

    I know we can use zoom_scale export option for a percentage zoom, is there a way to ask it to make the zoom to page width?

    Thanks.
    Chadwick

  2. myDBR Team, Key Master

    There is no single answer. You can try different methods which suits you best.

    Depending on bit what you want to zoom (headers / content) but you can use the zoom_scale or CSS zoom / transform: scale).

    For example:

    SELECT 'dbr.css', '.content {zoom: 2;}';

    Would zoom the content of the reprot 200% and when done in PDF output, wkhtmltopdf will fit it in page.

    --
    myDBR Team

  3. chadwickhung, Member

    Is it necessary to specify a percentage like 200%? Can we just ask it to fit to page width?
    Thanks
    Chadwick

  4. chadwickhung, Member

    Just to explain why. Because the width of that report would vary according to the data length, if we specify a fix percentage, e.g. 70%, it may be able to show the whole report for some case but may not for the other case.
    Please advise. Thank you.
    Chadwick

  5. myDBR Team, Key Master

    You can adjust the zoom percentage based on the data you have.

    --
    myDBR Team

  6. chadwickhung, Member

    You mean I need to calculate the zoom level and adjust dynamically in the report? So there is no setting for simply zoom to page width, am I correct?

    Thanks
    Chadwick

  7. myDBR Team, Key Master

    Yes, there is no zoom to page width feature in wkhtmltopdf. The HTML document is converted to PDF and the rendering engine tries to fit the content into viewport (a page), but if your data is too wide for a page, it will span multiple pages. Same applies both horizontally and vertically.

    The options are to calculate the zoom level based on the content, or if you plan on targetting PDF output, design the report so that the content will fit the page.

    --
    myDBR Team


Reply

You must log in to post.