We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

HtmlToPdf AspectRatio issue

Thread ID:

Created:

Updated:

Platform:

Replies:

100647 Aug 22,2011 11:28 AM Aug 24,2011 05:50 AM ASP.NET Web Forms (Classic) 1
loading
Tags: PDF
katanakensei
Asked On August 22, 2011 11:28 AM

hi everyone,

i'm quite new about syncfusion pdf, but i manage to do almost the thinks i needed..

i need to get a pdf from url.

the page i have to render is a page with a table with attribute 100% width (to avoid scrollbars)

the problem i found is to resize the pdf to fit the page to the pdf page.

i saw that part of code :


#############################################################

SizeF pageSize = page.GetClientSize();

PdfUnitConvertor convertor = new PdfUnitConvertor();
float width = -1;
float height = -1;

// Calculates the height and width of the pdf image
if (dimension == AspectRatio.KeepHeight)
{
height = convertor.ConvertToPixels(pageSize.Height, PdfGraphicsUnit.Point);
}
else if (dimension == AspectRatio.KeepWidth)
{
width = convertor.ConvertToPixels(pageSize.Width, PdfGraphicsUnit.Point);
}

...

HtmlToPdfResult result = html.Convert(url, ImageType.Metafile, (int)width, (int)height, dimension);



#############################################################

if i use fit dimension = AspectRatio.FitPageSize;

the page seems to "shrink" only the right part of the table (like you can see in the attachemenet)

any idea to solve that behaviour ?

thanks :)




AspectRatio.KeepWidth.pdf_bd8c76b3.zip

Geetha M [Syncfusion]
Replied On August 24, 2011 05:50 AM

Hi,

Thank you for your interest in Syncfusion products.

In order the complete HTML page in PDF, please make use of AspectRatio.KeepWidth. This will maintain the width of the content to fit the PDF page and then paginates if the height exceeds PDF page height.

Please let me know if you have any questions.

Regards,
Geetha


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;