pdfmake

How to convert html table to pdf using pdfmake

◇◆丶佛笑我妖孽 提交于 2019-12-25 18:39:08
问题 Am trying to convert my html table to pdf using pdfmake http://pdfmake.org/ but i cant make it to how to use <!DOCTYPE html> <html> <?php $pdffile = md5(time()).'.pdf'; ?> <script src="jquery-1.7.2.min.js" type="text/ecmascript"></script> <script src="pdfmake.min.js" type="text/javascript"></script> <script src="vfs_fonts.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function(e) { var table = document.getElementById('table').outerHTML; var table =

Nested/Sub Tables with PDFMake

点点圈 提交于 2019-12-25 06:45:45
问题 How do I use nested/sub tables with PDFmake? I've tried simply putting in multiple tables but that doesn't automatically repeat the top level table's header for page breaks. 回答1: This code is a simplified example of using a sub-table. It is adapted from tables section of the pdfmake playground (wasn't easy to find via Google searching). Paste the following into: http://pdfmake.org/playground.html // playground requires you to assign document definition to a variable called dd var dd = {

server side fonts directory in pdfmake in meteor app

筅森魡賤 提交于 2019-12-24 15:45:59
问题 I am trying to create and save a pdf on the server. I have used meteorhacks:npm packaged and installed pdfmake on the server side. My code is in a subdirectory under server directory. I am using just the example to make sure I can generate a basic pdf. var fonts = { Roboto: { normal: 'fonts/Roboto-Regular.ttf', bold: 'fonts/Roboto-Medium.ttf', italics: 'fonts/Roboto-Italic.ttf', bolditalics: 'fonts/Roboto-Italic.ttf' } }; var PdfPrinter = Meteor.npmRequire('pdfmake/src/printer'); var printer

Embedding a background image in pdfmake

无人久伴 提交于 2019-12-22 08:38:39
问题 I'm using pdfmake http://bpampuch.github.io/pdfmake/index.html#/gettingstarted to implement html to pdf conversion. To create a PDF, I'm using some hard-coded text and some text pulled in with AngularJS from a .json file. All works well for the exception of the background image. Has anyone done this before? Used a background image with pdfmake? I would like to get some advice on how to force it to grab it and actually put it in the background. Thanks. 回答1: Turns out that in order to set an

DataTables & PDFmake

烈酒焚心 提交于 2019-12-22 07:04:26
问题 I'm trying to work with DataTables Export feature, where I am able to export as CSV, xlxs, pdf. Now my current requirement is to export a custom pdf (change the font size, color, etc.). In the DataTable documentation it states, that we can integrate it with PDFmake, which I am unable to do so. If anyone could please help in a way to integrate/use PDFmake with DataTables it would be really helpful. Thanks in advance. I'm initialising the DataTables var table = $('#Table').DataTable( {

Javascript object scope - image dataurls into pdfMake

≡放荡痞女 提交于 2019-12-13 16:51:18
问题 Trying to dynamically create a pdf using pdfMake from JSON data and the report runs fine except for my images. I have tried using named keys into an object as well as pushing into an array, and even directly into the docDefinition and it appears that they contain the data on console.log but always come back undefined. The only time it actually works if I directly assign it outside of the each ( //imageData["image0"] = testDataURL; ) but this doesn't work for me as I need to get the dataurl of

pdfmake generates blank pdf

微笑、不失礼 提交于 2019-12-13 16:23:12
问题 I'm trying to use pdfmake for generating pdf from html with html2canvas in angular2 here is my code this is a sample code what im trying to do original html contains dynamic data from APIs and whole page is too long thats why I tried to divide it with div component.ts createPdf(): void { var data_1; var data_2; var data_3; var data_4; var data; var p1 = new Promise((resolve, reject) => { html2canvas(document.getElementById('home'), { onrendered: function (canvas) { console.log(canvas); canvas

pdfmake use in an application with webpack

对着背影说爱祢 提交于 2019-12-13 14:18:58
问题 I'm just going to build an application in Webpack and would like to integrate pdfmake unfortunately I encounter this problems. I have the file "pdfmake.js" are in my "web_modules" folder and put them with Var pdfmake = require(" pdfmake "); When I call the: pdfMake.createPdf(docDefinition).open (); doing, he tells me "CreatePDF" is not a function that has struck me, and I found that I call the "File Saver" and not "pdfmake" get back at these locations. Has this happened to anyone of you have

Use Glyphicons or Font-Awesome in pdfmake prints

坚强是说给别人听的谎言 提交于 2019-12-12 09:57:20
问题 I am developing a webapp using pdfmake for the printing. In more recent days I started using Glyphicons and Font-Awesome-Icons in my project, now I need those in the printout as well. But I can't really imagine what would be the best way to achieve this. I see two possibilities: Include the respective Font in pdfmake and create something like a map which determines the Icons font-representation by it's class name (because this is what is used in the app). In this case I could still use the

PDFMake - make PDF from dynamical content (an array)

╄→尐↘猪︶ㄣ 提交于 2019-12-12 05:14:40
问题 I'm having trouble creating PDF file, where I can put a data from array dynamically, with for loop for example. Length of the array can be different every time so there is no way I'll just write for one size of array. There is example what I'm able to do: var stuff = [ 'aaaaaaaaaaaaaaaaaaa', 'bbbbbbbbbbbbbbbbbbb', 'ccccccccccccccccccc', 'ddddddddddddddddddd' ] var dd = { content: [ {text: stuff[0], pageBreak: 'after'}, {text: stuff[1], pageBreak: 'after'}, {text: stuff[2], pageBreak: 'after'}