Skip to content

[css] margin not working in html plugin #413

@Flamenco

Description

@Flamenco

This does not work:

<div style='margin:72pt'>
PDF
</div>

This does:

<div style='margin-top:72pt'>
PDF
</div>

Also, the horizontal unit scaling does not seem correct here:

<div style='margin-top:72pt;margin-left:72pt'>
PDF
</div>

This fixes it for me, but I am not familiar enough with the code to see what might break. It may also be due to a unit conversion issue with the line[][] logic:

            //if we have to move the cursor to adapt the indent
            var indentMove = 0;
            //if a margin was added (by e.g. a text-alignment), move the cursor
            if (line[0][1]["margin-left"] !== undefined && line[0][1]["margin-left"] > 0) {
                wantedIndent = this.pdf.internal.getCoordinateString(line[0][1]["margin-left"]);
                indentMove = wantedIndent - currentIndent;
                currentIndent = wantedIndent;
            }
            var indentMore = (Math.max(blockstyle["margin-left"] || 0, 0)) * fontToUnitRatio;
            //move the cursor
            out(indentMove + indentMore, (-1 * defaultFontSize * maxLineHeight).toFixed(2), "Td");

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions