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

Update PdfHtmlHeaderAndFooter.java #37

Closed
wants to merge 1 commit into from
Closed
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 @@ -11,6 +11,7 @@
import com.itextpdf.kernel.pdf.PdfWriter;
import com.itextpdf.kernel.pdf.canvas.PdfCanvas;
import com.itextpdf.kernel.pdf.xobject.PdfFormXObject;
import com.itextpdf.layout.Document;
import com.itextpdf.layout.Canvas;
import com.itextpdf.layout.element.Paragraph;
import com.itextpdf.layout.properties.TextAlignment;
Expand Down Expand Up @@ -43,11 +44,11 @@ public void manipulatePdf(String htmlSource, String pdfDest) throws IOException

// Base URI is required to resolve the path to source files
ConverterProperties converterProperties = new ConverterProperties().setBaseUri(SRC);
HtmlConverter.convertToDocument(new FileInputStream(htmlSource), pdfDocument, converterProperties);
Document converted = HtmlConverter.convertToDocument(new FileInputStream(htmlSource), pdfDocument, converterProperties);

// Write the total number of pages to the placeholder
footerHandler.writeTotal(pdfDocument);
pdfDocument.close();
converted.close();
}

// Header event handler
Expand Down