Posts

Showing posts with the label Pdf Generation

Android PdfDocument File Size

Answer : There are a few main things that increases the size of a PDF file: hi-resolution pictures (where lo-res would suffice) embedded fonts (where content would still be readable "good enough" without them) PDF content not required any more for the current version/view (older version of certain objects) embedded ICC profiles embedded third-party files (using the PDF as a container) embedded job tickets (for printing) embedded Javascript and a few more Try using iText. Following links give a basice idea for iText in android. http://technotransit.wordpress.com/2011/06/17/using-itext-in-android/ http://www.mysamplecode.com/2013/05/android-itext-pdf-bluetooth-printer.html https://stackoverflow.com/a/21025162/3110609 In case anyone is still looking for a solution... I was working on a project to generate PDF from images and not satisfied with the file size generated by both Android's PdfDocument and 3rd party AndroidPdfWriter APW. After some trials I ended...

Add Image In Header Using Html-pdf Node Module

Image
Answer : It is possible to add the image in options header. 1.Load the image in html body with "display:none" style. 2.Then add the image in the options header By doing this the image is cached and can attach the image in header. var options = { "format": 'Letter', "orientation": "portrait", "header": { "contents": "<img src='image path' />", "height": "30mm" }, "footer": { "contents": footer } } pdf.create("<div style='display:none'><img src='image path' /></div>", options).toFile("sample.pdf", function(err, res) { if (err) { console.error(err); callback(); } }); Refering to this issue on the github, you can't put your image directly in options.header , you have to put it in the body inside a <div id=...