galkahana / HummusJS

Node.js module for high performance creation, modification and parsing of PDF files and streams
http://www.pdfhummus.com
Other
1.14k stars 169 forks source link

Text in fillform cutted at bottom #201

Closed DamickDoni closed 6 years ago

DamickDoni commented 6 years ago

All inserted text blocks are aligned at the left bottom. This throw issues when letters like "yg", are printed (yg are cutted and looks like: "y = v". Is there any workaround?

DamickDoni commented 6 years ago

Where can I find the code, that puts the data into the Fields? Maybe I can manipulate that.

DamickDoni commented 6 years ago

I have solved this problem by using the Ts() Operator in xobjectForm

mrsufgi commented 6 years ago

Hey, Im trying to fix the example to fill out fields with centered text. I'm how did u use Ts() to fix it?

fcapDonny commented 6 years ago

I fixed it with:

xobjectForm.getContentContext()
    .writeFreeCode('/Tx BMC\r\n') .q() .BT()
    .writeFreeCode(da + '\r\n')
    .Ts(2)
    .Tf(font,6)
    .writeText(
        text,0,0,
        {
            size: 6,
            colorspace: 'rgb',
            color: 000000,
            font: font
        }
    ) .ET().Q()
 .writeFreeCode('EMC');
handles.writer.endFormXObject(xobjectForm);`

But I don't use Hummus anymore. I now use PDFTK with Pdffiller (https://www.npmjs.com/package/pdffiller). It is more comfortable and easier to expand