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

Latex support #177

Merged
merged 3 commits into from
Feb 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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