Skip to content

Commit

Permalink
Merge pull request #177 from rototor/latex-support
Browse files Browse the repository at this point in the history
Latex support
  • Loading branch information
danfickle authored Feb 16, 2018
2 parents 791573e + 7813ee1 commit c584289
Show file tree
Hide file tree
Showing 21 changed files with 1,185 additions and 893 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.util.List;
import java.util.logging.Level;

import com.openhtmltopdf.css.sheet.FontFaceRule;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
Expand Down Expand Up @@ -281,7 +282,7 @@ public void removeStyle(Element e) {
}
}

public List getFontFaceRules() {
public List<FontFaceRule> getFontFaceRules() {
return _matcher.getFontFaceRules();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@
import com.openhtmltopdf.css.extend.AttributeResolver;
import com.openhtmltopdf.css.extend.StylesheetFactory;
import com.openhtmltopdf.css.extend.TreeResolver;
import com.openhtmltopdf.css.sheet.MediaRule;
import com.openhtmltopdf.css.sheet.PageRule;
import com.openhtmltopdf.css.sheet.Ruleset;
import com.openhtmltopdf.css.sheet.Stylesheet;
import com.openhtmltopdf.css.sheet.*;
import com.openhtmltopdf.util.Util;
import com.openhtmltopdf.util.XRLog;

Expand All @@ -61,7 +58,7 @@ public class Matcher {
private Set _visitElements;

private List _pageRules;
private List _fontFaceRules;
private List<FontFaceRule> _fontFaceRules;

public Matcher(
TreeResolver tr, AttributeResolver ar, StylesheetFactory factory, List stylesheets, String medium) {
Expand All @@ -71,7 +68,7 @@ public Matcher(
_styleFactory = factory;

_pageRules = new ArrayList();
_fontFaceRules = new ArrayList();
_fontFaceRules = new ArrayList<FontFaceRule>();
docMapper = createDocumentMapper(stylesheets, medium);
}

Expand Down Expand Up @@ -125,7 +122,7 @@ public PageInfo getPageCascadedStyle(String pageName, String pseudoPage) {
return new PageInfo(props, style, marginBoxes);
}

public List getFontFaceRules() {
public List<FontFaceRule> getFontFaceRules() {
return _fontFaceRules;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.openhtmltopdf.extend;

/**
* Allows to modify the HTML document DOM after it has been parsed
*/
public interface FSDOMMutator {
void mutateDocument(org.w3c.dom.Document document);
}
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ protected List<AffineTransform> applyTranform(RenderingContext c, Box box) {
* We must apply the top/bottom margins from the previous pages, otherwise
* our transform center is wrong.
*/
for (int i = 0; i < c.getPageNo(); i++) {
for (int i = 0; i < c.getPageNo() && i < getPages().size(); i++) {
RectPropertySet prevMargin = getPages().get(i).getMargin(c);
relTranslateY += prevMargin.top() + prevMargin.bottom();
}
Expand Down
Loading

0 comments on commit c584289

Please sign in to comment.