Comments (2)
Try something like this:
NSData *imageData = UIImageJPEGRepresentation([UIImage imageNamed:@"IMAGENAME.jpg"], 1);
NSString *stringBase64 = [imageData base64EncodedStringWithOptions:NSDataBase64Encoding64CharacterLineLength];
NSString *html = @""; html = [html stringByAppendingString:[NSString stringWithFormat:@"<div align=\"left\"><img src=\"data:image/jpg;base64,%@\" align=\"absmiddle\" style=\"width:100%% \" /> </div>", stringBase64]];
PDFCreator = [NDHTMLtoPDF createPDFWithHTML:html pathForPDF:[@"~/Documents/manualDemo.pdf" stringByExpandingTildeInPath] delegate:self pageSize:kPaperSizeA4 margins:UIEdgeInsetsMake(10, 5, 10, 5)];
from ios-htmltopdf.
i tried that also but still not working for me
if let img = UIImage(data: imgData), let newImgData = img.jpegData(compressionQuality: 0.2) { arrImages.append(newImgData) } let base64String = arrImages[0].base64EncodedString(options: .lineLength64Characters) <img style=\"margin-top:10px\" src='data:image/png;base64,\(String(describing: base64String) )>
it's not working in 3/10 times, means when run PDF generate then 3 times approx nor working, don't know why it happen
from ios-htmltopdf.
Related Issues (20)
- Content is cropped if too wide HOT 5
- Multiple HTML files to one PDF HOT 1
- Balnk page because of page-break trough CSS HOT 3
- Crashes on iOS8.1 HOT 5
- page breaks HOT 4
- PDF coming in two pages HOT 4
- How to get page number display on header HOT 2
- not recognising href tag HOT 1
- Unwanted scale factor when rendering pages
- Swift compatible?
- Carthage support HOT 1
- iPad pdf generate issue HOT 1
- HTMLtoPDF did fail error HOT 1
- increase margin for first page
- Hyperlink not working HOT 1
- Convert multiple HTML to multiple pdf using a for loop.
- Footer for pdf
- pod update not getting latest version
- Images missing after change to WKWebView HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ios-htmltopdf.