I am using abcPdf to convert an HTML report into a pdf file. The pdf has to be a single landscape A4 page.
Do you know if there is any way to tell abcPdf to scale th
In case you are using 'Gecko' engine, this engine does not support 'GetInfoInt' so we need write some javascript to get the height. Do a dummy render first to determine height and then set this height to original AbcDoc.
using (var tempDoc = new Doc())
{
tempDoc.HtmlOptions.Engine = EngineType.Gecko;
tempDoc.HtmlOptions.Media = MediaType.Print;
tempDoc.HtmlOptions.UseScript = true;
if (width.HasValue)
tempDoc.HtmlOptions.BrowserWidth = width.Value;
tempDoc.HtmlOptions.OnLoadScript = " window.onbeforeprint = function () { document.documentElement.abcpdf = Math.max( document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );}";
int theTempID = tempDoc.AddImageHtml(htmlData);
int height = Convert.ToInt32(tempDoc.HtmlOptions.GetScriptReturn(theTempID));
tempDoc.Clear();
tempDoc.Dispose();
theDoc.MediaBox.Height = height;
theDoc.Rect.String = theDoc.MediaBox.String;
theDoc.AddImageHtml(htmlData);
}