Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

157
Views
Annotated canvas rendering in Google Docs

I am currently working on a Chrome extension and want it to work on Google Docs to highlight the text. Google docs is moving to the Canvas rendering for pages which basically removes all the text from the DOM and we only have a canvas element in the DOM for every page.

I have noticed that by setting window._docs_force_html_by_ext = <extension-id> on the Google docs webpage, we can force it to render DOM as HTML, not as canvas. This works fine for me. I have also seen some extensions set window._docs_annotate_canvas_by_ext = <extension-id> and that ensures that the canvas rendered is annotated with a lot DOM elements inside the canvas element. This annotated canvas allows for positional computations for the text.

I have tried inserting the script the same way but it does not seem to have any effect on the DOM. Is there anything else I need to do?

Any help is highly appreciated. Thanks in advance.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

At the current moment in time the HTML Fallback option will render before the Annotated Canvas option. This means that if you have any extension running that forces the HTML Fallback option then the Annotated Canvas option wont render.

This is sad news for those who has a running integration with Annotated Canvas option because any other application installed might force the script back to the HTML Fallback option.

Personally i apply a simple check and handle both solutions based on what the document returns:

const runInitializers = (): void => {
  const canvasFirstPage = document.querySelector(
    '#kix-appview > div.kix-appview-editor-container > div > div:nth-child(1) > div.kix-rotatingtilemanager.docs-ui-hit-region-surface > div > div.kix-page-paginated.canvas-first-page'
  );

  const fallbackFirstPage = document.querySelector(
    '#kix-appview > div.kix-appview-editor-container > div > div:nth-child(1) > div.kix-zoomdocumentplugin-outer > div > div > div > div:nth-child(2) > div'
  );

  if (canvasFirstPage) {
    initAnnotatedCanvas();
  } else if (fallbackFirstPage) {
    initHTMLFallback();
  }
};
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!