Skip to content

Odd characters added when attempting to color text on input field #1042

Answered by weagle08
weagle08 asked this question in Q&A
Discussion options

You must be logged in to vote

So the issue seems to be in the PDFHexString.fromText() method. It pads the start of the text and this is the source of the problem... I implemented a simple toHex function and all works as expected. Is there an issue with the PDFHexString.fromText() method that needs to be filed as a bug or am I using this method for the wrong purpose?

    toHexString(str: string) {
        let retVal = '';
        for (let i = 0; i < str.length; i++) {
            let hex = str.charCodeAt(i).toString(16);
            retVal += hex;
        }

        return retVal;
    }

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@Hopding
Comment options

Answer selected by weagle08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants