Free Support Forum - aspose.com

Html report does not scale to A4

I have tried to render my html into a PDF but it doesn’t fit to a A4 and for that it is truncated at the right. I have tried the same html with other renderer an all does a scale to fit it to A4 by default. How can I do this in Aspose. You can see my solution as attachment.
Thankstest.zip (195.8 KB)
test.zip (195.8 KB)

@cpiock,

We are looking into this and will get back to you with feedback soon.

@cpiock,

I have shared sample code with . This will help you to achieve your requirements. Please share feedback with us if there is still an issue.

			string Resultant_output = path + "output.pdf";
			// Create PdfRendering Options object
			Aspose.Html.Rendering.Pdf.PdfRenderingOptions pdf_options = new Aspose.Html.Rendering.Pdf.PdfRenderingOptions();

		   pdf_options.PageSetup.AnyPage = new Aspose.Html.Drawing.Page(
           new Aspose.Html.Drawing.Size(Aspose.Html.Drawing.Unit.FromInches(8.27),
							 Aspose.Html.Drawing.Unit.FromInches(11.69)),
							 new Aspose.Html.Drawing.Margin(0));
		// Instantiate PdfDevice object while passing PdfRenderingOptions and resultant file path as arguments
		   using (Aspose.Html.Rendering.Pdf.PdfDevice pdf_device = new Aspose.Html.Rendering.Pdf.PdfDevice(pdf_options, Resultant_output))
			// Create HtmlRenderer object
			using (Aspose.Html.Rendering.HtmlRenderer renderer = new Aspose.Html.Rendering.HtmlRenderer())
			// Create HtmlDocument instance while passing path of already created HTML file
			using (Aspose.Html.HTMLDocument html_document = new Aspose.Html.HTMLDocument(path+"source.html"))
			{
				// Render the output using HtmlRenderer
				renderer.Render(pdf_device, html_document);
  			  }