GithubHelp home page GithubHelp logo

christopherdro / react-native-html-to-pdf Goto Github PK

View Code? Open in Web Editor NEW
423.0 11.0 266.0 273 KB

Convert html strings to PDF documents using React Native

License: MIT License

Objective-C 37.20% JavaScript 11.28% Java 44.51% Ruby 1.78% Starlark 5.23%

react-native-html-to-pdf's Introduction

react-native-html-to-pdf

Convert html strings to PDF documents using React Native

Installation

  1. Run npm install react-native-html-to-pdf --save

Option 1: Automatic

  1. Run react-native link

Option 2: Manual

iOS

  1. Open your project in XCode, right click on Libraries and select Add Files to "Your Project Name.
  2. Add libRNHTMLtoPDF.a to Build Phases -> Link Binary With Libraries (Screenshot).

Android

  • Edit android/settings.gradle to included
include ':react-native-html-to-pdf'
project(':react-native-html-to-pdf').projectDir = new File(rootProject.projectDir,'../node_modules/react-native-html-to-pdf/android')
  • Edit android/app/build.gradle file to include
dependencies {
  ....
  compile project(':react-native-html-to-pdf')

}
  • Edit MainApplication.java to include
// import the package
import com.christopherdro.htmltopdf.RNHTMLtoPDFPackage;

// include package
new MainReactPackage(),
new RNHTMLtoPDFPackage()
  • Add the following WRITE_EXTERNAL_STORAGE permission to AndroidManifest.xml
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

Also starting from Android M, users need to be prompted for permission dynamically. Follow this link for more details on how to do that.

Usage

import React, { Component } from 'react';

import {
  Text,
  TouchableHighlight,
  View,
} from 'react-native';

import RNHTMLtoPDF from 'react-native-html-to-pdf';

export default class Example extends Component {
  async createPDF() {
    let options = {
      html: '<h1>PDF TEST</h1>',
      fileName: 'test',
      directory: 'Documents',
    };

    let file = await RNHTMLtoPDF.convert(options)
    // console.log(file.filePath);
    alert(file.filePath);
  }

  render() {
    return(
      <View>
        <TouchableHighlight onPress={this.createPDF}>
          <Text>Create PDF</Text>
        </TouchableHighlight>
      </View>
    )
  }
}

Options

Param Type Default Note
html string HTML string to be converted
fileName string Random Custom Filename excluding .pdf extension
base64 boolean false return base64 string of pdf file (not recommended)
directory string default cache directory Directory where the file will be created (Documents folder in example above). Please note, on iOS Documents is the only custom value that is accepted.
height number 792 Set document height (points)
width number 612 Set document width (points)

iOS Only

Param Type Default Note
paddingLeft number 10 Outer left padding (points)
paddingRight number 10 Outer right padding (points)
paddingTop number 10 Outer top padding (points)
paddingBottom number 10 Outer bottom padding (points)
padding number 10 Outer padding for any side (points), overrides any padding listed before
bgColor string #F6F5F0 Background color in Hexadecimal

Android Only

Param Type Default Note
fonts Array Allow custom fonts ['/fonts/TimesNewRoman.ttf', '/fonts/Verdana.ttf']

react-native-html-to-pdf's People

Contributors

albertwchang avatar atennapel avatar christopherdro avatar danielmschmidt avatar dbanck avatar dependabot[bot] avatar flyandi avatar georgeaugusto8 avatar guillecaba avatar islamsalah avatar jtara1 avatar liamjones avatar ligia-andreica avatar marcossarges avatar matthieulemoine avatar mjm918 avatar nicolas-menettrier avatar parkerdan avatar pierrecavalet avatar r3nya avatar rashidul-hasan avatar shubhamdeol avatar simonerm avatar snyderra avatar sychevsp avatar tommyleong avatar valioz avatar vittoridavide avatar wbroek avatar wootwoot1234 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-native-html-to-pdf's Issues

Doesn't work for html5 in android

itext will error with:
com.itextpdf.tool.xml.exceptions.RuntimeWorkerException: Invalid nested tag head found, expected closing tag meta.
Error: com.itextpdf.tool.xml.exceptions.RuntimeWorkerException: Invalid nested tag head found, expected closing tag meta.

or other similar error. need to use a different pdf generator on android or else convert html5 to xhtml

Unable to resolve module react-native-html-to-pdf ....

When i launch my application i got the "unable to resolve module react-native-html-to-pdf" error.

I try to clear watchman, delete the module and reset the packager cache but no one works. I also relink the libraries, restart xcode and the terminal, clean and rebuild the project reinstall with rnpm .. Do you have any suggestion ?

the warning :
warningreact

my "project" :
librariestest

npm install in Example folder has lots of warnings and errors

Hi Christopher,

Thanks for creating this module. I am eager to try out. I noticed that the npm install has several errors on gyp-build. And after npm install, I run "react-native run-ios" and i got the error below:

(node:4626) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
Command run-ios unrecognised

Did I miss anything?

Unable open pdf created with img html tag

Hi,

This is great plugin for react native developers to create pdf. I created normal text pdf. I created as expected.

When I created pdf with html img tag with local image uri,live image url,base64 of image in src attribute ,I m unable to open the pdf.And I note that pdf size is 0 bytes.

Manual paging support?

I jump into a problem currently: set paging manually
Eg: (assume I predefined page size, as options width and height). I have 2 chapters, I need each chapter to be placed on separate pages. If chapter 1 height > options.height then it will render 2 pages, 1st page is full of content, 2nd page is remaining content, the rest is blank. Chapter 2 will start from 3rd page.

How can we solve this problem? I gonna modify native code but I'm not familiar with Objective C

Android build failed execption

The below exception was thrown during build for android everything works well in ios

/testApp/android/app/src/main/java/com/mosaic/MainApplication.java:6: error: cannot find symbol
import com.parkerdan.htmltopdf.RNHTMLtoPDFPackage;
                              ^
  symbol:   class RNHTMLtoPDFPackage
  location: package com.parkerdan.htmltopdf
/testApp/android/app/src/main/java/com/mosaic/MainApplication.java:30: error: cannot find symbol
            new RNHTMLtoPDFPackage(),
                ^
  symbol: class RNHTMLtoPDFPackage
2 errors
:app:compileDebugJavaWithJavac FAILED

Android support not working

Instruction mentioned adding
include ':react-native-html-to-pdf'
project(':react-native-html-to-pdf').projectDir = new File(rootProject.projectDir,'../node_modules/react-native-html-to-pdf/android')

But there's no ./node_modules/react-native-html-to-pdf/android folder.

can't add font

how should I add address of font into project?
i tried every where but fire error
Error: ExceptionConverter: java.io.IOException: ../assets/fonts/BYekan.ttf not found as file or resource.
Error: ExceptionConverter: java.io.IOException: ../assets/fonts/BYekan.ttf not found as file or resource.

Is there a way to control DPI

I'm trying to print out a custom label using this and the react native print module as well. Is there anyway to control the dpi? I'm having issues with images which are at the right resolution printing at what looks like 72dpi as opposed to the 300 I am aiming for.

thanks

Style Box-Shadow not working on Android

Hi,

greate Libarary. I got a problem with box-shadow style on android. I have a card like element, that looks the following:

<div style="box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2); padding: 8px; margin-top: 16px; margin-left: 4px; page-break-inside: avoid; display:inline-block; width:635px">

On iOS, it looks good, but on android it is not working. The shadow is missing. Any Ideas why or any workarounds?

Thanks,
Daniel

Landscape

how to save the html in landscape?
<center><h1>Visitor</h1><h1>NAME: Walter Shub</h1><img src="data:image/png;base64,${image}" width="600" height="600" /></center>

Print qrCode

i use react-native-qrcode and i want print an qrcode. How to print an qrcode with react-native-html-to-pdf ?

cannot build the app

Execution failed for task ':app:transformClassesWithDexForDebug'.

com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: java.lang.UnsupportedOperationException

Support Html Image Tag

Everytime I add html image tag with external link of image to the html string, it does not generate pdf.

Does this support fonts and css?

I'm looking at using this to create a pdf in one of my projects but wanted to know how much control I have over the formatting and styling on the PDF. I didn't see any thing in the docs.

does not support the chinese word

Thank you for the great component.

My app need to support the chinese word.
IOS is OK.
but Android is NG.
Would you like to give some advices?

Thanks.

Error after upgrading to 0.6.0

Hello,

After upgrading to 0.6.0, I am unable to generate a pdf and get this error on android :

Fatal Exception: java.lang.IllegalArgumentException: fd cannot be null
at org.chromium.android_webview.AwPdfExporter.exportToPdf(AwPdfExporter.java:53)
at org.chromium.android_webview.AwPrintDocumentAdapter.onWrite(AwPrintDocumentAdapter.java:70)
at android.print.PdfConverter$1.onPageFinished(PdfConverter.java:67)
at com.android.webview.chromium.WebViewContentsClientAdapter.onPageFinished(WebViewContentsClientAdapter.java:546)
at org.chromium.android_webview.AwContentsClientCallbackHelper$MyHandler.handleMessage(AwContentsClientCallbackHelper.java:201)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6540)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

Is this release broken or am I the only one getting this error ?

cannot build

After updating React from 15.4 to 16.0.0, RN: 0.40.0 to 0.50.1, get error

:react-native-html-to-pdf:compileReleaseJavaWithJavac
.../app/node_modules/react-native-html-to-pdf/android/src/main/java/com/christopherdro/htmltopdf/RNHTMLtoPDFPackage.java:15: error: method does not override or implement a method from a supertype
    @Override
    ^
Note: .../app/node_modules/react-native-html-to-pdf/android/src/main/java/com/christopherdro/htmltopdf/RNHTMLtoPDFModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 error
:react-native-html-to-pdf:compileReleaseJavaWithJavac FAILED

FAILURE: Build failed with an exception.

package.json:

    "react-native-html-to-pdf": "^0.4.0",

any solution?

Possible Unhandled Promise Rejection

I installed the package correctly and it works in iOS, but when I execute the code in Android I got this error: Possible Unhandled Promise Rejection (id: 0): TypeError: undefined is not an object (evaluating _reactNativeHtmlToPdf2.default.convert) How can I fix this error?

[Android] createPDF function doesn't work

First, I could use createPDF function.
But, suddenly, I got the following error when I called createPDF function.

ExceptionConverter: java.io.IOException: The document has no pages.

2018-01-23 19 19 30

Does anyone know the solution for this error?
Plese, teach me!!

This is my code.

import React, { Component } from "react";
import { TouchableHighlight, StyleSheet, Text, View } from "react-native";

import RNHTMLtoPDF from "react-native-html-to-pdf";

const html =
  '<svg width="600" height="150" viewBox="0 0 600 150"><polyline points="50,25 50,75 100,75 100,125 150,125" stroke="#000" fill="none"></polyline></svg><svg width="600" height="180" viewBox="0 0 600 180"><polygon points="0,50 75,0 150,50 150,150 0,150" fill="yellow"></polygon> </svg>';

export default class App extends Component {
  createPDF = async () => {
    const options = {
      html,
      fileName: "test",
    };

    try {
      const file = await RNHTMLtoPDF.convert(options);
      console.log(file);
    } catch (err) {
      console.error(err);
    }
  };

  render() {
    return (
      <View style={styles.container}>
        <TouchableHighlight style={styles.button} onPress={this.createPDF}>
          <Text> Create PDF</Text>
        </TouchableHighlight>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: "center",
    alignItems: "center",
    backgroundColor: "#F5FCFF"
  },
  button: {
    alignItems: "center",
    backgroundColor: "#DDDDDD",
    padding: 10,
    margin: 20
  }
});

Can we use chart?

I made health care app that use chart.
And then, I want to export pdf file displayed that chart.
I use react-native-highcharts.

Is there any nice way ?

Update version on npm

I just had added this to a new project npm still has an outdated version without my latest fix. Do you mind updating the npm version?

Thanks!

which html tags are available?

Hi,
I am using this library for some time but I was only using headers and

, but now I want to use a big string with multilines inside a text or textarea tags but it doenst work,
and if I use

, then I cant see this string as multilined but just bunch of words together.. so which html tags can we use?

Error after adding libraries

Something goes wrong after I add RNHTMLtoPDF.xcodeproj to the project and libRNHTMLtoPDF.a to libraries. Any idea what this error means?

/node_modules/react-native-html-to-pdf/RNHTMLtoPDF/RNHTMLtoPDF.m:132:27: error: too few arguments to block call, expected 3, have 1
_rejectBlock(error);
~~~~~~~~~~~~ ^

FAILURE: Build failed with an exception.

Hi,
I use RN 47.0 and html-to-pdf 0.5.0

FIRST, I tried the library in a new RN application and it worked.
SECOND, I added this library to my existing project and the app coudlnt run because of this error :

FAILURE: Build failed with an exception.

  • What went wrong:
    Could not read path 'C:\Users....\node_modules\react-native-html-to-pdf\android\build\generated\source\buildConfig\debug\com\parkerdan\htmltopdf'.

C:\Users...\node_modules\react-native-html-to-pdf\android\build\generated\source\buildConfig\debug\com\parkerdan\htmltopdf

Then, I rerun the code in case some software error (which I believe it is and therefore this is not an issue, I guess) and then I got the following which is more important:

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.

java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

it looks similar to #46 and I tried to solve it with gradlew clean build, still no help.. I tried many other ways but still no solution. Any ideas related to this error?

Features : get the pdf file in base64

Hello,
I would like to know if getting the pdf file in base64 with an option is envisaged ? For sending base64 pdf in an API for example.

EDIT: I made this features for iOS if someone is interested.

error: cannot find symbol import com.parkerdan.htmltopdf.RNHTMLtoPDFPackage;

I ran

npm install react-native-html-to-pdf
react-native link
react-native run-android 

And received this error. Ideas?

<redacted>/android/app/src/main/java/com/scanocr/MainApplication.java:8: error: cannot find symbol
import com.parkerdan.htmltopdf.RNHTMLtoPDFPackage;
                              ^
  symbol:   class RNHTMLtoPDFPackage
  location: package com.parkerdan.htmltopdf
<redacted>/android/app/src/main/java/com/scanocr/MainApplication.java:35: error: cannot find symbol
            new RNHTMLtoPDFPackage(),
                ^
  symbol: class RNHTMLtoPDFPackage
2 errors
:app:compileDebugJavaWithJavac FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

cann't save image tag with base64

I trying with imgage tag but not working
My code:
let options = {
html: <h1>Image</h1> <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJQAAACUCAYAAAB1PADUAAAAAklEQVR4AewaftIAAAT1SURBVO3BQY4kRxLAQDJQ//8yd45+SiBR0S2N1s3sD9a65LDWRYe1LjqsddFhrYsOa110WOuiw1oXHda66LDWRYe1LjqsddFhrYsOa110WOuiw1oXffiSym+qmFSeVEwqU8Wk8kbFpDJVfEPlN1V847DWRYe1LjqsddGHyypuUnmjYlKZKp5UTCpTxRsqb1Q8qbhJ5abDWhcd1rrosNZFH36YyhsVb1RMKlPFTSpTxVQxqfwklTcqftJhrYsOa110WOuiD385lScqTyomlaliUplUpoqp4onKf8lhrYsOa110WOuiD3+5iknlScUbKk8qJpWpYlL5LzusddFhrYsOa1304YdV/JMq3qh4Q+WJylQxqXyj4t/ksNZFh7UuOqx10YfLVH6TylQxqUwVk8pUMalMFU8qJpWbVP7NDmtddFjrosNaF9kf/MVUvlFxk8pU8URlqvibHda66LDWRYe1LvrwJZWpYlJ5UjGpvFHxDZWbKp6oTBVPVKaKJypTxaTypOIbh7UuOqx10WGtiz58qWJSeVIxqUwVb6hMFZPKVPFGxRsqU8VU8URlqnii8m9yWOuiw1oXHda66MNlFZPKpDJVPFGZKt6oeKNiUpkq3lCZKp5UPFGZKv5NDmtddFjrosNaF334YRXfqJhU3lB5Q2Wq+EbFpPKk4g2VNyomlZsOa110WOuiw1oXffiSylTxROWmiknlScVNKlPFGxWTylTxRsWk8qTipsNaFx3Wuuiw1kX2Bxep3FTxRGWqmFSeVEwqb1RMKlPFpPKNikllqniiMlXcdFjrosNaFx3WuujDZRWTylTxRGVSmSq+UTGpTBWTylTxpOIbFU9Unqi8oTJVfOOw1kWHtS46rHWR/cEvUnmj4jepTBWTypOKSWWqmFSmiknlpopJZar4xmGtiw5rXXRY66IPv6xiUnmiMlVMKlPFpDJVPKl4UjGpPKmYVKaKSWWqmFSmiknln3RY66LDWhcd1rrI/uAvpvKk4onKk4pJZar4hspU8UTlScWk8qTipsNaFx3Wuuiw1kUfvqQyVUwqTyqeqDypmFS+UfGkYlJ5o2KqmFRuqphUJpWp4huHtS46rHXRYa2L7A9+kcobFU9UpopJZaq4SeVJxaTyRsUbKm9U3HRY66LDWhcd1rrow2UqU8U3VN5QeaLyRsUbFZPKVDGpPFF5o2JS+U2HtS46rHXRYa2L7A/+YipTxaQyVUwqb1RMKlPFGypTxRsqU8UTlScV3zisddFhrYsOa1304Usqv6niicpUMalMFZPKVPGk4g2VN1SmiicqU8VU8ZMOa110WOuiw1oXfbis4iaVNyqeVEwqU8U3VKaKb1S8UfGGylTxjcNaFx3Wuuiw1kUffpjKGxVvVEwqU8Wk8obKVPGGylQxqUwqf7PDWhcd1rrosNZFH/5yKlPFb1L5RsWkMlV8Q+VJxU2HtS46rHXRYa2LPvyfqXiiMlVMKjepTBWTyhsVU8UTlaniG4e1LjqsddFhrYs+/LCKn1QxqXyj4knFpDJVTCqTyhsVk8oTlaliUvlJh7UuOqx10WGtiz5cpvKbVKaKSWWqeKIyVUwqb1S8oTJVPKmYVJ5U/KTDWhcd1rrosNZF9gdrXXJY66LDWhcd1rrosNZFh7UuOqx10WGtiw5rXXRY66LDWhcd1rrosNZFh7UuOqx10WGti/4HR6phKbnXrx0AAAAASUVORK5CYII=" width="200" height="200" />,
fileName: saveFile,
directory: 'docs',
}

RCTConvert.h not found

thanks for the great component, but on my RN app have an issue...
im using react native 0.38.0

how can i solve this issue..

Thanks

Problem with img element in Android

Hello. When I use an img tag, it is displayed in iOS but it is not displayed in Android. I have created a repo for this bug. You can find it here: https://github.com/inventrix/qrError

In the index.js file I am rendering a QR code and a button. When the button is pressed, firstly I save the QR code as a png file. Then I create a PDF file that contains this QR file. I did not include the code that displays the generated PDF file but when I pull it out by using 'adb pull' QR image is not displayed in the generated PDF.

Example doesn't work on react-native v0.21

I'm getting undefined is not an object (evaluating 'RNHTMLtoPDF.convert') error from this line: RNHTMLtoPDF.convert(options).then((result) => {

here is my code:

'use strict';

var React = require('react-native');

var {
  AlertIOS,
  AppRegistry,
  NativeModules: {
    RNHTMLtoPDF,
    RNMail
  },
  StyleSheet,
  Text,
  TouchableHighlight,
  View,
} = React;

import template from '../helpers/template';

