Skip to content
Discussion options

You must be logged in to vote

@newproplus, thanks for you response.

I solve this problem doing this:

import { WebviewWindow } from '@tauri-apps/api/window';
import { Buffer } from "buffer"
import { readBinaryFile, BaseDirectory } from '@tauri-apps/api/fs';

export async function openInvoicePDF(path: string) {

    const content = await readBinaryFile(path, { dir: BaseDirectory.AppCache })
    const base64PDF = Buffer.from(content).toString('base64')

    const invoiceWindow = new WebviewWindow('invoiceWindow', {
        url: `invoicePdfViewer.html?pdfData=${encodeURIComponent(base64PDF)}`,
        title: "Factura",
        width: 800,
        height: 600,
        center: true,
        fileDropEnabled: true
    })

   …

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@ithustle
Comment options

Answer selected by ithustle
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants