MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/nodejs-docs-samples / printBlocks

Function printBlocks

document-ai/process-document-ocr.js:109–118  ·  view source on GitHub ↗
(blocks, text)

Source from the content-addressed store, hash-verified

107 };
108
109 const printBlocks = (blocks, text) => {
110 console.log(` ${blocks.length} blocks detected:`);
111 const firstBlockText = getText(blocks[0].layout.textAnchor, text);
112 console.log(` First block text: ${JSON.stringify(firstBlockText)}`);
113 const lastBlockText = getText(
114 blocks[blocks.length - 1].layout.textAnchor,
115 text
116 );
117 console.log(` Last block text: ${JSON.stringify(lastBlockText)}`);
118 };
119
120 const printLines = (lines, text) => {
121 console.log(` ${lines.length} lines detected:`);

Callers 1

processDocumentFunction · 0.85

Calls 1

getTextFunction · 0.70

Tested by

no test coverage detected