var HTMLToPDFExample = React.createClass({

  componentDidMount() {
    var options = {
      html: template.html,
      fileName: 'test',
      directory: 'docs',
      height: 800,
      width: 1056,
      padding: 24,
    };

  RNHTMLtoPDF.convert(options).then((result) => {
    RNMail.mail({
        subject: 'Test',
        recipients: [''],
        body: '',
        attachmentPath: result,
        attachmentType: 'pdf',
      }, (error, event) => {
        if(error) {
          AlertIOS.alert('Error', 'Could not send mail. Please send a mail to [email protected]');
        }
      });
    });
  },
.....
.....

Square cropping?

For some reason, my PDFs are coming out on iOS (maybe android too, but I haven't checked) cropped to a square, which I don't understand why is happening.

I'm trying to create the PDF so it fits on a sheet of paper, but the bottom 2 or 3 inches just gets completely cut off and html elements resume as normal at the top of the next page.

Here is an example of the html I have

let s = "<!DOCTYPE html><html><div>Hello</div></html>"
// but imagine having <div>Hello</div> repeated 100 times

My options look like this:

let options = {
    html: s,
    fileName: 'test',
    directory: 'docs',
    base64: true,
    height: 842,
    width: 595,
    padding: 24,
  }

It looks like the page comes out to 595x842, but the area that actually contains elements is cropped to a square (I am just guessing it's 595x595).

Am I doing something wrong, or is there a way to fix this? Thanks!

PS Would be cool to have options for page numbers and borders... stuff that doesn't need to be calculated in respect to the html, but will just show up on each page.

Can't just pass a width, requires height and paginates

Seems the width is only taken into account when a height is also passed.

      const results = await RNHTMLtoPDF.convert({
        html: receiptHTML,
        base64: true,
        width: 226,
      })

produces a default width:
image

However with a height:

      const results = await RNHTMLtoPDF.convert({
        html: receiptHTML,
        base64: true,
        width: 226,
        height: 800
      })

Renders the width, but also paginates:
image

2018-03-28 15:54:13.909076-0700 greenline_ipad[77843:7701364] [LayoutConstraints] Unable to simultaneously satisfy constraints.
	Probably at least one of the constraints in the following list is one you don't want. 
	Try this: 
		(1) look at each constraint and try to figure out which you don't expect; 
		(2) find the code that added the unwanted constraint or constraints and fix it. 
(
    "<NSLayoutConstraint:0x604000497480 UIView:0x7fdd82c7add0.width == UILabel:0x7fdd82c78510'Page 1'.width + 28   (active)>",
    "<NSLayoutConstraint:0x6040004974d0 H:[UIImageView:0x7fdd82c7a7e0]-(3)-[UILabel:0x7fdd82c78510'Page 1'](LTR)   (active)>",
    "<NSLayoutConstraint:0x604000497610 UIImageView:0x7fdd82c7a7e0.width == 22   (active)>",
    "<NSLayoutConstraint:0x604000497750 H:|-(0)-[UIImageView:0x7fdd82c7a7e0](LTR)   (active, names: '|':UIView:0x7fdd82c7add0 )>",
    "<NSLayoutConstraint:0x6040004977a0 UILabel:0x7fdd82c78510'Page 1'.right == UIView:0x7fdd82c7add0.right   (active)>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x6040004974d0 H:[UIImageView:0x7fdd82c7a7e0]-(3)-[UILabel:0x7fdd82c78510'Page 1'](LTR)   (active)>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.

Custom fonts

Hi,
I want to add a custom font to the html. The font file is in the same folder as where the component is. Problem is that when I try to generate the pdf it gives and exception:
Error: ExceptionConverter: java.io.IOException: ./VarelaRound-Regular.ttf not found as file or resource.
I have included this line for custom font: fonts:['./VarelaRound-Regular.ttf']
Note: app is working correctly with out the fonts option.
Thanks

landscape mode

Is it possible to generate PDFs in landscape mode with this library?

I tried adding the following CSS but it has no effect on the orientation:

<style type="text/css">
    @page {
        size: A4 landscape;
    }
    body {
        writing-mode: tb-rl;
    }
</style>

Minimum platform os version

What's the minimum android and iOS version?

I tried running it in android 4.2, and throws no module found error. But working perfectly on android 5+

Cannot add images from html.

Hello to all.

I have been trying to use this library to convert an html to pdf but unfortunately i cannot see any image get displayed from base64 or my local image.

I have tried from some base64 image ( small images ) and http/s images and it works fine.
But when I try from ImagePicker.Response.Data (Base64) or ImagePicker.Response.URI or ImagePicker.Reponse.filePath, it does not work.

I added a static image also but no success.
< img width="90%" src="file:///data/user/0/com.testdemo1/files/1519771603235.jpg" / >

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.