Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can tables be left justified - i.e., in a generated pdf document using pipeline and xmlparser?
    text
    copied!<p>I'm using the "pipeline" technique, below, to convert an html string into PDF format.</p> <p>It works fine, except, that the html tables apparently default to the center of the page. --Is this the default behavior? If so, is there any work-a-round?</p> <p>Anyway, I would like the tables to be <strong><em>left</em></strong> justified. </p> <p>How can I accomplish this?</p> <p>Note: "text-align: left;" and "margin-left: 5px", for example, have NO effect... The old-fashioned "align: left" attribute is not supported, either.</p> <p>Thanks for any help/guidance!</p> <hr> <h1>java code snippet:</h1> <pre><code> - - - document.open(); HtmlPipelineContext htmlContext = new HtmlPipelineContext(null); htmlContext.setTagFactory(Tags.getHtmlTagProcessorFactory()); // CSS CSSResolver cssResolver = new StyleAttrCSSResolver(); InputStream csspathtest = Thread.currentThread().getContextClassLoader().getResourceAsStream("css/testpdf.css"); CssFile cssfiletest = XMLWorkerHelper.getCSS(csspathtest); cssResolver.addCss(cssfiletest); Pipeline&lt;?&gt; pipeline = new CssResolverPipeline(cssResolver, new HtmlPipeline(htmlContext, new PdfWriterPipeline(document, writer))); XMLWorker worker = new XMLWorker(pipeline, true); XMLParser p = new XMLParser(worker); p.parse(is); //new FileInputStream("results/demo2/walden.html")); // step document.close(); - - - </code></pre> <hr> <h1>css snippet:</h1> <pre><code> div { margin-left: 5px; padding-left: 5px; } h2 { color:blue; text-align: center; font-size: 16pt; margin-bottom: 20px; } h6 { color:#777; text-align: center; font-size: 14pt; margin-bottom: 20px; } p { color: green; text-align: center; font-style: italic; font-size: 12pt; margin-bottom: 20px; } table { font-family: Arial, Helvetica, sans-serif; color: blue; border-color: #777; border-style: solid; border-width: .1px; border-collapse: collapse; text-align: left; vertical-align: top; margin-bottom: 50px; margin-left: 5px; padding-left: 5px; } th { color: #777; font-size: 10pt; background-color: lightgrey; padding: 5px; text-align: left; vertical-align: top; } td { font-size: 8pt; color: navy; border-top-color: #777; border-top-width: .01px; padding: 5px; text-align: left; vertical-align: top; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload