react-pdf-highlighter icon indicating copy to clipboard operation
react-pdf-highlighter copied to clipboard

Convert screenshot when load

Open atraining opened this issue 5 years ago • 2 comments

IIn Sidebar.js I have seen

<img src={highlight.content.image} alt={"Screenshot"} />

In my case I only have the coordinates of the boundingRect I want to display. What is the easiest way to create the image (content.image) from the HTMLCanvas when the page loads the first time?

In the demo/sr/App.js the image is first rendered when the boundingRect changes

                 <AreaHighlight
                      highlight={highlight}
                      onChange={boundingRect => {
                        this.updateHighlight(
                          highlight.id,
                          { boundingRect: viewportToScaled(boundingRect) },
                          { image: screenshot(boundingRect) }
                        );
                      }}
                    />

atraining avatar Dec 23 '19 14:12 atraining

Would exposing ref on <PdfHighlighter /> help?

<PdfHighlighter
  ref={pdfHighlighter => {
    // save instance
    this.pdfHighlighter = pdfHighlighter;
  }}
  {...restProps}
/>;

// later
this.pdfHighlighter.screenshot(/* ... */);

agentcooper avatar Jan 26 '20 15:01 agentcooper

Would exposing ref on <PdfHighlighter /> help?

<PdfHighlighter
  ref={pdfHighlighter => {
    // save instance
    this.pdfHighlighter = pdfHighlighter;
  }}
  {...restProps}
/>;

// later
this.pdfHighlighter.screenshot(/* ... */);

this is give me blank image please help me

qbdchandresh009 avatar Oct 14 '20 04:10 qbdchandresh009