Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

watermark text does not show up #36

Open
chrisserverless opened this issue Jun 5, 2023 · 0 comments
Open

watermark text does not show up #36

chrisserverless opened this issue Jun 5, 2023 · 0 comments

Comments

@chrisserverless
Copy link

chrisserverless commented Jun 5, 2023

I am using Vue 3.3.4

When I bind the watermark property to the component, it does not show up and this.$refs.VueCanvasDrawing.save() returns null:

<vue-drawing-canvas v-bind="options" ref="VueCanvasDrawing" />

<script>
    import VueDrawingCanvas from "vue-drawing-canvas";
    import { defineComponent } from 'vue';
    export default defineComponent({
        components: {
            VueDrawingCanvas,
        },
        data() {
            return {
                loading: false,
                status: null,
                errorMessage: null,
                options: {
                    color: "#003366",
                    watermark: {
                        type: "Text",
                        source: "TESTING!!!!",
                        x: 200,
                        y: 180,
                        fontStyle: {
                            color: '#000000',
                            drawType: 'fill',
                            textAlign: 'center'
                        }
                    }
                }
            };
        },
        methods: {
            reset() {
                this.$refs.VueCanvasDrawing.reset();
            },
            exportImage() {
                var x = this.$refs.VueCanvasDrawing.save();
                this.saveImage(x);
            },
            saveImage(x) {
                this.post = null;
                this.loading = true;
                const requestOptions = {
                    method: "POST",
                    headers: { "Content-Type": "application/json" },
                    body: JSON.stringify({ esig: x })
                };
                fetch("electronicsignature", requestOptions)
                    .then(r => {
                        this.status = r.statusText;
                        this.loading = false;
                    }).catch(error => {
                        this.errorMessage = error;
                        console.error("Error:", error);
                    });
            }
        }
    });
</script>
After that then var x = this.$refs.VueCanvasDrawing.save(); - x is always null. If I remove the v-bind="options" then x is populated with the image data. I appreciate your help!
@chrisserverless chrisserverless changed the title Passing props - newbie question watermark text does not show up Jun 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant