Comments (6)
You are right, comment should be rephrased to remove leading and trailing whitespace
. I am afraid that there is currently only the normal
as a valid option for whiteSpace
. What are you trying to achieve?
from pdfjs.
I need some part of text to have CSS styles applied, for example, <p>Lorem <span style="color: #000080;">ipsum</span> dolor</p>
. My HTML parser converts it to something like this:
var doc = new pdfjs.Document({ font: fontRegular, whiteSpace: 'normal' });
doc.text('Lorem ').append('ipsum', { color: 0x000080 }).append(' dolor').br();
But words are glued together Loremipsumdolor
and also color is not applied to second word.
from pdfjs.
Should work with .add
instead of .append
(append is meant for appending without whitespace; API is probably best choose)
from pdfjs.
Thank you very much! Now works almost perfect, need to fix another case Lorem ipsum <strong>S</strong>mith-Jones
, it converts to:
doc.text('Lorem ipsum ').add('S', { font: fontBold }).add('mith-Jones');
and prints "Lorem ipsum S mith-Jones", but I need "Lorem ipsum Smith-Jones".
from pdfjs.
It is append
in this case: add('S', { font: fontBold }).append('mith-Jones');
🙂
from pdfjs.
Feel free to reopen the issue
from pdfjs.
Related Issues (20)
- Error: Using spaces or \t at the beginning of a line when using Chinese will result in no line breaks HOT 1
- ExternalDocument can not create pdf from buffer HOT 1
- TypeError: Cannot read property '12' of undefined HOT 11
- Can I create a large pdf without loading the entire file into memory? HOT 1
- Missing outline when merging PDF files HOT 1
- how can I extract contents from a pdf HOT 1
- Downscale images in external PDF HOT 1
- Cannot catch error in asBuffer() HOT 21
- imported in .vue file but giving issue HOT 1
- Combined PDF size is bigger than the originals HOT 2
- Fragments are appearing in wrong order... HOT 1
- Invalid throw code in text._render HOT 1
- Issue with Inaccurate Text Highlighting in PDF Search Using ng2-pdfjs-viewer - Version 13 HOT 1
- The add() method of the table cell text method does not respect the "textAlign" or "alignment" properties HOT 1
- How do I set the font My characters are now garbled ? HOT 1
- Improve client-side support HOT 1
- Failed to add document containing lexer HOT 1
- Crash when processing PDF using nodejs HOT 2
- Underline does not seem to work well
- I get Process error while using this library in react js
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 pdfjs.