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

Odd page size

jonathanhatcher wrote on 2011-04-08:
I'm using the following Java API code to render a PDF from HTML:

Client client = new Client("XXX", "XXX");
				client.setPageHeight("297");
				client.setPageWidth("210");
				client.setPageLayout(Client.SINGLE_PAGE);
				client.setInitialPdfZoomType(Client.FIT_PAGE);
				client.setPdfScalingFactor(1.00);
				resp.setContentType("application/pdf");			
				client.convertHtml(reportHTML, resp.getOutputStream());


Two questions:

1) Why is my page appearing really small, 2 inches by 4 inches, I thought those dimensions were mm and should represent A4, especially with a scaling factor of 1.00? Everything looks massive!

2) How do I change the filename the document is in? That's probably more of a Java question.

Thanks
Jonathan
support wrote on 2011-04-08:
Hi Jonathan,

The default unit is point (72 points = 1 inch). To specify A4 in millimeters use

client.setPageHeight("297mm");
client.setPageWidth("210mm");


As for the filename, you need to set the Content-Disposition header to this value:

attachment; filename="myfilename.pdf"
jonathanhatcher wrote on 2011-04-08:
Thanks guys, worked a treat!!

Jonathan