ABCPDF not showing full table data

2019-01-29 04:19发布

问题:

Please refer to the image below:

It's cutting off some of the table data because of the width. My table width is more than 1000 px. I know The default document size for ABCpdf is 612 by 792.

Using the code below to set document width and height

            double w = doc.MediaBox.Width;
            double h = doc.MediaBox.Height;
            double l = doc.MediaBox.Left;
            double b = doc.MediaBox.Bottom;
            doc.Transform.Rotate(90, l, b);
            doc.Transform.Translate(w, 0);
            doc.Rect.Width = h;
            doc.Rect.Height = w;

I want to display all tabular data. Do I need to modify my table size? Or do I need to modify the document page size of the pdf?

How could i resolve this issue?

Thanks,

Siva

回答1:

After reviewing the HTML, I think that I can give you a few tips on how to resolve your issue:

1- Use the Gecko Engine for PDF Rendering:

doc.HtmlOptions.Engine = WebSupergoo.ABCpdf9.EngineType.Gecko;

The Gecko Engine provides better Css compliance when rendering in ABCPdf.

2- In your Css you have overflow-x set to scroll for the inner-container. This causing the behavior that you are seeing. I would add the following Css to the bottom of the Css:

@media print
{
    .outer-container {
        background-color: #ccc;
        position: absolute;
        top:0;
        left: 0;
        right: 300px;
        bottom:40px;
        overflow: visible;
        width: 100%;
    }
    .inner-container {
        width: 100%;
        height: 100%;
        position: relative;
        overflow-x: visible;

    }

    table
    {
        width: 100%;
    }
}

Notice the @media print which makes the css only effective during print and would not affect that way it shows on the screen.

3- Finally, you can try playing with the browser width:

doc.HtmlOptions.BrowserWidth = 1200;

The only problem with the BrowserWidth property is that it will affect the zoom on the document. All the text fonts will appear smaller.

Good luck...



回答2:

You haven't specified if you are converting an HTML page to PDF- but I assume you are. If that is the case, have you looked at the browser width property? Look into the XHTMLOptions object properties- it will help you fine tune the rendering:

http://www.websupergoo.com/helppdfnet/source/5-abcpdf/xhtmloptions/