pdf-generation

How can you find a problem with a programmatically generated PDF? [closed]

╄→尐↘猪︶ㄣ 提交于 2019-12-05 13:53:22
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . My group has been using the itext-sharp library and C#/.NET to generate custom, dynamic PDFs. For the most part, this process is working great for our needs. The one problem we can run into during development/testing is layout issues which can cause the PDF to not open/render correctly in Adobe Reader, esp. the

Automate print/save web page as pdf in chrome - python 2.7

十年热恋 提交于 2019-12-05 13:42:03
I am trying to automate Print Save Web Page as pdf in chrome. I have checked the webbrowser module, but it does not seem to be intended for this purpose. I explored wkhtmltopdf as an alternative but when downloading the file it seems to be infected by a virus. Thank you for the suggestions. This worked for me using Chrome 62.0.3202.94, ChromeDriver 2.33.506120, Selenium 3.4.3, and Python 2.7.14 or 3.6.3, on Windows 7 x64: import json from selenium import webdriver appState = { "recentDestinations": [ { "id": "Save as PDF", "origin": "local" } ], "selectedDestinationId": "Save as PDF", "version

How to set the background color for every page tcpdf

こ雲淡風輕ζ 提交于 2019-12-05 13:26:17
I'm currently using TCPDF to generate a resume in my web application. But with the limited support for css have cornered me. Now I'm trying to apply the background color for the every page that is generated. But I'm only getting the color for the first page. My code is: <?php class PROFILE_PDF extends TCPDF { public function Header() { $this->SetFillColor(52, 21, 0, 76); $this->Rect(0, 0, $this->getPageWidth(), $this->getPageHeight(), 'DF', ""); } private $footer_data = array(); public function Footer() { // Position at 15 mm from bottom $this->SetY(-15); // Set font $this->SetFont('helvetica'

How to make a particular sub-string Bold while printing a string in Pdf using iText in java eclipse?

北战南征 提交于 2019-12-05 13:02:09
I am using iText in Java to convert a HTML to PDF. I want a particular paragraph which has some words as Bold and some as Bold+Underlined to be passed as a string to the Java code and to be converted to PDF using the iText library. I am unable to find a suitable method for this. How should I do this? If you want to convert XHTML to PDF, you need iText + XML Worker. You can find a number of examples here: http://itextpdf.com/sandbox/xmlworker The most simple examples looks like this: public void createPdf(String file) throws IOException, DocumentException { // step 1 Document document = new

Can anyone recommend a decent FOSS PDF generator for Python?

删除回忆录丶 提交于 2019-12-05 12:05:14
I need a basic pdf generator that'll let me toss some images and text into a pdf file. The ability to have some basic drawing commands (lines and so forth) would also be a plus. I did read through this question , but I really don't need a report generator and most of the responses there seemed like real overkill for what I'm trying to do. (I don't need templates or LaTeX-grade layout control.) bouvard For one of my projects, I have tested and/or implemented probably six or seven different methods of going from an image to a PDF in the last six months. Ultimately I ended up coming back to

If it's possible to generate a PDF file from a UITableView?

随声附和 提交于 2019-12-05 11:40:16
My application has a tableview with custom cells(include textfield, label and button), I wanna generate a pdf file from the tableview. Bellow is the code(now assume the tableview's content is all visible): UIGraphicsBeginImageContext(self._tableView.bounds.size); UIGraphicsBeginPDFPageWithInfo(CGRectMake(0, 0, self._tableView.bounds.size.width, self._tableView.bounds.size.height), nil); // what's the code here? // [self._tableView drawInRect:]; UIGraphicsEndPDFContext(); I always generate an blank pdf file. Currently what I do is to generate the tableview as a image, then draw the image to the

Wicked pdf not rendering header/footer

爷,独闯天下 提交于 2019-12-05 10:33:40
I am using wicked_pdf for generating pdf from html on my rails project. It is rendering template but I could not manage to print header/footer sections. Below is my code that print only template section render pdf: "pdf_name", layout: 'application', template: 'reports/show', formats: [:html], margin: { top: 10, bottom: 10, left: 10, right: 10 }, disable_javascript: true, show_as_html: params[:debug], header: { html: { template: 'shared/header' }, spacing: 10 }, footer: { html: { template: 'shared/footer' }, spacing: 30, line: true } If I try to use WickedPdf.new.pdf_from_string render_to

R: monte carlo integration using Importance Sampling

有些话、适合烂在心里 提交于 2019-12-05 10:26:02
I have an integral to evaluate "x^(-0.5)" ; x in [0.01,1] for which I am using Importance Sampling MC : The theory says that an approximate PDF has to be used to compute the expected value (which will almost surely converge to the mean - value of the integral) After plotting the given integral, and exponential PDF, based only on the plots, I chose the rexp and dexp to generate the PDF - and my code looks like this - #Without Importance Sampling set.seed(1909) X <- runif(1000,0.01,1) Y <- X^(-0.5) c( mean(Y), var(Y) ) #Importance sampling Monte Carlo w <- function(x) dunif(x, 0.01, 1)/dexp(x

django pdf export

大城市里の小女人 提交于 2019-12-05 10:23:53
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. As mentioned by other people the best way to do this is to generate a template then convert the result, using one of the many libraries around, into a PDF. This method provides you with the usual amount of control

iTextSharp ShowTextAligned Anchor Point

孤街浪徒 提交于 2019-12-05 09:30: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 at this website , but it isn't very explanatory. See PdfContentByte Class / PdfContentByte Methods /