Skip to content

aspose.html 将HTML转换为PDF样式错乱 #6

Description

@DerickIT

image
请问将HTML直接转换为PDF出现样式错乱,用的是demo里面示例,有其他解决方案吗
以下是HTML代码
`

<title>xuy组件测试会签: 组件测试流程(100501)归档页面</title> <style type="text/css" media="print"> @media print { body { height: auto !important; }
        #formContainer {
            width: 100% !important;
            height: auto !important;
            margin-left: 0px !important;
            margin-right: 0px !important;
            position: relative;
            overflow: hidden !important;
        }

            #formContainer .x-panel-bwrap {
                width: 100% !important;
                overflow: visible !important;
            }

            #formContainer .x-panel-body {
                width: 100% !important;
                height: auto !important;
                overflow: visible !important;
            }

        .gtp-dynform {
            width: 100% !important;
            overflow: visible !important;
        }

        .gtp-dynform-body {
            width: 100% !important;
            margin-left: 0px !important;
            margin-right: 0px !important;
            height: auto !important;
            font-size: auto;
            padding-bottom: 5px !important;
            position: relative;
        }

            .gtp-dynform-body > table {
                table-layout: auto !important;
                margin-right: auto !important;
                margin-left: auto !important;
                width: 100% !important;
                right: 0px !important;
                position: relative;
            }

        td .x-form-check-group,
        td .x-form-radio-group {
            width: auto !important;
            float: left;
        }

            td .x-form-radio-group .x-column-inner,
            td .x-form-check-group .x-column-inner {
                width: auto !important;
            }

            td .x-form-check-group .x-column,
            td .x-form-check-group .x-column .x-form-check-wrap,
            td .x-form-radio-group .x-column,
            td .x-form-radio-group .x-column .x-form-check-wrap {
                width: auto !important;
            }

            td .x-form-check-group .x-column,
            td .x-form-radio-group .x-column {
                margin-left: 5px !important;
            }

        .x-attachment-panel-tbar {
            display: none;
        }

        .gtp-dynform-body .gtp-comp-wrap {
            min-height: 1em !important;
        }

        table {
            page-break-after: auto;
        }

        tr {
            page-break-inside: avoid;
            page-break-after: auto;
        }

        td {
            page-break-inside: avoid;
            page-break-after: auto;
        }

        thead {
            display: table-header-group;
        }

        tfoot {
            display: table-footer-group;
        }
    }
</style>
<style type="text/css">
    .x-column {
        float: left;
        padding: 0;
        margin: 0;
        overflow: hidden;
        zoom: 1;
    }

    table.adjacent-table {
        margin-top: -11px !important;
        padding-top: 0px;
    }

    table.fixed-table-width {
        width: 690px;
    }

    .x-column .x-form-element {
        padding-left: 0px !important;
    }

    .x-form-field {
        font: normal 12px arial, tahoma, helvetica, sans-serif;
    }

    .gtp-area .gtp-comp {
        overflow: hidden;
        vertical-align: middle;
        /*  margin: 1px 1px 0px 2px; word-break: break-all; */
        /* overflow: hidden;      border-bottom: 1px solid; */
        font-weight: normal;
        font-family: arial, tahoma, helvetica, sans-serif;
    }

    .gtp-comp-wrap {
        display: inline-block;
        /*border-bottom: 1px solid;*/
        margin-left: 0px;
        margin-right: 0px;
        margin-top: -1px\0;
        margin-left: 1px\0;
        margin-right: 1px\0;
        text-overflow: ellipsis;
        overflow: hidden;
    }

    .x-hidden,
    .x-hide-offsets {
        position: absolute !important;
        left: -10000px;
        top: -10000px;
        visibility: hidden;
    }

    .x-hide-display {
        display: none !important;
    }

    .gtp-span-hidden {
        display: none !important;
    }

    span.gtp-comp.no-underline {
        border-bottom: none;
    }

    .gtp-area .gtp-comp-wrap {
        overflow: hidden;
        text-overflow: ellipsis;
        margin-top: 0px\0;
    }

    .gtp-cell {
        padding: 0;
        margin: 0;
        vertical-align: middle;
    }

    .gtp-area-selected {
        background: #FFFC33;
    }

    span.gtp-comp {
        display: inline-block;
        border-bottom: 1px solid;
        margin-bottom: 1px;
        vertical-align: bottom;
        margin-left: 2px;
    }

    .gtp-area-editor {
        margin: 0px;
        margin-top: 0px;
        margin-top: 0px\0;
        margin-left: -1px;
    }

    .gtp-area span.gtp-comp {
        border-bottom: 0px;
        margin-top: -2px;
        margin-top: 2px\0;
    }

    .gtp-area p {
        height: 23px;
    }

    .gtp-area {
        min-height: 20px;
    }

    .gtp-dynform-border {
        border: 1px solid;
        border-collapse: collapse;
        width: 100%;
        table-layout: fixed;
    }

    td.gtp-comp.gtp-cell-active {
        border-top: 1px double #508cdd !important;
        border-bottom: 1px double #508cdd !important;
        border-left: 1px double #508cdd !important;
        border-right: 1px double #508cdd !important;
        position: relative;
    }

    .gtp-dynform-body .x-form-text,
    .gtp-dynform-body .x-form-textarea,
    .gtp-dynform-body .x-form-field-wrap,
    .gtp-dynform-body .x-form-check-wrap {
        /*position: absolute;*/
        left: 1px;
        /*border: 0px;*/
        outerline: none !important;
        background: none !important;
        background-color: #fff !important;
    }

    .gtp-dynform-body .x-form-normal-field {
        position: absolute;
        border: 0px;
    }

    .gtp-dynform-body .x-form-field-wrap .x-form-text,
    .gtp-dynform-body .x-form-radio-group .x-form-check-wrap,
    .gtp-dynform-body .x-form-check-group .x-form-check-wrap {
        position: static !important;
    }

    td.gtp-comp .gtp-comp-wrap {
        width: 100%;
        font-weight: normal;
        margin-top: 0px;
        margin-bottom: 0px;
        min-height: 1.2em;
        cursor: default;
    }

    span.gtp-comp-wrap.display-field {
        white-space: normal;
    }

    .gtp-dynform-body {
        height: auto !important;
        border: 0px;
        margin: auto;
        font-size: 12px;
        position: relative;
    }

        .gtp-dynform-body > p {
            margin: 0px 8px 0px 8px;
        }

        .gtp-dynform-body > table {
            border-spacing: 0px;
            border-collapse: collapse;
            margin: 0px 8px 10px 8px;
        }

        .gtp-dynform-body td {
            border: 1px solid transparent;
            border-collapse: collapse;
            padding: 5px 10px;
        }

    span.gtp-comp-wrap.multiline-text {
        word-wrap: break-word;
        display: block;
        height: auto;
        white-space: pre-wrap;
        text-align: left;
    }

    img.signimage {
        width: 100%;
        height: 100%;
    }

    .gtp-dynform-body em {
        font-style: italic;
    }

    .gtp-dynform-body strong {
        font-weight: bold;
    }

    .gtp-dynform-body textarea {
        min-height: 1.7em;
        height: auto;
    }

    .gtp-dynform-body .x-form-radio-group.x-form-focus,
    .gtp-dynform-body .x-form-check-group.x-form-focus {
        border: none;
    }

    .gtp-dynform-body .gtp-comp .x-form-item,
    .gtp-dynform-body .gtp-comp .x-form-field {
        font-size: inherit;
        font-family: inherit;
    }

    #msgBox {
        position: fixed;
        top: 0px;
        z-index: 10000;
        width: 200px;
        height: 25px;
        background-color: #F9FF00;
        margin-left: auto;
        margin-right: auto;
        text-align: center;
        display: none;
        font: normal 12px arial, tahoma, verdana, helvetica;
        color: #f00;
        border-radius: 5px;
    }

        #msgBox div {
            height: 25px;
            line-height: 25px;
        }

    .ref-link {
        color: #0508FA;
        cursor: pointer !important;
    }

        .ref-link:hover {
            text-decoration: underline;
        }

    .x-attachment-panel-tbar {
        display: none;
    }

    .x-attachment-panel a {
        text-decoration: none;
    }

    .x-filebox-list {
        position: relative;
        margin: 0px;
        overflow: auto;
        padding: 2px;
        display: block;
        outline: none !important;
    }

    .x-filebox-list-title {
        background-image: url('../images/fujian.png') !important;
    }

    .x-filebox-list input[disabled] {
        background-color: transparent;
    }

    .x-filebox-list ul {
        overflow: hidden;
        cursor: text;
    }

    .x-filebox-list-display-btns {
        padding-right: 33px !important;
    }

    .x-filebox-list-btns {
        position: absolute;
        right: 1px;
        top: 0;
        overflow: hidden;
        padding: 2px;
    }

        .x-filebox-list-btns div {
            float: left;
            width: 16px;
            height: 16px;
            margin-top: 4px;
        }

    .x-filebox-list-btn-clear {
        background: url(../images/clear.png) no-repeat scroll left 0px;
    }

    .x-filebox-list-btn-expand {
        background: url(../images/expand.png) no-repeat scroll left 0px;
    }

    .x-filebox-list-btn-over {
        background-position: left -16px;
    }

    .x-filebox-list-btn-hide {
        display: none;
    }

    .x-filebox-list li {
        float: left;
        margin: 1px 1px 2px 1px;
        line-height: 16px;
        font-size: 12px;
        font-family: arial;
    }

    .x-filebox-list-stacked li {
        float: none !important;
    }

    .x-filebox-list-input input {
        border: none;
        outline: none;
        margin-top: 4px;
        margin-bottom: 4px;
    }

    body.ext-ie .x-filebox-list-input input {
        background: none;
        border: none;
        margin-top: 3px;
    }
    /*.x-filebox{position:relative;border:1px solid #bbd8ec;padding:1px 3px 1px 15px;cursor:default;background:white url(../images/fujian.png) 0px center no-repeat}*/

    .x-filebox {
        position: relative;
        border: 1px solid #bbd8ec;
        padding: 1px 0px 1px 15px;
        cursor: default;
        white-space: normal;
        background: #fff url(../images/fujian.png) 0px center no-repeat;
    }

    .x-filebox-over {
        background-color: #97CBF1;
        border: 1px solid #bbd8ec;
    }

    .x-filebox-link {
        cursor: default;
    }

        .x-filebox-link:link,
        .x-filebox-link:visited {
            outline-style: none;
            text-decoration: none;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            line-height: 16px;
            display: inline-block;
            color: #333;
            max-width: 100%;
        }

        .x-filebox-link:hover {
            overflow: hidden;
            text-overflow: ellipsis white-space: nowrap;
            display: inline-block;
            color: #333;
        }

    .x-filebox-size {
        margin-top: -9px;
        vertical-align: middle;
        color: #999999;
        display: inline-block;
        margin-left: 3px;
    }

    .x-filebox-expand {
        background: url(../images/expand2.png) no-repeat scroll 3px 0px;
        border: none;
        height: 16px;
        margin-top: 2px;
        width: 13px;
        display: inline-block;
    }

    .x-filebox-nonclose .x-filebox-expand {
        margin-right: 2px;
    }
    /*.x-filebox-close {background:url(../images/close.png) no-repeat scroll 3px 0px;border:none;margin:0;height:16px;width:12px;vertical-align:middle;display:inline-block;}*/

    .x-filebox-close {
        background: url(../images/close.png) no-repeat scroll 3px 0px;
        border: none;
        height: 16px;
        margin-right: 2px;
        margin-top: 2px;
        width: 13px;
        display: inline-block;
    }

        .x-filebox-close:hover,
        .x-filebox-close:active {
            background-position: 3px -12px;
        }

    .x-filebox-expand:hover,
    .x-filebox-expand:active {
        background-position: 3px -12px;
    }

    .x-filebox-focus {
        border-color: #bbd8ec;
        background-color: #97CBF1;
        color: #fff;
    }

        .x-filebox-focus .x-filebox-close {
            background-position: 3px -24px;
        }

        .x-filebox-focus .x-filebox-expand {
            background-position: 3px -24px;
        }

    .x-item-disabled .x-filebox-close {
        background-position: 3px -36px;
    }

    .x-item-disabled .x-filebox-expand {
        background-position: 3px -36px;
    }

    .x-filebox-active {
        background-color: #97cbf1;
        border: 1px solid #bbd8ec;
    }

    .x-fileview-list {
        position: relative;
        margin: 0px;
        overflow: auto;
        padding: 2px;
        display: block;
        outline: none !important;
    }

    .x-fileview-list-item {
        position: relative;
        display: block;
        margin-top: 10px;
        margin-bottom: 10px;
        padding: 4px 50px 5px 35px;
        cursor: default;
        background: url(../images/attachment-view.png) 0px center no-repeat;
    }

    .x-fileview {
        margin: 0 8px 8px 8px;
        line-height: normal
    }

    .x-fileview-img {
        float: left;
        cursor: default;
        width: 32px;
        height: 32px;
        background: url(../images/attachment-view.png) 0 0 no-repeat;
    }

    .x-fileview-text {
        margin-left: 40px;
    }

    .x-fileview-title {
        color: #333333;
        display: inline-block;
        white-space: normal;
        word-break: break-all;
        word-wrap: break-word;
    }

    .x-fileview-size {
        color: #999;
        display: inline-block;
        margin-left: 3px;
    }

    .tip-filename {
        display: block;
        word-wrap: break-word;
        word-break: break-all;
    }

    .vertical li {
        float: none;
    }

        .vertical li .x-filebox-close {
            position: absolute;
            right: 4px;
            top: 3px;
        }
</style>


基本组件
单行文本werwe11222
多行文本asdf3433
数字框
日期框
单选框
海淀区西城区东城区朝阳区


多选框
商品房
保障房
公租房


下卡列表外包人员

实体参照


人员张宾张宾
部门测试部4UI测试部2/UI设计3/测试部4
显示文本
百度
这里没有超链接
图片


序号出差类型出差日期费用
总计
业务组件
货币框

二维码


附件
  • 1.jpg32.1K
审批意见实体:
xuy组件测试审批2
乒乒乓乓乒乒乓乓,嗨有人敲门嗨有人敲门,谁呀,我呀,你是谁你是谁,我是猪小弟啊。2019-07-30 16:58:25


</div>
`

Activity

  1. kashifiqb commented on Feb 11, 2020

    @kashifiqb
    Contributor

    @charleszhn ,

    We are very sorry for the late response. For technical assistance, please post your query to our Aspose.HTML forum.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions