-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(hr): add horizontal rule rendering functionality
- Loading branch information
1 parent
0103508
commit 843455e
Showing
3 changed files
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import jsPDF from 'jspdf'; | ||
import { RenderOption } from '../../types'; | ||
import { getCharHight } from '../../utils/doc-helpers'; | ||
|
||
const renderHR = (doc: jsPDF, y: number, options: RenderOption) => { | ||
const pageWidth = doc.internal.pageSize.getWidth(); | ||
doc.setLineDashPattern([1, 1], 0); | ||
doc.setLineWidth(0.1); | ||
doc.line(options.page.xpading, y, pageWidth - options.page.xpading, y); | ||
doc.setLineWidth(0.1); | ||
doc.setLineDashPattern([], 0); | ||
return y + getCharHight(doc, options); | ||
}; | ||
export default renderHR; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters