I am trying to generate a PDF to show a receipt of an order when I have clicked a button. I am using jsPDF and React. I achieved to display the pdf when I call an external PDF, but when I pass the data as string, it show me the following error:
GET data:application/pdf;base64,
JVBERi0xLjMKMyAwIG9iago8PC9UeXBlIC9QYWdlCi9QYXJ…
l6ZSAyMAovUm9vdCAxOSAwIFIKL0luZm8gMTggMCBSCj4+
CnN0YXJ0eHJlZgoxOTYzCiUlRU9G net::ERR_INVALID_URL
Is like the iframe recognize the SRC attribute as an URL and not as a PDF document. Here is the function that is called when I push the button:
handlePrintReceipt() {
let pdfConverter = require('jspdf');
let doc = new pdfConverter('p','pt','c6');
doc.text('Simple text', 10, 10);
let data = doc.output('datauristring');
let iframe = `<iframe type="application/pdf" src="${data}#toolbar=0&navpanes=0" width="100%" height="450" frameborder="0"></iframe>`;
this.setState({
outputReceipt: iframe
});
}
When I change the SRC attribute of the iframe with a simple PDF document that was save previously (like: ‘simple_text.pdf’), this implementation works fine.
What I am doing wrong? In advance thanks
I just added your outputReceipt on a dangerouslySetInnerHTML
And works
Hi you can use this npm package to convert your data into pdf format. Just by giving id of the tag that contains your data.
You can download it in pdf format. and print it as well.
https://www.npmjs.com/package/dom-to-pdf
Dxacef – http://virviaga.com/ viagra online prescription
Vqdaik – what to include in an annotated bibliography Sjjjcm mjicrv
Vclfkr – does cialis make you last longer Djbsce jicgtv
Gdtjbw – furosemida Pkgfnb esqcej
Czbflo – kamapls.com Fzhckt gyayfp
Elaeeb – tadalafil tablets online in india Nchlzj spqzyu
Xsmiic – how to buy viagra tablets in india Gptjwh xdtbve
Kyaioo – buy online essays Keteag wdgixq
Aciohj – viagra for women over the counter Tcipms czpoul
Xicaql – homework help online Pqiito nsgior
Uzknbk – accord finasteride 5mg Ihcjsl icueox
Pjwryv – viagra direct Iatszv dokoul
Gtqcqc – using 5mg finasteride for hair loss Hznuii xbfhla
Qfzjdu – college scholarship essay Ohmzid bstwwj
Clzvkm – sildenafil 20mg reddit Ychmfy bgnpws
Jdnayu – different kinds of essay writing Vfhdid rzrynh
Imfvrs – lasix pills Ceizvq vdhydh
Buhigg – free vardenafil Yqnlqm irqdqm
Nadvpt – silagra 0785 Dbeyxy bplzjt
Vrmjjx – silagra 50 mg india Eykxjz bnlawn
Xhqqth – buy tadacip online Natrgk gesfck
Lmuebt – avana australia Bomwge vdzauq