We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to use LoadOptions.PageSizeAdjustmentModes

I am loading an html document and setting in HtmlLoadOptions a page size with width 8.5 inches and height 11 inches. I set this with points like so:

        PageInfo pageInfo = new PageInfo();
        
        pageInfo.setHeight(792.0);
        pageInfo.setWidth(612.0);
        
        MarginInfo marginInfo = new MarginInfo();
        marginInfo.setTop(72.0);
        marginInfo.setLeft(72.0);
        
        pageInfo.setMargin(marginInfo);
        htmlLoadOptions.setPageInfo(pageInfo);

While the height is correct the width is ignored because the width of the html table
passed in is greater. I need to force the page to obey this width requirement, but I don’t
understand how to use https://reference.aspose.com/pdf/java/com.aspose.pdf/LoadOptions.PageSizeAdjustmentModes

and set HtmlLoadOptions to use NoAjustmentAllwaysUsePredefinedSize.

Any help would be appreciated.

Michael

@mkochu,

The required feature is not implemented for HTMLLoadOptions class yet. Kindly send us your source HTML document and the complete code. We will investigate and share our findings with you. Your response is awaited.

Best Regards,
Imran Rafique

I actually managed to get the page size correct by reducing the number of columns in the html table, so it is working fine now.

However, I am not able to get the page margins working, I’m setting top and left to 1 inch (72.0 points) but I am seeing 0.8 inches from the left and 0.95 inches from the top. MarginInfo doesn’t look like it is working correctly

@mkochu,
Kindly send us your source HTML document and let us know in which format you are exporting this HTML document as well as how you are verifying page margin values. We will investigate and share our findings with you. Your response is awaited.

Best Regards,
Imran Rafique