This is an archived forum post. The information may be outdated. Contact us if you have any questions.

Auto-Scaling Height

ctfishman wrote on 2011-04-03:
Greetings. I just discovered the pdfcrowd api and have been testing it out. So far it's awesome, I've been able to create .pdfs from my dynamically generated html which are almost exactly what I want. We will definitely be upgrading to a paid account in short order.

One question, is it possible to automatically set the scaling factor based on the height of the content, similar to the way it's done with the width? I'm converting pages that I want to end up as two-page .pdfs. The html contains either three or four tables. I add a "page-break-after:always" style attribute to the table I want the one break after (first one if there are three, second on if there are four). There are three different cases that determine the number of rows, and therefore the height, of the table the break will follow, so current in my PERL script I'm testing for the three cases and setting a scaling factor based on which one applies:
if($teamscount < 20) {
  $scaling_factor="1.0";
  } elsif(!$openerstable[0]) {
  $scaling_factor="0.8";
  } else {
  $scaling_factor="0.6667";
  }

This works OK, but if there is an automated way to determine the maximum scale which would not cause a page break in the middle of either table I'd love to know what that is.

Thanks in advance for any direction.

-matt
support wrote on 2011-04-03:
Hi Matt,

we do not support such feature, sorry.

The service uses a slightly modified "Print" algorithm used in Google Chrome. If the content is wider it is scaled down to fit the page width. The algorithm does not scale the content in the vertical direction, it just searches for the best position for a page break.