pdf-generation

DOMPDF <div> tag as header and footer

两盒软妹~` 提交于 2019-12-11 07:55:48
问题 I need to create a header and footer on a tag using DOMPDF. How can I achieve this? Assuming I have a header class like this one: <div class='header'> <div> <img scr='image1.png' style="width:100px; height:150px" /> <h1>This is header</h1> </div> </div> and a footer like this one <div class='footer'> <div> <img scr='image1.png' style="width:100px; height:150px" /> <h1>This is a footer. All rights reserved.</h1> <img src = image2.png style="width:100px; height:150px;"> </div> </div> I want to

How to make a pdf printout occupy the entire A4 page

陌路散爱 提交于 2019-12-11 07:51:49
问题 I use jboss seam iText module to generate a sample pdf file, which by default renders with a page magnification of 143%. When I take a print out, the output doesn't occupy the entire page though. What settings should I modify to make the print out use the entire sheet. 回答1: If seam-pdf is what your are using, settings for document size are in the <document> tag: <p:document type="pdf" pageSize="A4" orientation="portrait" margings="2cm, 2cm, 2cm, 2cm" disposition="attachment" title="Document

PDF Spec - ExtGState

左心房为你撑大大i 提交于 2019-12-11 07:38:08
问题 What does this ExtGState object do to an image: << /Type /ExtGState /TR /Identity >> I have the PDF spec, but it is not clear at all. Apparently this maps the identity function (identity of what? the identity matrix?) from [0.0 1.0] to [0.0 1.0] (the same), which makes no sense. Could someone please explain to me what this does? 回答1: It specifies a function that should be used for processing colors or color components (e.g. for gamma correction). Specifying /Identity should actually be the

How to set background image in PdfPCell in iText?

こ雲淡風輕ζ 提交于 2019-12-11 06:46:42
问题 I am currently using iText to generate PDF reports. I want to set a medium size image as a background in PdfPCell instead of using background color. Is this possible? 回答1: You can find an example on how to do this with iText 5.5.1 here. You need to create your own implementation of the PdfPCellEvent interface, for instance: class ImageBackgroundEvent implements PdfPCellEvent { protected Image image; public ImageBackgroundEvent(Image image) { this.image = image; } public void cellLayout

Print Multiple Excel sheets in a specific order

♀尐吖头ヾ 提交于 2019-12-11 06:29:53
问题 I am trying to print/publish multiple sheets from Excel workbook, but in a specific order. I use the same code used here but it is not printing in the order I inputted into my array and alternatively is printing from leftmost sheet to the rightmost sheet. Save multiple sheets to .pdf I would like to print the sheets in a specific order. I selected the order that I wanted to print, however, it printed from left most sheet and going to right in the way they were in the workbook. How can I make

PDF generated with itext becomes 'corrupted' when using SetSimpleColumn()

不打扰是莪最后的温柔 提交于 2019-12-11 05:59:22
问题 First I would like to point out that stackowerflow helped me with many problems in the past, so thank you all. But now I have come to problem that I haven't fount a solution for yet and it's driving me crazy. I'm not native english speaker, so sorry for any language mistakes. So here it is: I'm generating pdf with itextsharp library(great library by the way). I'm starting with some kind of pdf form/template, to which i'm adding 'fill-out' data. I'm using PdfReader to read template pdf and by

Appearance issues with pdf interactive forms using iText

℡╲_俬逩灬. 提交于 2019-12-11 05:46:35
问题 I have been following the 'Chapter 8: Filling out interactive forms' iText example (code and pdfs at http://itextpdf.com/examples/iia.php?id=154) and have noticed a number of appearance-related issues which also manifest themselves in the example pdfs. The example features a list of radio buttons (classic dot within a circle) and a list of checkboxes (crossed box with a red background). So far so good. However the pdf generated after programmatically filling in these fields is visually

Export to PDF with parameters

半城伤御伤魂 提交于 2019-12-11 05:33:53
问题 Been reading about how to save sheet to a PDF file and I stumble to this code it works well before but now it won't been getting error of "uiapp deprecated". How can I fix this? BTW the codes not mine,I just tweak it to suit my preferences. It's suggesting to use HTML Services. function PDF() { SpreadsheetApp.flush(); var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getActiveSheet(); var gid = sheet.getSheetId(); var pdfOpts = '&size=letter&fzr=false&portrait=true&fitw=false

How to draw image from raw bytes using ReportLab?

北城余情 提交于 2019-12-11 05:16:27
问题 All the examples I encounter in the internet is loading the image from url (either locally or in the web). What I want is to draw the image directly to the pdf from raw bytes. UPDATE: @georgexsh Here is my code based on my understanding of your comment below: def PDF_view(request): response = HttpResponse(content_type='application/pdf') ... page = canvas.Canvas(response, pagesize=A4) page.setTitle("Sample PDF") image = StringIO(raw_image_bytes) # raw_image_bytes is from external source image

PDFBox - convert image to PDF, PDF resolution

爷,独闯天下 提交于 2019-12-11 05:06:02
问题 I am using PDFBox v2 to convert jpg images to PDF. JPG image is already on the filesystem, so I just pick it up and convert it to PDF. Below is my code public void convertImgToPDF(String imagePath, String fileName, String destDir) throws IOException { PDDocument document = new PDDocument(); InputStream in = new FileInputStream(imagePath); BufferedImage bimg = ImageIO.read(in); float width = bimg.getWidth(); float height = bimg.getHeight(); PDPage page = new PDPage(new PDRectangle(width,