Skip to content

addImage documentation #434

@doubletaketech

Description

@doubletaketech

I have a screenshot image taken from an HTML5 Canvas. It may be taller than one page or span the equivalent of multiple pages in the PDF. How do I set the addImage options so that it will use the actual height of the canvas?
I tried using canvas width and height, but it just zooms and blurs.

I can't find any documentation on jsPDF addImage() to see if there is a way to adjust the options to have a single image with a height that adjusts.

Here is my code

var element = $('#report');
        html2canvas(element, {
            onrendered: function(canvas) {
                var doc = new jsPDF('landscape');
                var dataUrl = canvas.toDataURL('image/jpeg');
                doc.addImage(dataUrl,0,0,canvas.width,canvas.height);
                doc.save('MeterPhotosReport.pdf');   
            }
        });

Thanks,
Don

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions