Skip to content
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

Added leading indent #1054

Merged
merged 1 commit into from Jul 1, 2017
Merged

Added leading indent #1054

merged 1 commit into from Jul 1, 2017

Conversation

Prevole
Copy link
Contributor

@Prevole Prevole commented Jul 1, 2017

Added the possibility to add a leading indent to do:

  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras eget tempor 
mi. Ut cursus velit iaculis, posuere est eu, suscipit diam. Vivamus sed dui 
convallis, ultrices nulla quis, molestie velit. Proin consectetur accumsan eros. 
  Nunc in efficitur sem. Donec sit amet ultricies lorem, at feugiat ligula. Aliquam 
erat volutpat. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices 
posuere cubilia Curae; Nam tristique justo eu blandit semper. 
  Proin pharetra eros magna, nec placerat felis aliquam sed. Fusce varius 
mauris vel est scelerisque gravida. Morbi tortor ante, egestas in tortor eu, 
iaculis ultrices tellus. 

@liborm85 liborm85 merged commit 6865895 into bpampuch:master Jul 1, 2017
@liborm85
Copy link
Collaborator

liborm85 commented Jul 1, 2017

Merged. Thanks.

@Meirimbr
Copy link

How do I implement the indent? Could you show me an example? Thank you

@Prevole
Copy link
Contributor Author

Prevole commented Sep 18, 2017

@Meirimbr : You can simply add the option leadingIndent: 20 in a style block. Then apply it to your paragraphs.

{
	content: [{
		    text: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Confectum ponit legam, perferendis nomine miserum, animi. Moveat nesciunt triari naturam posset, eveniunt specie deorsus efficiat sermone instituendarum fuisse veniat, eademque mutat debeo. Delectet plerique protervi diogenem dixerit logikh levius.',
		    style: 'lead'
	}],
	styles: {
		lead: {
		    leadingIndent: 20
		}
	}
}

@thaddeusm
Copy link

thaddeusm commented Mar 3, 2020

I have a unique use case where I basically need this functionality inverted. I would like to indent every line except for the first in a paragraph/wrapped text content. Any ideas?

Update: I figured out that I could use negative values for the leadingIndent property. Therefore, I added a left margin for the paragraph and then used a negative leadingIndent value to null the margin for the first line.

@pibubear
Copy link

@thaddeusm How do I implement leadingIndent functionality with negative value in order to apply indentation after the provided text? Could you show me an example? I'm trying to do this with inner tables using html-to-pdf module.
Thank you

@thaddeusm
Copy link

@thaddeusm How do I implement leadingIndent functionality with negative value in order to apply indentation after the provided text? Could you show me an example? I'm trying to do this with inner tables using html-to-pdf module.
Thank you

In my use case (creating a PDF in APA Style), I need to indent every line but the first in a reference entry. I accomplished this by using a negative leadingIndent value to nullify a left margin value:

...
referenceEntry: {
    leadingIndent: -36,
    margin: [36, 0, 0, 0]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants