pdf-generation

Merging two PDFs

给你一囗甜甜゛ 提交于 2019-12-07 05:35:32
问题 import PyPDF2 import glob import os from fpdf import FPDF import shutil class MyPDF(FPDF): # adding a footer, containing the page number def footer (self): self.set_y(-15) self.set_font("Arial", Style="I", size=8) pageNum = "page %s/{nb}" % self.page_no() self.cell(0,10, pageNum, align="C") if __name__ == "__main__": os.chdir("pathtolocation/docs/") # docs location os.system("libreoffice --headless --invisible --convert-to pdf *") # this converts everything to pdf for file in glob.glob("*"):

django pdf export

末鹿安然 提交于 2019-12-07 05:16:42
问题 I want to generate a PDF which will show the output of my queryset in table format, for example: query = ModelA.objects.filter(p_id=100) class ModelA(models.Model): id = models.AutoField(primary_key=True) name = models.CharField(max_length=200) p_id = models.IntegerField() description = models.TextField() I need to show the values for name , description and pid in the generated PDF. 回答1: As mentioned by other people the best way to do this is to generate a template then convert the result,

how to convert jpg to pdf in Android java

坚强是说给别人听的谎言 提交于 2019-12-07 04:51:43
问题 I want to convert several .jpg files (taken using the device camera) to ONE .pdf file. I saw a lot of tools like iText, mupdf, PDFjet, pdjBox. Is there something more simple? (like an API ready for android?) Thanks. 回答1: using iText Library to convert the text to pdf. Use this to convert image to pdf. import java.io.*; import com.lowagie.text.*; import com.lowagie.text.pdf.*; public class imagesPDF { public static void main(String arg[])throws Exception { Document document=new Document();

fpdf alignment of cells

谁都会走 提交于 2019-12-07 04:13:55
问题 I'm trying to generate a PDF using fpdf and I'm having a small problem I need to have 2 cells, like the following: ------------------------- ------------------------- | Address Line 1 | Version | | Address Line 2 | 1.0 | | City | 06/05/2011 | ------------------------- ------------------------- I've tried using MultiCell() but with no luck. $address = ' Address Line 1 Address Line 2 City Postcode'; $pdf->MultiCell(133.5, 2.7, $address, 'L', 'L'); $version = ' Version 1.0 06/05/2011'; $pdf-

iTextSharp and special characters (slovak graphemes)

依然范特西╮ 提交于 2019-12-07 03:44:47
问题 I am having trouble with some special slovak characters (for example č, ň and ť). They are disappearing in the itextsharp generated pdf. From what I've been able to find, this problem has to do with encoding of my BaseFont . Currently I am using this: BaseFont.CreateFont(BaseFont.HELVETICA, iTextSharp.text.pdf.BaseFont.CP1250, BaseFont.NOT_EMBEDDED) Someone suggested that this should work: BaseFont.CreateFont(BaseFont.HELVETICA, iTextSharp.text.pdf.BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED)

iTextSharp ShowTextAligned Anchor Point

夙愿已清 提交于 2019-12-07 03:26:55
问题 I'm currently successfully adding text to a PDF using iTextSharp's ShowTextAligned method. The method looks like this (C#): public void ShowTextAligned( int alignment, string text, float x, float y, float rotation ) However, it is unclear where the anchor point is for the text we're making. We provide x and y , but does these correspond to the upper left corner of the text rectangle, the lower left corner, or something else? Also is this impacted by line spacing? I looked at the documentation

Programmatically change the color of a black box in a PDF file?

半城伤御伤魂 提交于 2019-12-07 02:50:28
I have a PDF file generated by Microsoft Word. The user has specified a "highlight" color of black to make the text look like it's a black box (and make the text look like its been redacted). I'd like to change the black boxes to yellow so that the text is highlighted instead. Ideally, I'd like to do this in Python. Thanks! Option 1: If a commercial library is an option, you can easily implement this with Amyuni PDF Creator .Net , the C# code would look like this: using System.IO; using Amyuni.PDFCreator; using System.Collections; //open a pdf document FileStream testfile = new FileStream(

How to set DPI (dots per inch) in PDFsharp

断了今生、忘了曾经 提交于 2019-12-07 02:19:48
问题 Is there any way to set DPI (dots per inch) in case of PDFsharp? Thanks 回答1: No, PDF files are vector files that have no DPI. If your question is about images stored in the PDFfile: PDFsharp stores images as they come. PDFsharp does not (yet) resize images to lower DPI to reduce the file size. Your application knows which image will be used where and at which size, so you should reduce the raster images to the DPI (*) you need before using them with PDFsharp. Please note that images will be

Can JasperReports include a pdf in a report?

不羁岁月 提交于 2019-12-07 02:06:29
Is it possible to include an existing pdf file in a JasperReport? We really want to append new data to an existing report with out regenerating the existing report. We will be exporting back to pdf. I'm looking at using iText's PdfCopy to merge two pdfs, but was hoping JasperReports might have an easier way... I don't think you could do that in JasperReports, but it would be fairly simple in iText . Generate the JasperReport, and then use PdfCopy to append the new report to the original (or vice-versa). 来源: https://stackoverflow.com/questions/935802/can-jasperreports-include-a-pdf-in-a-report

Bold not working in Jaspersoft Studio for fonts other than sans serif

≯℡__Kan透↙ 提交于 2019-12-07 01:58:29
问题 In Jaspersoft Studio I have created a report where I want to display title in bold. If I use sans serif font then it is working correctly. If I use other fonts, bold is displayed in the preview of Jaspersoft Studio, but is not showing when the report is run in the Jasper server. Please help. 回答1: You need to create a jasper fonts extension jar and place it into your classpath both compile-time (while compiling the jrxmls) as well as run-time (while running reports). Here is how the jar (e.g.