pdf-generation

Why is text truncated in PDF with Linux?

北城以北 提交于 2019-11-29 14:30:45
I try to format a Date in Jasper Reports and it works with Windows but not with Linux. With Linux the resulting text is truncated. Code: JRXML: <parameter name="timestamp" class="java.util.Date"/> [...] <textField> <reportElement x="0" y="0" width="50" height="16" uuid="0007846a-26f1-457a-a198-67a2f7c8417c"> <property name="local_mesure_unitwidth" value="pixel"/> <property name="com.jaspersoft.studio.unit.width" value="px"/> <property name="local_mesure_unitx" value="pixel"/> <property name="com.jaspersoft.studio.unit.x" value="px"/> <property name="local_mesure_unity" value="pixel"/>

Is there any API in C# or .net to edit pdf documents? [closed]

旧城冷巷雨未停 提交于 2019-11-29 13:59:15
Is there any API in C# or .net to edit pdf documents? Like I need to retrieve particular text and replace it with my own text. Thanks nRk This is not possible (in a clean & reliable way), from iTextSharp tutorial : You can't 'parse' an existing PDF file using iText, you can only 'read' it page per page. What does this mean? The pdf format is just a canvas where text and graphics are placed without any structure information. As such there aren't any 'iText-objects' in a PDF file. In each page there will probably be a number of 'Strings', but you can't reconstruct a phrase or a paragraph using

Generate pdf from Rails 3 - what tool to choose?

◇◆丶佛笑我妖孽 提交于 2019-11-29 13:36:05
问题 I need to be able to render some views as PDFs from a Rails 3 project. I've never before used PDF generation techniques with ruby/rails, so I researched a few popular approaches such as Prawn and PDF::Writer , but all the examples and articles I found so far seem outdated and only applicable for rails 2.x. I haven't yet seen a working Rails3 example; tried myself installing prawn and the prawnto gems and reproducing the example described in this Railscasts episode, but I'm getting error of

Reportlab - how to introduce line break if the paragraph is too long for a line

老子叫甜甜 提交于 2019-11-29 13:34:42
I have a list of text to be added to a reportlab frame style = getSampleStyleSheet()['Normal'] style.wordWrap = 'LTR' style.leading = 12 for legend in legends: elements.append(Paragraph(str(legend),style)) If the legend is too long, the text at the end is not visible at all. How to introduce line breaks in this situation. This may or may not apply but I just learned that \n which I normally use to introduce new lines in Python strings gets ignored by the Paragraph object of ReportLab. From a mailing list I learned that inside Paragraph you can use HTML's <br/> to introduce the new line instead

How to add text as a header or footer?

给你一囗甜甜゛ 提交于 2019-11-29 13:03:15
I'm creating a pdf with iText 5 and want to add a footer. I did everything like the book "iText in action" in Chapter 14 says. There are no errors but the footer doesn't show up. Can somebody tell me what I'm doing wrong? My code: public class PdfBuilder { private Document document; public void newDocument(String file) { document = new Document(PageSize.A4); writer = PdfWriter.getInstance(document, new FileOutputStream(file)); MyFooter footerEvent = new MyFooter(); writer.setPageEvent(footerEvent); document.open(); ... document.close(); writer.flush(); writer.close(); } class MyFooter extends

Centered, multiline text using iTextSharp ColumnText

你离开我真会死。 提交于 2019-11-29 12:35:01
I am trying to center a block of multiline text using iTextSharp. I thought that using the ColumnText would do the trick, but I'm having some trouble getting both center alignment, as well as proper wrapping working at the same time. Here is some code which shows the 2 methods I'm trying: private void PrintLocationAddress(PdfContentByte Canvas, string Address) { //define the regions for our ColumnText objects Rectangle rect1 = new Rectangle(150f, 300, 350f, 450f); Rectangle rect2 = new Rectangle(150f, 50f, 350f, 200f); //outline the rectangles so we can visualize placement of the ColumnText

problem in drawing a line in a pdf file using itextsharp

本秂侑毒 提交于 2019-11-29 12:32:36
问题 I am generating a pdf file in asp.net c# using itextsharp. i am not able to draw a horizontal line/verticle line/dotted line. i tried to draw a line using the following code,i am getting no errors but the line is also not getting displayed in the pdf file PdfContentByte cb = wri.DirectContent; cb.SetLineWidth(2.0f); // Make a bit thicker than 1.0 default cb.MoveTo(20, pdfDocument.Top - 40f); cb.LineTo(400, pdfDocument.Top - 40f); cb.Stroke(); What is the problem in the code.Is it because of

A multiline(paragraph) footer and header in reportlab

我的梦境 提交于 2019-11-29 12:13:31
问题 What is a best way to have a footer and header in reportlab, that not just a single line, that can be drawed with canvas.drawString in onPage function. Didn`t find a way to put something like Paragraph into header/footer in onPage function. What is the best way to handle this? Is there a way to put a paragraph into footer ? 回答1: You can use arbitrary drawing commands in the onPage function, so you can just draw a paragraph (see section 5.3 in the reportlab user guide) from your function. Here

How do I paint Swing Components to a PDF file with iText?

孤街醉人 提交于 2019-11-29 11:15:33
I would like to print my Swing JComponent via iText to pdf. JComponent com = new JPanel(); com.add( new JLabel("hello") ); PdfWriter writer = PdfWriter.getInstance( document, new FileOutputStream( dFile ) ); document.open( ); PdfContentByte cb = writer.getDirectContent( ); PdfTemplate tp = cb.createTemplate( pageImageableWidth, pageImageableHeight ); Graphics2D g2d = tp.createGraphics( pageImageableWidth, pageImageableHeight, new DefaultFontMapper( ) ); g2d.translate( pf.getImageableX( ), pf.getImageableY( ) ); g2d.scale( 0.4d, 0.4d ); com.paint( g2d ); cb.addTemplate( tp, 25, 200 ); g2d

Creating complex pdf using java

情到浓时终转凉″ 提交于 2019-11-29 10:55:28
I have an Java/Java EE based application wherein I have a requirement to create PDF certificates for various services that will be provided to the users. I am looking for a way to create PDF (no need for digital certificates for now). What is the easiest and convenient way of doing that? I have tried XSL to pdf conversion HTML to PDF conversion using itext. crude java way (using PDFWriter, PdfPCell etc.) What is the best way out of these or is there any other way which is easier and convenient? When you talk about Certificates, I think of standard sheets that look identical for every receiver