pdf-generation

Centering an pdfimportedpage in iTextSharp

假装没事ソ 提交于 2019-12-05 05:12:33
问题 I am appending PDFs together using the function below via iTextSharp. Its working fine. The only problem is that PDFs that are larger than the set size of the document (A4), ends up being scaled and placed at the bottom left corner of the document. I would like to centre it. Can anyone point me in the right direction to achieving this? Cheers. private void appendPDF(appendDoc doc) { PdfContentByte pdfContentByte = pdfWriter.DirectContent; PdfReader pdfReader = null; if (doc.MemoryStream !=

How do I walk through tree of Pdf Objects in PDFSharp?

元气小坏坏 提交于 2019-12-05 04:28:59
I am trying to to walk though the tree of PdfItem objects in an existing PDF document using PDFSharp in c#. I want to create a hierarchy of all the objects as I go along -- similar to what the "PDF Explorer" example does -- but I want it to be a tree instead of a flat list of all the objects. The root node is document.Internals.Catalog. And I want to to walk down through all the document.Internals.Catalog.Elements until I have visited every element. One of the problems I run into is that there are circular references in the tree and I can't figure out how to detect them. Any code samples out

Displaying values in FPDF

北城余情 提交于 2019-12-05 04:21:45
This is my code for generating pdf using FPDF in php. I want to display the semester, bill month and the billyear in the PDF file. I dont want to display the values in the table. I want to display at the top of the page. How can i do this? Any suggestion? Thanks in advance. Cheers. <?php session_start(); require('fpdf/fpdf.php'); //Connect to your database $r1=$_SESSION['sem1']; $con=mysql_connect('localhost','root',''); if(!$con) { die('Unable to connect'.mysql_error()); } mysql_select_db('hostel',$con); $result=mysql_query("SELECT r.hosteladmissionno, r.student_name, r.semester, r.blockname

How to: nodejs pdfkit output japanese or chinese

て烟熏妆下的殇ゞ 提交于 2019-12-05 03:47:27
问题 I'm doing my nodejs + expressjs + mongodb project, I need fetch data from mongodb and then write it to pdf file, then send out by expressjs. everything seems fine except that the data is Japanese letter, and the encoding messed-up. I'm using pdfkit for creating pdf file, like this: var doc = new PDFDocument(); doc.info['Title'] = profile.firstName + " " + profile.lastName; doc.fillColor('black') .text(profile.firstName + " " + profile.lastName, { paragraphGap: 10, indent: 20, align: 'justify'

Export html to pdf in ASP.NET

牧云@^-^@ 提交于 2019-12-05 03:41:17
问题 I am trying to export retrieved data from SQL into PDF using ASP.NET (C#). Remarks: I am not using a gridview. I designed the format of the page by using an HTML table and asp labels. HTML table to format the layout and asp labels to show the values of my selected data from SQL. How can I convert an HTML table to PDF using ASP.NET? Can anyone help me? Thanks. 回答1: You can try to use itextsharp (link) Example: using iTextSharp.text; using iTextSharp.text.pdf; using System.IO; using iTextSharp

How to create PDF in ASP.NET

假装没事ソ 提交于 2019-12-05 02:42:35
问题 I have seen lot of threads on it and really no good answer anywhere. Or rather none suit my situation. We need to print Business Letter for given list with mail merge facilities. Client is not willing to spend $$ On paid ASP.NET control to make PDF. so I opt for WKHTMLtoPDF and it works fine for us until one day client try to get PDF of 100+ leads, resulting in complete failure of PDF generation. It works just fine with 10-20 page PDF, but not for 100. Is there any Tips & Trick to improve

FPDF error: Could not include font metric file

五迷三道 提交于 2019-12-05 02:36:10
I have a app which was done by someone else and now i am asked to look into one issue. When a pdf report is generated it throws an error. This app uses FPDF to generate the PDF FPDF error: Could not include font metric file Earlier it was throwing the following error Warning: FPDF::include(helveticab.php) [function.FPDF-include]: failed to open stream: No such file or directory Warning: FPDF::include() [function.include]: Failed opening 'helveticab.php' for inclusion FPDF error: Could not include font metric file This was resolved by including a font folder with helveticab.php and other php

Using iText, generate on memory a PDF that is generated on disk instead

三世轮回 提交于 2019-12-05 02:09:07
问题 I'm generating a PDF from a Java application. (And works great) the problem is that the PDF is generated on disk as: Document documento = new Document(PageSize.A4, 25, 25, 25, 25); PdfWriter writer = PdfWriter.getInstance(documento, new FileOutputStream("/Users/sheldon/Desktop/Registry.pdf")); documento.open(); // Put some images on the PDF for( byte[] imagen : imagenes ) { Image hoja = Image.getInstance(imagen); hoja.scaleToFit(documento.getPageSize().getHeight(), documento.getPageSize()

How do i download pdf file over https with python

笑着哭i 提交于 2019-12-05 01:42:31
I am writing a python script, which will save pdf file locally according to the format given in URL. for eg. https://Hostname/saveReport/file_name.pdf #saves the content in PDF file. I am opening this URL through python script : import webbrowser webbrowser.open("https://Hostname/saveReport/file_name.pdf") The url contains lots of images and text. Once this URL is opened i want to save a file in pdf format using python script. This is what i have done so far. Code 1: import requests url="https://Hostname/saveReport/file_name.pdf" #Note: It's https r = requests.get(url, auth=('usrname',

Puppeteer wait until page is completely loaded

半腔热情 提交于 2019-12-05 01:40:35
问题 I am working on creating PDF from web page. The application on which I am working is single page application. I tried many options and suggestion on https://github.com/GoogleChrome/puppeteer/issues/1412 But it is not working const browser = await puppeteer.launch({ executablePath: 'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe', ignoreHTTPSErrors: true, headless: true, devtools: false, args: ['--no-sandbox', '--disable-setuid-sandbox'] }); const page = await browser.newPage