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

Free Support Forum - aspose.com

Html to pdf in .Net

I am getting following message. Where can I find a proper documentation to set the various page or doc parameters so I know what html styles/sizes to convert to? The rectangle size can not be larger page size Parameter name: rectangle

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentException: The rectangle size can not be larger page size
Parameter name: rectangle

[ArgumentException: The rectangle size can not be larger page size
Parameter name: rectangle]
‰.‹ž…ctor(Page , RectangleF , Boolean ) +381
Aspose.Pdf.Page.Accept(•– , RectangleF , Boolean , Boolean ) +69
Aspose.Pdf.Page.Accept(•– , RectangleF , Boolean ) +41
‰.Ž.Process() +4091
Aspose.Pdf.Page.(Page ) +471
Aspose.Pdf.Page.‡Š() +16
Aspose.Pdf.Document.‡Š() +443
Aspose.Pdf.Document.Save(Stream output) +46
Aspose.Pdf.Document.Save(String outputFileName) +70

Thank you Vaishali


Hi Vaishali,


Thanks for contacting support.

In order to convert HTML file to PDF format, please follow the instructions specified over Convert HTML to PDF Format

In case you still face the same problem, please share the resource HTML so that we can test the conversion at our end. We are sorry for this inconvenience.

Hello Nayyer,
Thanks for your reply. Attached please find the html I need to convert to pdf. The style css before it is long, but we do need all the styles. Will appreciate your help.
Thanks
Vaishali

