Kendo UI is it possible to draw directly on the kendo-pdfviewer from the angular component library.
Things II have tried:
-embedding it in a drawing component to draw over - the problem here being that the kendo-pdfviewer is removed from the page completely to make way for the canvas
-I tried to super impose the canvas over the kendo-pdfviewer with a relative off set of -y in CSS - The problem here was that although it worked for the most part the canvas then blocked the PDF controls such as scrolling (especially if set to the same size).
-I tried to hook the canvas in the PDF to draw - here I just did not see any success. It seemed like either I was drawn over or it simply was not used. Not the canvas is height="2376" x width="1836"
Here is some rough code for the last option I tired:
Things II have tried:
-embedding it in a drawing component to draw over - the problem here being that the kendo-pdfviewer is removed from the page completely to make way for the canvas
-I tried to super impose the canvas over the kendo-pdfviewer with a relative off set of -y in CSS - The problem here was that although it worked for the most part the canvas then blocked the PDF controls such as scrolling (especially if set to the same size).
-I tried to hook the canvas in the PDF to draw - here I just did not see any success. It seemed like either I was drawn over or it simply was not used. Not the canvas is height="2376" x width="1836"
Here is some rough code for the last option I tired:
public pdfLoad(pdfViewerLoadEvent: PDFViewerLoadEvent)
{
this.pdfViewerContext = pdfViewerLoadEvent.context;
this.pdfViewerContext.pdfDoc.getPage(1).then(async (page)=>{
var scale = this.pdfViewerContext.zoom;
var viewport = page.getViewport({scale});
var canvas: HTMLCanvasElement = document.getElementById('the-canvas') as HTMLCanvasElement;
var context = canvas.getContext('2d')!;
canvas.width = Math.floor(viewport.width * scale);
canvas.height = Math.floor(viewport.height * scale);
canvas.style.width = Math.floor(viewport.width) + "px";
canvas.style.height = Math.floor(viewport.height) + "px";
context.beginPath();
context.arc(300, 300, 100, 0, 2);
context.stroke();
var transform: number[] | undefined = scale !== 1
? [scale, 0, 0, scale, 0, 0]
: undefined;
var transform: number[] | undefined = [2,0,0]
await page.render({
canvasContext: context!,
transform: transform,
viewport: viewport
});
context.beginPath();
context.arc(300, 300, 100, 0, 2);
context.stroke();
});
}