I have been working for a number of days to get external css files working when parsing an html file to create specific pages.
Here is the scenario:
1. I have an html file which is attached below for your review.
2. I want each div element marked with the class of “page” to start a new page in the pdf document.
3. Additionally, each div that contains one or more anchor tags must have a table of contents entry so I must know what page that content falls on when the pdf is generated.
4. Finally, the entire document is styled using external css files.
I have everything working except #4. When parsing the html manually and creating the pdf document page by page, it seems that the only way to style the html is to pass the style tags into the HtmlFragment object along with my html content.
Is this correct? It seems that I should be able to link the document object one time to the css files by passing link tags and the whole document would pick up those styles but I can’t get it working.
I have posted the html and code below. thanks in advance for the help!
Hi David,