pdf-generation

Programmatically provide a filepath as input file for “Microsoft Print to PDF” printer

与世无争的帅哥 提交于 2019-11-27 18:51:45
问题 Desired result I want to print a file to a new PDF using the Windows 10 printer "Microsoft Print to PDF" which is installed by default. When you select this printer as your default printer and use your context menu on a file and select Print , it only asks for a save directory and name. After that, it immediately converts to PDF and saves the file. As long as MS Office is installed, this works for Word, Excel, PowerPoint file types. But also for common image types and normal text files. I'd

Displaying headers and footers in a PDF generated by Rotativa

蓝咒 提交于 2019-11-27 18:42:26
问题 I'm trying to specify headers and footers in a PDF generated by Rotativa library. As the author answered here it should be possible using CSS (described here). However, I'm not able to do this. I have a stylesheet loaded in the meta tag: <link href="print.css" rel="stylesheet" type="text/css" media="print" /> And in the stylesheet at the bottom: @page { @top-left { content: "TOP SECRET"; color: red } @bottom-right { content: counter(page); font-style: italic } } And then generating PDF by:

how to save DOMPDF generated content to file? [closed]

拜拜、爱过 提交于 2019-11-27 18:06:46
I am using Dompdf to create PDF file but I don't know why it doesn't save the created PDF to server. Any ideas? require_once("./pdf/dompdf_config.inc.php"); $html = '<html><body>'. '<p>Put your html here, or generate it with your favourite '. 'templating system.</p>'. '</body></html>'; $dompdf = new DOMPDF(); $dompdf->load_html($html); $dompdf->render(); file_put_contents('Brochure.pdf', $dompdf->output()); I have just used dompdf and the code was a little different but it worked. Here it is: require_once("./pdf/dompdf_config.inc.php"); $files = glob("./pdf/include/*.php"); foreach($files as

problem implementing wicked pdf on heroku

泄露秘密 提交于 2019-11-27 17:54:05
I am using this guide for integrating wicked_pdf on heroku. But somehow it doesn't seem to work. I got the logs from heroku and its says this: Processing PdfController#get_pdf to pdf (for 115.248.175.50 at 2011-02-15 23:54:44) [GET] Parameters: {"format"=>"pdf", "action"=>"get_pdf", "id"=>"1", "controller"=>"pdf"} ***************WICKED*************** Rendering pdf/get_pdf RuntimeError (PDF could not be generated! /usr/ruby1.8.7/lib/ruby/1.8/open3.rb:73:in `exec': No such file or directory - /app/fa369291-829b-4b61-9efe-b2f0d0a0a42c/home/bin/wkhtmltopdf-amd64 - - (Errno::ENOENT) from /usr/ruby1

How to use wkhtmltopdf.exe in ASP.net [duplicate]

Deadly 提交于 2019-11-27 17:23:54
This question already has an answer here: Calling wkhtmltopdf to generate PDF from HTML 11 answers After 10 hours and trying 4 other HTML to PDF tools I'm about ready to explode. wkhtmltopdf sounds like an excellent solution...the problem is that I can't execute a process with enough permissions from asp.net so... Process.Start("wkhtmltopdf.exe","http://www.google.com google.pdf"); starts but doesn't do anything. Is there an easy way to either: -a) allow asp.net to start processes (that can actually do something) or -b) compile/wrap/whatever wkhtmltopdf.exe into somthing I can use from C# like

Creating page headers and footers using CSS for print

天涯浪子 提交于 2019-11-27 17:20:19
I'm creating a PDF using Flying Saucer (which dumps out CSS/HTML to iText to a PDF) and I'm trying to use CSS3 to apply an image header and footer to each page. I'd essentially like to put this div in the top left of each page: <div id="pageHeader"> <img src="..." width="250" height="25"/> </div> My CSS looks somewhat like this: @page { size: 8.5in 11in; margin: 0.5in; @top-left { content: "Hello"; } } Is there a way for me to put this div in the content ? Putting an element to the top of each page: @page { @top-center { content: element(pageHeader); } } #pageHeader{ position: running

Opening a PDF in browser instead of downloading it

蓝咒 提交于 2019-11-27 15:52:59
问题 I'm using iTextSharp to print a panel into PDF on button click. After clicking on the button, the PDF is downloading to the client's computer. Instead of this I need the PDF to be opened in a browser instead of downloading. From the browser the user will be able to download the PDF to his PC. I'm using the following code: Response.ContentType = "application/pdf"; Response.AddHeader("content-disposition", "attachment;filename=" + filename + ".pdf"); Response.Cache.SetCacheability

Changing or eliminating Header & Footer in TCPDF

冷暖自知 提交于 2019-11-27 15:31:50
问题 AddPage() in tcpdf automatically calls Header and Footer. How do I eliminate/override this? 回答1: Use the SetPrintHeader(false) and SetPrintFooter(false) methods before calling AddPage() . Like this: $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, 'LETTER', true, 'UTF-8', false); $pdf->SetPrintHeader(false); $pdf->SetPrintFooter(false); $pdf->AddPage(); 回答2: A nice easy way to have control over when to show the header - or bits of the header - is by extending the TCPDF class and creating your

How to create a password protected pdf file

北战南征 提交于 2019-11-27 15:23:57
问题 I'm using html2fpdf for creating PDF documents. Now once I have created that, I want to make sure that the PDF file is password protected. How can this be done in PHP? 回答1: Download the library I am using from a blog post on the ID Security Suite site: <?php function pdfEncrypt ($origFile, $password, $destFile){ require_once('FPDI_Protection.php'); $pdf =& new FPDI_Protection(); $pdf->FPDF('P', 'in'); //Calculate the number of pages from the original document. $pagecount = $pdf->setSourceFile

Convert PDF to UIImage

对着背影说爱祢 提交于 2019-11-27 15:17:59
问题 func drawOnPDF(path: String) { // Get existing Pdf reference let pdf = CGPDFDocumentCreateWithURL(NSURL(fileURLWithPath: path)) // Get page count of pdf, so we can loop through pages and draw them accordingly let pageCount = CGPDFDocumentGetNumberOfPages(pdf); // Write to file UIGraphicsBeginPDFContextToFile(path, CGRectZero, nil) // Write to data // var data = NSMutableData() // UIGraphicsBeginPDFContextToData(data, CGRectZero, nil) for index in 1...pageCount { let page =