pdf-generation

XSL-FO: wrapping long words in table cell

狂风中的少年 提交于 2019-12-13 02:28:41
问题 I'm using Docbook-XSL and Apache FOP to generate PDF documents containing tables. With the default settings, tables have fixed-width columns and lines wrap at word boundaries. But if a word is longer than the cell width, it overflows the cell. I'd like to break up the words across multiple lines in such a case. How could this be done? Hyphenation is not a solution since the words need not be in English. (Edit: hyphenation in other languages is not a solution either. It may not be known ahead

Export HTML + CSS to PDF using Javascript

馋奶兔 提交于 2019-12-13 02:18:26
问题 I want to export a part of my html code to pdf, for this I am using the following code : <script language = "JAVASCRIPT"> var doc = new jsPDF(); var specialElementHandlers = { '#editor': function (element, renderer) { return true; } }; $('#download').click(function () { doc.fromHTML($('#mytable').html(), 15, 15, { 'width': 170, 'elementHandlers': specialElementHandlers }); doc.save('sample-file.pdf'); }); </script> but it doesn't support CSS .. how can I export it with its style ? 回答1: What

Using the same API to write both Word and PDF documents

天大地大妈咪最大 提交于 2019-12-13 01:04:19
问题 HI all is there any kind of abstraction API over Apache POI/FOP allowing one to use the same API to write both Word and PDF documents ? 回答1: I'm not aware of a unified API for the two libraries you have mentioned. However you may still have a couple of options using a single API: Use Apache POI to generate the documents in Word format and then use a Word to PDF conversion library to create a PDF from the word document. Another commenter has suggested IText Use OpenOffice via its Java API to

How to implement getDirectContent() itextsharp

橙三吉。 提交于 2019-12-12 18:27:07
问题 Currently I am working Generating Pdf file. My problem is that I want to print my addressTable into absolute position PdfWriter writer = PdfWriter.GetInstance(doc,stream) PdfContentByte cb = writer.getDirectContent(); ColumnText ct = new ColumnText(cb); Phrase myText = new Phrase("TEST paragraph\nNewline"); ct.SetSimpleColumn(myText, 34, 750, 580, 317, 15, Element.ALIGN_LEFT); ct.Go(); This is my code but getDirectContent() give me error. So please any body help me that how to print my

How do I get the CSS fonts to work with this Grails PDF rendering plug-in?

两盒软妹~` 提交于 2019-12-12 18:07:38
问题 I am using a Grails rendering plugin to generate PDF. I want to include CSS with my PDF to render it nicely. I found an example on the rendering plugin website I put the CSS below in print media so that it works for PDF, but this does not work for me. I also do not know how to change the font from Arial to another font. Can someone explain this to me? The plugin uses Arial font with this CSS: @font-face { src: url(path/to/arial.ttf); -fs-pdf-font-embed: embed; -fs-pdf-font-encoding: cp1250; }

How to make pdf read only in itext

有些话、适合烂在心里 提交于 2019-12-12 17:16:45
问题 My code follows public static void main(String[] args) { try { PdfReader reader = new PdfReader("D:\\SF_Users.pdf"); int n = reader.getNumberOfPages(); Rectangle psize = reader.getPageSize(1); Document document = new Document(psize); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("D:\\new.pdf")); document.open(); PdfContentByte pdf = writer.getDirectContent(); document.newPage(); PdfImportedPage page = writer.getImportedPage(reader, 1); pdf.addTemplate(page, .5f, 0, 0

Calculate height of iTextSharp PDF document?

♀尐吖头ヾ 提交于 2019-12-12 15:24:22
问题 How can I calculate the height of the PDF document when using iTextSharp? I'm using iTextSharp to position various images on a PDF document using Absolute Position. However I've noticed SetAbsolutePosition() positions the Y parameter from the bottom, so I need to calculate the height to be able to do something like: Y = PdfHeight - i 回答1: You should be able to do that by using the PageSize, like this... int yPos = pdfDocument.PageSize.Height - i - elementHeight; i = the position you would set

Image rotation via itext pdf library

↘锁芯ラ 提交于 2019-12-12 12:59:19
问题 I am unable to rotate image from center or any fixed point by using itext pdf library in java program.When i rotate image it's x and y cordinate gets changed. Kindly help me in this regard. Image pdfImage=Image.getInstance("assets/product.png"); pdfImage.setAlignment(Element.ALIGN_CENTER); pdfImage.setRotationDegrees(30); document.add(pdfImage); pdfImage.setRotationDegrees(140); document.add(pdfImage); In above code there is no same point by which I can judge the rotation point. Thanks in

convert pdf editable fields into text using java programming

旧城冷巷雨未停 提交于 2019-12-12 12:57:34
问题 I have prepared one editable form But unable to convert pdf editable fields into text using java programming. Used API – pdfbox-app-2.0.0-RC2, PDFBox-0.7.3, itextpdf-5.1.0, pdfclown. Pleas help me to find out how to convert pdf editable fields into text in java. used java program (able to convert normal pdf into text but not converting pdf editable fields into text ). import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.FileReader; import java

xhtml to pdf servlet with flyingsaucer

余生长醉 提交于 2019-12-12 12:31:13
问题 I am trying to use flyingsaucer to serve pdf generated from xhtml but I am having trouble getting the servlet example to run. All the other flyingsaucer examples work fine for me but I need this to work as a servlet to incorporate into a webapp. The full code for the servlet is as follows: import java.io.*; import java.net.*; import javax.servlet.*; import javax.servlet.http.*; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom