Free Support Forum - aspose.com

Html Content not rendring properly in PDF

Hi ,



If html content size is huge it’s taking pdf pages based on html content. But if try to give margin for pdf it’s not taking the margin except first page. 2nd page, 3 rd page etc. coming with bottom more spaces. ( bottom margin is not working). How to avoid these extra spaces in pdf



can you please clarify.



Please find the attachment



I have mentioned code details below

[edited by: Karthikeyan_C at 1:57 AM (GMT -6) on Wed, Jul 22 2015]

I have mentioned sample codes =>



document = new Document();

document.getPages().add();

/* For New Line /

TextFragment newLine = new TextFragment("\n");



/
PDF Page Info */

PageInfo pageInfo = document.getPageInfo();

pageInfo.setHeight(PageSize.getA4().getHeight());

pageInfo.setWidth(PageSize.getA4().getWidth());

MarginInfo margin = pageInfo.getMargin();

margin.setLeft(40);

margin.setRight(40);

margin.setTop(30);

margin.setBottom(5);

pageInfo.setMargin(margin);

document.setPageInfo(pageInfo);



com.aspose.pdf.HtmlFragment htmlFragment = new HtmlFragment("

<b style=“color:#EB8C00; font-family:TimesNewRoman; font-size:12pt;”>" + eicPolicyEntity.getPolicyName() + “

”);





(ie. eicPolicyEntity.getPolicyName() => will return more html content like

,

    etc)



    document.getPages().get_Item(1).getParagraphs().add(htmlFragment1);



Hi Karthikeyan,


Thanks for contacting support.

Yes you are correct. The time taken by API to perform conversion depends upon the structure and complexity of input HTML file. However in order to test the margin related issue, can you please share the source HTML, so that we can test the scenario in our environment. We are sorry for this inconvenience.