Style Guide body { background-color: #f8f6f3; color: #464646; font-family: Arial, Helvetica, sans-serif; font-size: 13px; line-height: 125%; margin: 0; padding: 0; } body * { font-family: Arial, Helvetica, sans-serif; } h1 { } h2 { line-height: 1.2em; margin: 0 0 .83em 0; padding: 0; } h3 { line-height: 1.3em; margin: 0; padding: 0; text-transform: uppercase; } p { margin: 0 0 1.5em 0; } table { border-spacing: 0; border-collapse: collapse; } a { font-weight: bold; text-decoration: none; } table.button { background-color: #888; display: inline-block; } table.button td { padding: 8px; vertical-align: middle; } .button a { font-size: .9em; font-weight: normal; } ul { padding-left: 16px; } .wrapper { margin: 0 auto; width: 660px; } .content { width: 600px; } td.fine-print { background-color: #f8f6f3; padding: 1.5em 0px; text-align: left; } table, td { border-spacing: 0; } table.content { background-color: #ffffff; text-align: left; } td { padding: 0; vertical-align: top; } .header { padding: 0; } .table-wrap-two-column { padding: 30px; } .left-column { width: 67%; } .right-column { } .right-column .table-wrap { padding-bottom: 30px; } .right-column table { width: 140px; } .callout img, .image-caption-list img { display: block; } .callout { border-spacing: 0; line-height: 1.3em; width: 140px; } .callout td { border-spacing: 0; padding: 0; } .callout .caption, .callout .caption-flag { padding: 0 8px; } .callout.flag .caption { padding: 8px; } .callout p { margin: .5em 0; } .light-list td, td.light-list { padding: 8px; } .image-caption-list td { overflow: auto; } .image-caption-list .caption { padding: 0 5px; } .image-caption-list p { margin: 5px 0; } table.sponsors { padding: 30px; width: 100%; } table.sponsors th { text-align: left; } table.sponsors td { padding: 30px 0; vertical-align: bottom; } table.sponsors td.one { font-weight: bold; line-height: 27px; width: 30%; } table.sponsors td.icon { width: 35px; } .fine-print, .footer { font-size: 12px; } .footer { margin-top: 30px; } .footer table { width: 100%; } .footer table td { padding: 0; } .footer .social { text-align: center; } /* Orange/Blue ----------------------------------------------------- */ .orange-blue h2 { color: #00326a; } .orange-blue h3 { color: #ff6338; } .orange-blue a { color: #00b5dc; } .orange-blue table.button { background-color: #ff6338; } .orange-blue .button a { color: #ffffff; } .orange-blue .left-column { border-right: 1px solid #dadada; } .orange-blue .image-caption-list { border-top: 5px solid #ff6338; } .orange-blue .image-caption-list td.caption { border-left: 1px solid #dadada; border-right: 1px solid #dadada; } .orange-blue .image-caption-list .last td.caption { border-bottom: 1px solid #dadada; } .orange-blue .light-list .first td { border-top: 5px solid #ff6338; } .orange-blue .light-list td, .orange-blue td.light-list { border: 1px solid #dadada; border-top: none; } .orange-blue .sponsors td { border-top: 1px solid #dadada; } .orange-blue .sponsors tr.one td { border-top: none; } .orange-blue .sponsors td.one { color: #00326a; } .orange-blue .callout .caption, .orange-blue .callout .flag, .orange-blue .callout .caption-flag { background-color: #00326a; color: #dadada; } .orange-blue .callout .caption, .orange-blue .callout .flag { border-top: 5px solid #ff6338; } .orange-blue .flag { background-color: #00326a; } .orange-blue .footer { background-color: #00326a; } .orange-blue .footer td { color: #ffffff; } .orange-blue .footer b { color: #ff6338; } /* Lavender/Blue --------------------------------------------------- */ .lavender-blue h2 { color: #00326a; } .lavender-blue h3 { color: #c384b5; } .lavender-blue a { color: #00b5dc; } .lavender-blue table.button { background-color: #c384b5; } .lavender-blue .button a { color: #ffffff; } .lavender-blue .left-column { border-right: 1px solid #dadada; } .lavender-blue .image-caption-list { border-top: 5px solid #c384b5; } .lavender-blue .image-caption-list td.caption { border-left: 1px solid #dadada; border-right: 1px solid #dadada; } .lavender-blue .image-caption-list .last td.caption { border-bottom: 1px solid #dadada; } .lavender-blue .light-list { border-top: 5px solid #c384b5; } .lavender-blue .light-list td, .lavender-blue td.light-list { border: 1px solid #dadada; border-top: none; } .lavender-blue .sponsors td { border-top: 1px solid #dadada; } .lavender-blue .sponsors tr.one td { border-top: none; } .lavender-blue .sponsors td.one { color: #00326a; } .lavender-blue .callout .caption, .lavender-blue .callout .flag, .lavender-blue .callout .caption-flag { background-color: #00326a; color: #dadada; } .lavender-blue .callout .caption, .lavender-blue .callout .flag { border-top: 5px solid #c384b5; } .lavender-blue .callout .caption { background-color: #00326a; border-top: 5px solid #c384b5; color: #dadada; } .lavender-blue .footer { background-color: #00326a; } .lavender-blue .footer td { color: #ffffff; } .lavender-blue .footer b { color: #ff6338; } /* Green/Blue --------------------------------------------------- */ .green-blue h2 { color: #00326a; } .green-blue h3 { color: #7AC142; } .green-blue a { color: #00b5dc; } .green-blue table.button { background-color: #7AC142; } .green-blue .button a { color: #ffffff; } .green-blue .left-column { border-right: 1px solid #dadada; } .green-blue .image-caption-list { border-top: 5px solid #7AC142; } .green-blue .image-caption-list td.caption { border-left: 1px solid #dadada; border-right: 1px solid #dadada; } .green-blue .image-caption-list .last td.caption { border-bottom: 1px solid #dadada; } .green-blue .light-list { border-top: 5px solid #7AC142; } .green-blue .light-list td, .green-blue td.light-list { border: 1px solid #dadada; border-top: none; } .green-blue .sponsors td { border-top: 1px solid #dadada; } .green-blue .sponsors tr.one td { border-top: none; } .green-blue .sponsors td.one { color: #00326a; } .green-blue .callout .caption, .green-blue .callout .flag, .green-blue .callout .caption-flag { background-color: #00326a; color: #dadada; } .green-blue .callout .caption, .green-blue .callout .flag { border-top: 5px solid #7AC142; } .green-blue .callout .caption { background-color: #00326a; border-top: 5px solid #7AC142; color: #dadada; } .green-blue .footer { background-color: #00326a; } .green-blue .footer td { color: #ffffff; } .green-blue .footer b { color: #ff6338; } /* Yellow/Blue --------------------------------------------------- */ .yellow-blue h2 { color: #00326a; } .yellow-blue h3 { color: #FCB033; } .yellow-blue a { color: #00b5dc; } .yellow-blue table.button { background-color: #FCB033; } .yellow-blue .button a { color: #ffffff; } .yellow-blue .left-column { border-right: 1px solid #dadada; } .yellow-blue .image-caption-list { border-top: 5px solid #FCB033; } .yellow-blue .image-caption-list td.caption { border-left: 1px solid #dadada; border-right: 1px solid #dadada; } .yellow-blue .image-caption-list .last td.caption { border-bottom: 1px solid #dadada; } .yellow-blue .light-list { border-top: 5px solid #FCB033; } .yellow-blue .light-list td, .yellow-blue td.light-list { border: 1px solid #dadada; border-top: none; } .yellow-blue .sponsors td { border-top: 1px solid #dadada; } .yellow-blue .sponsors tr.one td { border-top: none; } .yellow-blue .sponsors td.one { color: #00326a; } .yellow-blue .callout .caption, .yellow-blue .callout .flag, .yellow-blue .callout .caption-flag { background-color: #00326a; color: #dadada; } .yellow-blue .callout .caption, .yellow-blue .callout .flag { border-top: 5px solid #FCB033; } .yellow-blue .callout .caption { background-color: #00326a; border-top: 5px solid #FCB033; color: #dadada; } .yellow-blue .footer { background-color: #00326a; } .yellow-blue .footer td { color: #ffffff; } .yellow-blue .footer b { color: #ff6338; } /* Light-blue/Blue --------------------------------------------------- */ .light-blue-blue h2 { color: #00326a; } .light-blue-blue h3 { color: #00B4DD; } .light-blue-blue a { color: #00b5dc; } .light-blue-blue table.button { background-color: #00B4DD; } .light-blue-blue .button a { color: #ffffff; } .light-blue-blue .left-column { border-right: 1px solid #dadada; } .light-blue-blue .image-caption-list { border-top: 5px solid #00B4DD; } .light-blue-blue .image-caption-list td.caption { border-left: 1px solid #dadada; border-right: 1px solid #dadada; } .light-blue-blue .image-caption-list .last td.caption { border-bottom: 1px solid #dadada; } .light-blue-blue .light-list { border-top: 5px solid #00B4DD; } .light-blue-blue .light-list td, .light-blue-blue td.light-list { border: 1px solid #dadada; border-top: none; } .light-blue-blue .sponsors td { border-top: 1px solid #dadada; } .light-blue-blue .sponsors tr.one td { border-top: none; } .light-blue-blue .sponsors td.one { color: #00326a; } .light-blue-blue .callout .caption, .light-blue-blue .callout .flag, .light-blue-blue .callout .caption-flag { background-color: #00326a; color: #dadada; } .light-blue-blue .callout .caption, .light-blue-blue .callout .flag { border-top: 5px solid #00B4DD; } .light-blue-blue .callout .caption { background-color: #00326a; border-top: 5px solid #00B4DD; color: #dadada; } .light-blue-blue .footer { background-color: #00326a; } .light-blue-blue .footer td { color: #ffffff; } .light-blue-blue .footer b { color: #ff6338; }

10/28/2014

Shawn Mant
20 Enterprise
1234 S OLIVE ST
LOS AMOS, CA 77777-7777
                                    <p>
                                       Dear  Shally Yuan,
                                    </p>
                                    <p>
                                        Please be advised that the XYZ US has recieved a request for termination of XYZ Company Prefix(es) 86677881  from a duly authorized officer of Company.
                                    </p>
                                    <p>
                                        This letter confirms that we have updated our records to reflect that XYZ Company Prefix(es), is(are) now terminated and 20/20 Enterprise shall cease use of the Prefix(es). Use of the Prefix(es) after termination is not authorized by XYZ US and shall be considered by XYZ US to be an infringement of XYZ US’s intellectual property rights, in addition to any other claims. Please be aware that, upon termination of the Prefix(es), XYZ US may reissue the Prefix(es) to other parties.
                                    </p>
                                    <p>
                                        If you have any questions, please contact the XYZ US Member Support at +1 999.888.6666, Monday-Friday, 8 a.m. to 6 p.m., EST.
                                    </p>
                                    <p>
                                        Sincerely,
                                    </p>
                                    <p>
                                        XYZ  Customer Service
                                    </p>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    <!-- sponsor-table.html ----------------------------------------------- -->
                                    <table style="width: 100%;">
                                        <tbody>
                                            <tr></tr>
                                        </tbody>
                                    </table>
                                </td>
                            </tr>
                            <tr>
                                <td class="footer" style="padding: 15px 30px;" colspan="2">
                                    <table>
                                        <tbody>
                                            <tr>
                                                <td>
                                                    <p>This email was sent by: </p>
                                                    <p>
                                                        <strong>XYZ US</strong><br />
                                                        100 Main Street, Suite 202<br />
                                                        Lamberville, NJ, 08888, USA
                                                    </p>
                                                    <p>We respect your right to privacy. View our <a href="http://www.xyzus.org/privacy-policy" target="_blank">Privacy Policy ></a></p>
                                                </td>
                                                <td width="140" class="social"></td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </td>

                            </tr>

                        </tbody>
                    </table>
                </td>
            </tr>
        </tbody>
    </table>
</center>

Hi Vaishali,


Thanks for sharing the resource file.

I have tested the scenario using latest release of Aspose.Pdf for .NET 9.7.0 where I have used following code snippet and I am unable to notice any exception. For your reference, I have also attached the source HTML (which I have extracted from your earlier post). Simply change extension from .TXT to .HTML.

However I have observed that resultant PDF is blank. For
the sake of correction, I have logged it in our issue tracking system as PDFNEWNET-37697. We will
investigate this issue in details and will keep you updated on the status of a
correction.

We apologize for your inconvenience.


[C#]

Document doc = new Document(“c:/pdftest/html-string-value.html”, new HtmlLoadOptions());<o:p></o:p>

doc.Save("c:/pdftest/html-string-value.pdf");

The issues you have found earlier (filed as PDFNET-37697) have been fixed in Aspose.PDF for .NET 20.1.