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

Page width?

rkarlberg wrote on 2018-12-07:
I'm trying to create a PDF using the code below. Problem is, no matter what settings I use, the width of the resulting PDF is always the same, seems to be about 8 inches:

import pdfcrowd
import sys

try:
    # create the API client instance
    client = pdfcrowd.HtmlToPdfClient(
        'rkarlberg', '123456789')

    # configure the conversion
    client.setPageWidth("200in")
    client.setOrientation('landscape')
    client.setNoMargins(True)
    client.setJavascriptDelay(1000)

    print(client.getRemainingCreditCount())

    # run the conversion and write the result to a file
    client.convertUrlToFile(
        'https://www.mta.com/Portfolio7_User.html?user=af79ac6-433-427-b912-8af16b5433', 'Portfolios_Dec01.pdf')
except pdfcrowd.Error as why:
    # report the error
    sys.stderr.write('Pdfcrowd Error: {}\n'.format(why))

    # handle the exception here or rethrow and handle it at a higher level
    raise
support wrote on 2018-12-08:
Hi,

It seems that the URL used in your code has already expired. Please send us a working one to support@pdfcrowd.com and we will look into it.
rkarlberg wrote on 2018-12-08:
Never mind - turns out that removing the "setOrientation('landscape')" command solves this problem. It seems that you should use commands like either setOrientation('landscape') OR setPageWidth("200in"), but not both.