-
Notifications
You must be signed in to change notification settings - Fork 358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rgba is not supported #966
Comments
openhtmltopdf does not support opacity it looks like you may be using the alpha channel here as an analogue for HSL-style "lightness". you can achieve this effect by rendering the html as you would expect in a browser, and then using an eyedropper tool to get the RGB value of the rendered color |
BTW, the community is in the process of transitioning to a new repo at https://github.com/openhtmltopdf/openhtmltopdf because danfickle is no longer maintaining this repository. |
The following method converts rgba in html to rgb public static final Color BACK_GROUND = new Color(255, 255, 255); public static final String RGBA_REGEX = "rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d.]+)\s*\)"; public static final Pattern PATTERN = Pattern.compile(RGBA_REGEX); public static String rgbaToRgb(String htmlString) {
} |
Feel free to open an issue at the other repo with this code snippet. It would be cool if we could add transparency support. |
"<meta charset="UTF-8">"
+ "<h1 style ="font-family: 'BabelStoneHan',sans-serif;">中文HTML转PDF示例"
+ "
这是一个包含中文的 HTML 内容。
"
+ "<table style="width:100%; border-collapse: collapse;font-family: 'BabelStoneHan',sans-serif;">"
+ "<th style="border: 1px solid rgb(10, 18, 10); padding: 8px;font-family: 'BabelStoneHan',sans-serif;">表头1"
+ "<th style="border: 1px solid red; padding: 8px;">表头2"
+ "<th style="border: 1px solid rgba(0, 0, 0, 0.06); padding: 8px;">表头3"
+ "<td style="border: 1px solid black; padding: 8px;">数据1"
+ "<td style="border: 1px solid black; padding: 8px;">数据2"
+ "<td style="border: 1px solid black; padding: 8px;">数据3"
+ "";
rgba(0,0,0,0.06,) is not a border width, style, or color at line 98. Skipping declaration.
The text was updated successfully, but these errors were encountered: