pdf-generation

table width not set in iTextSharp when converting html to PDF

家住魔仙堡 提交于 2019-12-21 06:18:24
问题 I am trying to convert an html to pdf but the problem i face is that the html table tags width is not getting set correctly.. This is my html <table cellpadding='4' cellspacing='4' border='0' width='100%' style='width:100%'> <tr style='background-color:#000000'> <td colspan='2' align='center' valign='middle' width='100%'> <font face='Calibri' size='6' color='#FFFFFF'>Retail Natural Gas Deal Sheet</font> </td> </tr> <tr> <td colspan='2' width='100%'> </td> </tr> <tr> <td width='90%' style=

iText 7: Paragraph height as it would be rendered

☆樱花仙子☆ 提交于 2019-12-21 05:24:08
问题 I can set the width of a new paragraph as follows, which results in a certain height: Paragraph p = new Paragraph("some longer text some longer text some longer text"); p.setWidth(100); System.out.println("height " + p.getHeight()); document.add(p); Of course p.getHeight() is null , since the rendered height is calculated during rendering the PDF file. But I need the height before the final rendering. How can I get it most efficiently? 回答1: To get the effective width of the paragraph as if it

Add image in header using html-pdf node module

≡放荡痞女 提交于 2019-12-21 03:42:53
问题 I am using this to convert the html to PDF.The conversions are really good.But the problem is to add header and footer in the PDF pages.In the options if i add the header text i got the result what i expected. //Options var options = { "header": { "height": "45mm", "contents": "<div style='text-align: center;'>Author: Marc Bachmann</div>" // If i add image in content it wont work // sample i tried }, "footer": { "height": "28mm", "contents": "<span style='color: #444;'>{{page}}</span>/<span>{

“no module named PyPDF2” error

偶尔善良 提交于 2019-12-21 03:25:09
问题 I use Spyder, with Python 2.7, on a windows 10. I was able to install the PyPDF2 package with a conda command from my prompt. I said installation complete. Yet, If I try to run a simple import command: import PyPDF2 I get the error: ImportError: No module named PyPDF2 How can I fix this? 回答1: If you use python3 maybe apt-get install python3-pypdf2 回答2: In my case, I was trying to import 'pyPdf2' instead of 'PyPDF2'. Observe the case. import PyPDF2 is correct. 回答3: I faced the same problem.

How to find whether PDF has landscape orientation or portrait

心不动则不痛 提交于 2019-12-21 02:45:31
问题 Are there tools to determine whether a PDF has landscape orientation or portrait? I have currently looked upon pdfbox and Itext for this but seem that I could not find it. Please tell if they support this. Extracting the PDF pages information using Origami is providing a information the pdf pages have rotation of some degree. Here is what Origami reports: {:Parent=>#<PDF::Reader::Reference:0x872349c @id=8, @gen=0>, :Type=>:Page, :Contents=>#<PDF::Reader::Reference:0x8722f24 @id=4, @gen=0>,

Can mxGraph export graphs as PDFs?

久未见 提交于 2019-12-21 00:40:12
问题 I am working on a project that uses mxGraph where I am required to export a high resolution output in PDF for a service process diagram. I've tried recreating the graph using JGraphX, the Java Swing client and exporting that to a PDF, but the result is not close to what the browser displays. There's no PDF export in JavaScript on the client, does mxGraph have any explicit support for PDF generation from JavaScript? 回答1: I'll explain the case of a client initiated request, where the diagram is

TCPDF set different headers for different pages in one document

前提是你 提交于 2019-12-20 19:46:58
问题 Is there a way to have a different header logo for the 1st page in a document and different for the 2nd page? I thought that changing the header data between adding pages might do the trick, but in my tests it seems that setting the header after adding the first page has no effect: /* other stuff $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF

ASP.NET MVC: render view to generate PDF: use iTextSharp or better solution?

孤街浪徒 提交于 2019-12-20 10:58:16
问题 I display receipt in both HTML and printer-friendly version. HTML version does jQuery tabs, etc, while printer-friendly has zero scripts and external dependencies, no master layout, no additional buttons, inline CSS, and can be saved as HTML without problems. Since I use Spark View Engine, I though maybe it's a good idea to generate PDF using iTextSharp engine. But after few paragraphs I decided it's too cumbersome, because a) I would have to rewrite entire receipt (source Spark view is about

Android fill PDF form

只愿长相守 提交于 2019-12-20 10:40:09
问题 I have .pdf file and multiple forms are there. I want to open my .pdf file, fill the forms and save it from Android development. Is there any API for Android Rendering. I found iText but I just manage to create new pdf and than i can fill form. means which .pdf file i created that will be filled out. I need to fill my form in my own .pdf. Thanks in Advance...any help will be appreciated... 回答1: DynamicPDF Merger for Java allows you to do just that. You can take an existing PDF document, fill

Split each PDF page in two?

ぃ、小莉子 提交于 2019-12-20 08:44:10
问题 I have a large number of PDF files which have two slides to a page (for printing). The format is A4 pages each with two slides setup like so: ----------- | slide 1 | ----------- | slide 2 | ----------- How can I generate a new PDF file with one slide per page? Happy to use GUI, CLI, scripts or even interface with a language's PDF library; but I do need the text on the slides to still be selectable. 回答1: PDF Scissors allowed me to bulk split (crop) all pages in a PDF. 回答2: Briss is "a simple