pdf-generation

Turning HTML Results Page into PDF and Downloading in CGI file

只谈情不闲聊 提交于 2019-12-25 07:24:16
问题 I am working in PERL and I have an html results page that displays perfectly. I want to add a button that makes this html page a pdf that downloads onto your machine. Below is the code that generates the html page. fileFH is generated in the CGI code. sub searchResults { my $data = shift; my $file = "$OUTFILES/$data.html"; open(my $fileFH, '<', $file) or return "Can not find file\n"; print $cgi->header(); while (<$fileFH>) { print qq($_); } close($fileFH); } 回答1: If you are open to an

Is there a way to create Bookmarks for pdf documents in PDFBOX?

独自空忆成欢 提交于 2019-12-25 07:10:11
问题 I am currently generating a large document from a database scheme and especially in bigger databases the amount of pages quickly exceeds 1000 pages... I use PDFBox to create the document and I am wondering whether PDFBox supports any way of creating Bookmarks that are displayed in the left side of Acrobat when viewing the document. On the website (and the related documentation) I haven't found anything helpful so far... Thanks in advance! 来源: https://stackoverflow.com/questions/24954281/is

Using iTextPDF to trim a page's whitespace

本秂侑毒 提交于 2019-12-25 06:38:46
问题 I have a pdf which comprises of some data, followed by some whitespace. I don't know how large the data is, but I'd like to trim off the whitespace following the data PdfReader reader = new PdfReader(PDFLOCATION); Rectangle rect = new Rectangle(700, 2000); Document document = new Document(rect); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(SAVELCATION)); document.open(); int n = reader.getNumberOfPages(); PdfImportedPage page; for (int i = 1; i <= n; i++) { document

Installation of mikehaertl-phpwkhtmltopdf on xampp - for dummies

梦想的初衷 提交于 2019-12-25 04:22:48
问题 I've tried to use this post: How do I get WKHTMLTOPDF to execute via PHP? but I'm missing something. I'm hoping for a real dummies guide here... Installing mikehaertl-phpwkhtmltopdf on windows/xampp/codeigniter Acquire and install wkhtmltopdf. This will typically install to C:\program files\wkhtmltopdf\lib or similar on windows. Acquire and unpack Mikehaertl's wrapper (e.g. wkhtmltox-win64_0.12.0-03c001d) Place the WkHtmlToPdf.php file in ??????? Do I edit the WkHtmlToPdf.php file and put in

How to convert MySQL data from page into PDF

老子叫甜甜 提交于 2019-12-25 04:07:48
问题 I want to convert data that I retrieve from mySQL database into PDF on image click. I want to place image on each article from my website, and when someone click on that image, automaticaly gets pdf version of the article. How can I do that? Please help me. For retrieve data from MySQL I use this: <?php $id = (int)$_GET['vij']; $sql="SELECT id,news_title,news_text,publish_date,hit_count FROM news WHERE id=$id"; $result=mysql_query($sql); while($rows=mysql_fetch_array($result)){ ?> and then

Image not displayed on pdf

五迷三道 提交于 2019-12-25 03:59:05
问题 I'm trying to include an image into a pdf wich is generated via XSL using Apache Cocoon. I've read about the tag <fo:external-graphic> wich works fine when a image is stored on the local drive or when you request an image wich resides physically on any server. But what i need is to show in the pdf an image (codebar image) wich is generated dinamically by a jsp , that is to say, java generates the image and it will never be stored on the hard drive. The image is generated correctly by the jsp

Jasper Report Generates a PDF and then Glassfish crashes/shutsdown

我的梦境 提交于 2019-12-25 03:36:43
问题 I am running an app I have developed in JSF/Java and as soon as I got JasperReports ExporttoPDFFile to start working and ran the app, the jrxml is compiled and displayed, then exported to a pdf file, that looks exactly as it should and the proper page is returned by the JSF and loads but then Glassfish 3 stops working and I have to start or restart it before I can continue to use the app again, everything works fine until the JasperReports compile and export... any ideas? http://pastebin.com

Export Doc to PDF Asp.net

拥有回忆 提交于 2019-12-25 03:09:03
问题 So I am using this code, to export a formview to Word. Its works great..But I want it to export to PDF so that it cannot be edited. Or may be to a word doc so that not body can make changes. protected void Button1_Click(object sender, EventArgs e) { Response.Clear(); Response.Buffer = true; Response.AddHeader("content-disposition", "attachment;filename=Report.doc"); Response.Charset = ""; Response.ContentType = "application/vnd.ms-word"; StringWriter sw = new StringWriter(); HtmlTextWriter hw

ABCpdf, render an HTML within a “template”: How to add margin?

限于喜欢 提交于 2019-12-25 02:58:12
问题 I'm trying to render an HTML within a predefined PDF-template (e.g. within a frame.) The template/frame should reach the edges. But the HTML shouldn't do that. So I need some kind of margin for the HTML only. Here is my code so far: var doc = new Doc(); doc.MediaBox.String = "A4"; doc.Rect.String = doc.MediaBox.String; var id = doc.AddImageUrl(url.ToString()); doc.AddImageDoc("template.pdf", 1, doc.MediaBox); while (doc.Chainable(id)) { doc.Page = doc.AddPage(); id = doc.AddImageToChain(id);

Assigning an Existing Custom Layout/Navigator to a Portfolio Generated By iTextSharp

ε祈祈猫儿з 提交于 2019-12-25 02:54:00
问题 I am generating collections (Acrobat Portfolios) via iTextSharp. I would like to assign an existing custom navigator (custom layout) to the generated collection. I believe iTextSharp allows for the CUSTOM parameter to define a custom navigator, as in the last code line of this block: Document document = new Document(); FileStream stream = new FileStream(portfolioPath, FileMode.Create); PdfWriter writer = PdfWriter.GetInstance(document, stream); document.Open(); document.Add(new Paragraph(" ")