Search Results

Search found 5683 results on 228 pages for 'zend pdf'.

Page 151/228 | < Previous Page | 147 148 149 150 151 152 153 154 155 156 157 158  | Next Page >

  • ZIP Numerous Blob Files

    - by Michael
    I have a database table that contains numerous PDF blob files. I am attempting to combine all of the files into a single ZIP file that I can download and then print. Please help! <?php include 'config.php'; include 'connect.php'; $session= $_GET[session]; $query = " SELECT $tbl_uploads.username, $tbl_uploads.description, $tbl_uploads.type, $tbl_uploads.size, $tbl_uploads.content, $tbl_members.session FROM $tbl_uploads LEFT JOIN $tbl_members ON $tbl_uploads.username = $tbl_members.username WHERE $tbl_members.session= '$session'"; $result = mysql_query($query) or die('Error, query failed'); while(list($username, $description, $type, $size, $content) = mysql_fetch_array($result)) { header("Content-length: $size"); header("Content-type: $type"); header("Content-Disposition: inline; filename=$username-$description.pdf"); echo $content; } $files = array('File 1 from database', 'File 2 from database'); $zip = new ZipArchive; $zip->open('file.zip', ZipArchive::CREATE); foreach ($files as $file) { $zip->addFile($file); } $zip->close(); header('Content-Type: application/zip'); header('Content-disposition: attachment; filename=filename.zip'); header('Content-Length: ' . filesize($zipfilename)); readfile($zipname); mysql_close($link); exit; ?>

    Read the article

  • Single Responsibility Principle usage how can i call sub method correctly?

    - by Phsika
    i try to learn SOLID prencibles. i writed two type of code style. which one is : 1)Single Responsibility Principle_2.cs : if you look main program all instance generated from interface 1)Single Responsibility Principle_3.cs : if you look main program all instance genareted from normal class My question: which one is correct usage? which one can i prefer? namespace Single_Responsibility_Principle_2 { class Program { static void Main(string[] args) { IReportManager raporcu = new ReportManager(); IReport wordraporu = new WordRaporu(); raporcu.RaporHazirla(wordraporu, "data"); Console.ReadKey(); } } interface IReportManager { void RaporHazirla(IReport rapor, string bilgi); } class ReportManager : IReportManager { public void RaporHazirla(IReport rapor, string bilgi) { rapor.RaporYarat(bilgi); } } interface IReport { void RaporYarat(string bilgi); } class WordRaporu : IReport { public void RaporYarat(string bilgi) { Console.WriteLine("Word Raporu yaratildi:{0}",bilgi); } } class ExcellRaporu : IReport { public void RaporYarat(string bilgi) { Console.WriteLine("Excell raporu yaratildi:{0}",bilgi); } } class PdfRaporu : IReport { public void RaporYarat(string bilgi) { Console.WriteLine("pdf raporu yaratildi:{0}",bilgi); } } } Second 0ne all instance genareted from normal class namespace Single_Responsibility_Principle_3 { class Program { static void Main(string[] args) { WordRaporu word = new WordRaporu(); ReportManager manager = new ReportManager(); manager.RaporHazirla(word,"test"); } } interface IReportManager { void RaporHazirla(IReport rapor, string bilgi); } class ReportManager : IReportManager { public void RaporHazirla(IReport rapor, string bilgi) { rapor.RaporYarat(bilgi); } } interface IReport { void RaporYarat(string bilgi); } class WordRaporu : IReport { public void RaporYarat(string bilgi) { Console.WriteLine("Word Raporu yaratildi:{0}",bilgi); } } class ExcellRaporu : IReport { public void RaporYarat(string bilgi) { Console.WriteLine("Excell raporu yaratildi:{0}",bilgi); } } class PdfRaporu : IReport { public void RaporYarat(string bilgi) { Console.WriteLine("pdf raporu yaratildi:{0}",bilgi); } } }

    Read the article

  • OpenOffice in Java

    - by user156073
    I need a Java interface to the OpenOffice document conversion which would equal to a manual (Open... and then Save As...) as well as access to the PDF generation. The following are some example of what I want to achieve. 1) Open one type of document (fx. OpenOffice Writer document or Microsoft Office document) onto memory and save it in another supported format. 2) Open one type of document into memory and export it as PDF. I have gone through http://api.openoffice.org but didn't get any material which can help me to get started. I also tried JODConverter but it requires me to run OpenOffice as a service. I wold prefer to include all the core functionality of OpenOffice in one JAR file so that that the user can use my application without installing or running openoffice on their PC. What would be a URL/code snippet from where I can get tutorials to get started? Also do I have to add some JAR files? Will the application work even if I don't have OpenOffice installed on my PC?

    Read the article

  • How Can I Create Reports in a Custom C#.NET Windows Application? - General Question

    - by user311509
    Assume i have a custom Windows application written in C#. This application has only the following functionalists, add, edit, delete and view. For example, a user can add a sale, change sales record, delete a sale record or view the whole sales record. I need to add some reporting functionalists e.g. i want a user to print the sales of a certain customer from 2008 to 2009 into pdf, what all products a certain customer has purchased from us and so on. I will only include the basic common report requests that are usually needed in the office. Any other kind of reports that are requested inconsistently, i would do it manually from my side at the back end and send the results manually to the requester. What i would do is: If a user wants more info of a certain customer, a special window box appears for that customer. This window box will have different controls that allows user to request more info such as, print customer purchases from ..... to ..... (user chooses the dates) and user will view results in pdf or so. Of course, at the back scene i will write an appropriate SQL Query with parameters that meets a certain function. Is this how it should be done? I have heard about SQL Reporting, i don't know anything about it yet. I will check it out. Anyhow, your suggestions won't harm. I'm still a student, so i don't have practical experience yet. I hope my question is clear enough. Thank you.

    Read the article

  • Need a tool to search large structure text documents for words, phrases and related phrases

    - by pitosalas
    I have to keep up with structured documents containing things such as requests for proposals, government program reports, threat models and all kinds of things like that. They are in techno-legalese as I would call them: highly structured, with section numbering and 3, 4 and 5 levels of nesting. All in English I need a more efficient way to locate those paragraphs of nuggets that matter to me. So what I’d like is kind of a local document index/repository, that would allow me to have some standing queries and easily locate sections in documents that talk about my queries. Here’s an example: I’d like to load in 10 large PDF files, each of say 100 pages. Each PDF contains English text, formatted very nicely into paragraphs and sections. I’d like to specify that I am interested in “blogging platforms”, “weaknesses in Ruby”, “localization and internationalization” Ideally then look at a list that showed the section of text, the name of the document, and other information that seemed to be related to and/or include the words and phrases I specified. I am sure something like this exists. I would call it something like document indexing, document comprehension or structured searching.

    Read the article

  • Web framework with JasperReports integration?

    - by Dave Jarvis
    What web development frameworks natively support JasperReports? Consider the following form as an example: <form name="report" method="post"> <input type="hidden" name="REPORT_PATH" value="reports/Names" /> <input type="hidden" name="REPORT_FILE" value="List" /> <input type="hidden" name="REPORT_FORMAT" value="pdf" /> <input type="hidden" name="REPORT_EMBED" value="false" /> Name: <input type="text" name="report_Name" value="" /><br /> Date: <input type="text" name="report_Date" value="" /><br /> <input type="submit" name="View" value="View" /> </form> The framework would pass the report_ parameters to JasperReports, which in turn runs reports/Names/List.jasper, and then sends a PDF attachment to the browser. In general: Ability to configure report (i.e., the hidden REPORT_ variables) Web FORM for setting report parameters (i.e., the report_ variables) Framework handles configuring database connection, report execution, etc. I don't care about the technical minutia on how the integration works. The example above is just one possibility of many.

    Read the article

  • jQuery and IE not playing nice

    - by Neurofluxation
    Hello, I have this section of code: function createDownload() { var category, format, specification, download; $('#submitform').click(function() { category = $('#cate').val(); format = $('#form').val(); specification = $('#spec').val(); if (category == "NULL" || format == "NULL" || specification == "NULL") { alert("Please select all options."); return false; } else { download = "pdfs/"+specification+format+category+".pdf"; window.open(download); } }); } Now... In Internet Explorer it says there is an "Error on the page" - Message: 'return' statement outside of function and I have to click the button again. In Firefox, Chrome and Safari - I have to click the button twice to get the PDF to appear... (and no errors)... Now why could that be?! As per request - My Form declaration: <form method="post" action="javascript: return false;" onSubmit="createDownload();">

    Read the article

  • Python - Things one MUST avoid

    - by Anurag Uniyal
    Today I was bitten again by "Mutable default arguments" after many years. I usually don't use mutable default arguments unless needed but I think with time I forgot about that, and today in the application I added tocElements=[] in a pdf generation function's argument list and now 'Table of Content' gets longer and longer after each invocation of "generate pdf" :) My question is what other things should I add to my list of things to MUST avoid? 1 Mutable default arguments 2 import modules always same way e.g. 'from y import x' and 'import x' are totally different things actually they are treated as different modules see http://stackoverflow.com/questions/1459236/module-reimported-if-imported-from-different-path 3 Do not use range in place of lists because range() will become an iterator anyway, so things like this will fail, so wrap it by list myIndexList = [0,1,3] isListSorted = myIndexList == range(3) # will fail in 3.0 isListSorted = myIndexList == list(range(3)) # will not same thing can be mistakenly done with xrange e.g myIndexList == xrange(3). 4 Catching multiple exceptions try: raise KeyError("hmm bug") except KeyError,TypeError: print TypeError It prints "hmm bug", though it is not a bug, it looks like we are catching exceptions of type KeyError,TypeError but instead we are catching KeyError only as variable TypeError, instead use try: raise KeyError("hmm bug") except (KeyError,TypeError): print TypeError

    Read the article

  • Vehicle License Plate Detection

    - by Ash
    Hey all Basically for my final project at university, I'm developing a vehicle license plate detection application. Now I consider myself an intermediate programmer, however my mathematics knowledge lacks anything above secondary school, therefore producing detection formulae is basically impossible. I've spend a good amount of time looking up academic papers such as: http://www.scribd.com/doc/266575/Detecting-Vehicle-License-Plates-in-Images http://www.cic.unb.br/~mylene/PI_2010_2/ICIP10/pdfs/0003945.pdf http://www.eurasip.org/Proceedings/Eusipco/Eusipco2007/Papers/d3l-b05.pdf When it comes to the maths, I'm lost. Due to this testing various graphic images proved productive, for example: to However this approach is only catered to that particular image, and if the techniques were applied to different images, I'm sure a different, most likely poorer conversion would occur. I've read about a formula called the bottom hat morphology transform, which according to the first does the following: "Basically, the trans- formation keeps all the dark details of the picture, and eliminates everything else (including bigger dark regions and light regions)." Sadly I can't find much information on this, however the image within the documentation near the end of the report shows it's effectiveness. I'm aware this is complicated and vast, I'd just appreciate a little advice, even in terms of what transformation techniques I should focus on developing, or algorithm regarding edge detection or pixel detection. Few things I need to add Developing in C Sharp Confining the project to UK registration plates only I can basically choose the images to convert as a demonstration Thanks

    Read the article

  • How to download a file from a UNC mapped share via IIS and ASP

    - by helgeg
    I am writing an ASP application that will serve files to clients through the browser. The files are located on a file server that is available from the machine IIS is running on via a UNC path (\server\some\path). I want to use something like the code below to serve the file. Serving files that are local to the machine IIS is running on is working well with this method, my trouble is being able to serve files from the UNC mapped share: //Set the appropriate ContentType. Response.ContentType = "Application/pdf"; //Get the physical path to the file. string FilePath = MapPath("acrobat.pdf"); //Write the file directly to the HTTP content output stream. Response.WriteFile(FilePath); Response.End(); My question is how I can specify a UNC path for the file name. Also, to access the file share I need to connect with a specific username/password. I would appreciate some pointers on how I can achieve this (either using the approach above or by other means).

    Read the article

  • Problem executing trackPageview with Google Analytics.

    - by dmrnj
    I'm trying to capture the clicks of certain download links and track them in Google Analytics. Here's my code var links = document.getElementsByTagName("a"); for (var i = 0; i < links.length; i++) { linkpath = links[i].pathname; if( linkpath.match(/\.(pdf|xls|ppt|doc|zip|txt)$/) || links[i].href.indexOf("mode=pdf") >=0 ){ //this matches our search addClickTracker(links[i]); } } function addClickTracker(obj){ if (obj.addEventListener) { obj.addEventListener('click', track , true); } else if (obj.attachEvent) { obj.attachEvent("on" + 'click', track); } } function track(e){ linkhref = (e.srcElement) ? e.srcElement.pathname : this.pathname; pageTracker._trackPageview(linkhref); } Everything up until the pageTracker._trackPageview() call works. In my debugging linkhref is being passed fine as a string. No abnormal characters, nothing. The issue is that, watching my http requests, Google never makes a second call to the tracking gif (as it does if you call this function in an "onclick" property). Calling the tracker from my JS console also works as expected. It's only in my listener. Could it be that my listener is not deferring the default action (loading the new page) before it has a chance to contact Google's servers? I've seen other tracking scripts that do a similar thing without any deferral.

    Read the article

  • Find and Replace with Notepad++

    - by Levi
    I have a document that was converted from PDF to HTML for use on a company website to be referenced and indexed for search. I'm attempting to format the converted document to meet my needs and in doing so I am attempting to clean up some of the junk that was pulled over from when it was a PDF such as page numbers, headers, and footers. luckily all of these lines that need to be removed are in blocks of 4 lines unfortunately they are not exactly the same therefore cannot be removed with a simple literal replace. The lines contain numbers which are incremental as they correlate with the pages. How can I remove the following example from my html file. Title<br> 10<br> <hr> <A name=11></a>Footer<br> I've tried many different regular expression attempts but as my skill in that area is limited I can't find the proper syntax. I'm sure i'm missing something fairly easy as it would seem all I need is a wildcard replace for the two numbers in the code and the rest is literal. any help is apprciated

    Read the article

  • treeview dynamically populated

    - by Laziale
    Hello everyone - I have this treeview control where I want to put uploaded files on the server. I want to be able to create the nodes and the child nodes dynamically from the database. I am using this query for getting the data from DB: SELECT c.Category, d.DocumentName FROM Categories c INNER JOIN DocumentUserFile d ON c.ID = d.CategoryId WHERE d.UserId = '9rge333a-91b5-4521-b3e6-dfb49b45237c' The result from that query is this one: Agendas transactions.pdf Minutes accounts.pdf I want to have the treeview sorted that way too. I am trying with this piece of code: TreeNode tn = new TreeNode(); TreeNode tnSub = new TreeNode(); foreach (DataRow dt in tblTreeView.Rows) { tn.Text = dt[0].ToString(); tn.Value = dt[0].ToString(); tnSub.Text = dt[1].ToString(); tnSub.NavigateUrl = "../downloading.aspx?file=" + dt[1].ToString() +"&user=" + userID; tn.ChildNodes.Add(tnSub); tvDocuments.Nodes.Add(tn); } I am getting the treeview populated nicely for the 1st category and the document under that category, but I can't get it to work when I want to show more documents under that category, or even more complicate to show new category beneath the 1st one with documents from that category. How can I solve this? I appreciate the answers a lot. Thanks, Laziale

    Read the article

  • Rendering blocks side-by-side with FOP

    - by Rolf
    I need to generate a PDF from XML data using Apache FOP. The problem is that FOP doesn't support fo:float, and I really need to have items (boxes of rendered data) side-by-side in the PDF. More precisely, I need them in a 4x4 grid on each page, like so: In HTML, I would simply render these as left-floated divs with appropriate widths and heights. My data looks something like this: <item id="1"> <a>foo</a> <b>bar</b> <c>baz</c> </item> <item id="2">...</item> ... <item id="n">...</item> I considered using a two-column region-body, but then the order of items would be 1, 3, 2, 4 (reading from left to right) since they would be rendered tb-lr instead of lr-tb, and I need them to be in the correct order (id in above xml). I suppose I could try using a table, but I'm not quite sure how to group the items into table rows. So, some kind of workaround for the lack of fo:float would be greatly appreciated.

    Read the article

  • PHP Outputting File Attachments with Headers

    - by OneNerd
    After reading a few posts here I formulated this function which is sort of a mishmash of a bunch of others: function outputFile( $filePath, $fileName, $mimeType = '' ) { // Setup $mimeTypes = array( 'pdf' => 'application/pdf', 'txt' => 'text/plain', 'html' => 'text/html', 'exe' => 'application/octet-stream', 'zip' => 'application/zip', 'doc' => 'application/msword', 'xls' => 'application/vnd.ms-excel', 'ppt' => 'application/vnd.ms-powerpoint', 'gif' => 'image/gif', 'png' => 'image/png', 'jpeg' => 'image/jpg', 'jpg' => 'image/jpg', 'php' => 'text/plain' ); // Send Headers //-- next line fixed as per suggestion -- header('Content-Type: ' . $mimeTypes[$mimeType]); header('Content-Disposition: attachment; filename="' . $fileName . '"'); header('Content-Transfer-Encoding: binary'); header('Accept-Ranges: bytes'); header('Cache-Control: private'); header('Pragma: private'); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); readfile($filePath); } I have a php page (file.php) which does something like this (lots of other code stripped out): // I run this thru a safe function not shown here $safe_filename = $_GET['filename']; outputFile ( "/the/file/path/{$safe_filename}", $safe_filename, substr($safe_filename, -3) ); Seems like it should work, and it almost does, but I am having the following issues: When its a text file, I am getting a strange symbol as the first letter in the text document When its a word doc, it is corrupt (presumably that same first bit or byte throwing things off). I presume all other file types will be corrupt - have not even tried them Any ideas on what I am doing wrong? Thanks - UPDATE: changed line of code as suggested - still same issue.

    Read the article

  • How do you lock down & secure files stored on server in ASP.NET?

    - by Jon
    How do I go about securing files that are stored on the server? We have an ASP.NET app which generates PDFs. These are not stored in the wwwroot folder but in another folder i.e. C:\inetpub\data. This provides more security but maybe not enough. The ASP.NET/IIS process will need write access to this folder so it generate the PDFs there. Once the pdf is generated, it can be viewed using an ASP.NET form called viewpdf.aspx with the file to be viewed add to the query string like so viewpdf.aspx?FILE=mynewfile.pdf. This is loaded from a gridview. The full path to C:\inetpub\data is resolved and loaded in the Page_load event of the viewer page. Now I'm wondering how to secure this. Anybody could just view the file. Not by entering in the URL, as it won't been seen by IIS (its not in wwwroot), but could change the querystring in the viewpdf page. How do I stop anybody hacking this?

    Read the article

  • Rendering a CGPDFPage into a UIImage

    - by James Antrobus
    I'm trying to render a CGPDFPage (selected from a CGPDFDocument) into a UIImage to display on a view. I have the following code in MonoTouch which gets me part way there. RectangleF PDFRectangle = new RectangleF(0, 0, UIScreen.MainScreen.Bounds.Width, UIScreen.MainScreen.Bounds.Height); public override void ViewDidLoad () { UIGraphics.BeginImageContext(new SizeF(PDFRectangle.Width, PDFRectangle.Height)); CGContext context = UIGraphics.GetCurrentContext(); context.SaveState(); CGPDFDocument pdfDoc = CGPDFDocument.FromFile("test.pdf"); CGPDFPage pdfPage = pdfDoc.GetPage(1); context.DrawPDFPage(pdfPage); UIImage testImage = UIGraphics.GetImageFromCurrentImageContext(); pdfDoc.Dispose(); context.RestoreState(); UIImageView imageView = new UIImageView(testImage); UIGraphics.EndImageContext(); View.AddSubview(imageView); } A section of the CGPDFPage is displayed but rotated back-to-front and upside down. My question is, how do I select the full pdf page and flip it round to display correctly. I have seen a few examples using ScaleCTM and TranslateCTM but couldn't seem to get them working. Any examples in ObjectiveC are fine, I'll take all the help I can get :) Thanks

    Read the article

  • Wrong values reported by pyPDF for various box regions

    - by romor
    Using pyPdf, for most files I get matched results concerning various box's dimensions compared to what Acrobat reports. However for some files I get different values reported by pyPdf and Acrobat, like: pyPdf: artBox: 595.3 x 841.9 bleedBox: 595.3 x 841.9 cropBox: 595.3 x 841.9 trimBox: 517.3 x 754 Acrobat: artBox: 439.35 x 666.13 pt bleedBox: 439.35 x 666.13 pt cropBox: 439.35 x 666.13 pt trimBox: 439.35 x 666.13 pt I thought it's units issue, but then ratio between widths and heights doesn't match also, not mentioning trimBox mismatch Correct results are those reported by Acrobat of course. Does someone know why is this and is there a way I get correct dimensions by using pyPdf? Thanks couple of minutes later... After reading this question: Are PDF box coordinates relative or absolute? I figured I didn't considered uper left corner to be different then 0 (zero). It turned out that box starts at 77.95 x 87.87, so if we reduce reported values of trimBox by this values correct result is obtained. artBox: 0 x 0 bleedBox: 0 x 0 cropBox: 0 x 0 trimBox: 77.95 x 87.87 Other boxes seem with misleading values or I misinterpret them. Snippet: from pyPdf import PdfFileReader pdfread = PdfFileReader(file('my.pdf', 'rb')) page = 1 width = pdfread.getPage(page).trimBox[2]-pdfread.getPage(page).trimBox[0] height = pdfread.getPage(page).trimBox[3] - pdfread.getPage(page).trimBox[1] print width, height

    Read the article

  • UIWebView autosize issue only on iOS 4.3

    - by troop231
    I am trying to figure out how to fix this bug that only occurs on iOS 4.3. When the application launches, it displays a PDF that is scaled to fit in the UIWebView. It behaves perfectly until you pinch to zoom on the document, and then rotate it, leaving behind a black area. If you don't pinch to zoom, it doesn't leave the black area. I don't understand why this is a iOS 4.3 only issue. Screenshot of the issue: I've been trying to solve this problem awhile now, and would greatly appreciate your help. Thank you. Screenshots of the .xib settings: The code I'm using is: .h: #import <UIKit/UIKit.h> @interface ViewController : UIViewController { UIWebView *webView; } @property (nonatomic) IBOutlet UIWebView *webView; @end .m: #import "ViewController.h" @interface ViewController () @end @implementation ViewController @synthesize webView; - (BOOL)shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)interfaceOrientation { if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { return YES; } else { return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown); } } - (void)viewDidLoad { [super viewDidLoad]; NSString *urlAddress = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"pdf"]; NSURL *url = [NSURL fileURLWithPath:urlAddress]; NSURLRequest *requestObj = [NSURLRequest requestWithURL:url]; [webView loadRequest:requestObj]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; } @end

    Read the article

  • pyPDF - Retrieve page numbers from document

    - by SquidneyPoitier
    At the moment I'm looking into doing some PDF merging with pyPdf, but sometimes the inputs are not in the right order, so I'm looking into scraping each page for its page number to determine the order it should go in (e.g. if someone split up a book into 20 10-page PDFs and I want to put them back together). I have two questions - 1.) I know that sometimes the page number is stored in the document data somewhere, as I've seen PDFs that render on Adobe as something like [1243] (10 of 150), but I've read documents of this sort into pyPDF and I can't find any information indicating the page number - where is this stored? 2.) If avenue #1 isn't available, I think I could iterate through the objects on a given page to try to find a page number - likely it would be its own object that has a single number in it. However, I can't seem to find any clear way to determine the contents of objects. If I run: pdf.getPage(0).getContents() This usually either returns: {'/Filter': '/FlateDecode'} or it returns a list of IndirectObject(num, num) objects. I don't really know what to do with either of these and there's no real documentation on it as far as I can tell. Is anyone familiar with this kind of thing that could point me in the right direction?

    Read the article

  • jquery mobile mPDF not rendering on form submission

    - by Adam
    Im trying to have the user submit form data to a mPDF page the will render a pdf with the data included. The problem Im having is that jquery mobile initializes the mPDF page not allowing the mPDF to render properly. Im trying to figure out how to stop jquery mobile from initializing the mPDF page. Just a note, when I remove query mobile the functionality works. HTML <form id="rxForm" method="post" action="rxPDF.php"> <input type="text" name="dueDate"></form> </form> <button id="printPDF">Submit</button> JQUERY $('#printPDF').on('click', function() { console.log('pdf'); $('#rxForm').submit(); return false; }); mPDF <?php include ("library/mpdf.php"); $dueDate = $_POST['dueDate']; $html = 'The date is '.$dueDate.''; $mpdf = new mPDF(); $mpdf->WriteHTML($html, 0); $mpdf->Output(); exit; ?> I appreciate anyone's help!

    Read the article

  • How do I write recursive anonymous functions?

    - by James T Kirk
    In my continued effort to learn scala, I'm working through 'Scala by example' by Odersky and on the chapter on first class functions, the section on anonymous function avoids a situation of recursive anonymous function. I have a solution that seems to work. I'm curious if there is a better answer out there. From the pdf: Code to showcase higher order functions def sum(f: Int => Int, a: Int, b: Int): Int = if (a > b) 0 else f(a) + sum(f, a + 1, b) def id(x: Int): Int = x def square(x: Int): Int = x * x def powerOfTwo(x: Int): Int = if (x == 0) 1 else 2 * powerOfTwo(x-1) def sumInts(a: Int, b: Int): Int = sum(id, a, b) def sumSquares(a: Int, b: Int): Int = sum(square, a, b) def sumPowersOfTwo(a: Int, b: Int): Int = sum(powerOfTwo, a, b) scala> sumPowersOfTwo(2,3) res0: Int = 12 from the pdf: Code to showcase anonymous functions def sum(f: Int => Int, a: Int, b: Int): Int = if (a > b) 0 else f(a) + sum(f, a + 1, b) def sumInts(a: Int, b: Int): Int = sum((x: Int) => x, a, b) def sumSquares(a: Int, b: Int): Int = sum((x: Int) => x * x, a, b) // no sumPowersOfTwo My code: def sumPowersOfTwo(a: Int, b: Int): Int = sum((x: Int) => { def f(y:Int):Int = if (y==0) 1 else 2 * f(y-1); f(x) }, a, b) scala> sumPowersOfTwo(2,3) res0: Int = 12

    Read the article

  • Serving .docx files through Php

    - by user275074
    Hi, I'm having issues when attempting to serve a .docx file using Php. When uploading the file I detect the file mime type and upload the file using the file with the correct extension based on the mime type; e.g. below: application/msword - doc application/vnd.openxmlformats-officedocument.wordprocessingml.document - docx When attempting to serve the files for download, I do the reverse in detecting the extension and serving based on the mime type e.g. public static function fileMimeType($extention) { if(!is_null($extention)) { switch($extention) { case 'txt': return 'text/plain'; break; case 'odt': return 'application/vnd.oasis.opendocument.text'; break; case 'doc': return 'application/msword'; break; case 'docx': return 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'; break; case ('jpg' || 'jpeg'): return 'image/jpeg'; break; case 'png': return 'image/png'; break; case 'pdf': return 'application/pdf'; break; default: break; } } } All files appear to download correctly and open fine but when attempting to open a docx file, Word (on multiple files) throws a error stating the file is corrupt. Any ideas would be great, thanks.

    Read the article

  • Pass object from webserver to client

    - by user362914
    I developed a C# web application that calls a web-service which returns a base64 encoded array (PDF file). I then convert that array into a UCOMIStream object (I know it is obsolete, but the DLL that I am using requires it as a parameter). I use the following code to do the conversion which works perfectly. I can pass this object to the DLL so that I can print the PDF. This works great on the Webserver, but the requirement is to print it locally. Byte[] bBuffer = statementOut.statementcycle.statementdata.content; int size = bBuffer.Length; IntPtr mem = Marshal.AllocHGlobal(size); Marshal.Copy(bBuffer, 0, mem, size); // Create an OLE Stream object. System.Runtime.InteropServices.UCOMIStream str; //obsolete but the createstreamonhglobal outputs it CreateStreamOnHGlobal(mem, true, out str); The DLL resides on the client so I am able to use ActiveX to create the object using javascript and/or VBscript;however, I have not been able to figure out how to get the stream object to the client to pass to the DLL. How can this be achieved?

    Read the article

  • Image not rendering in dompdf

    - by Venkat
    I am using codeIgniter and dompdf for my application for generating pdfs. The below code is the code which i am using to display an image. <div class=\"block_head\"> <h2>Image display</h2>"; $image_location = "/images/xxx.png"; $html .="<img src=\"".$image_location."\" width=\"200\" height=\"200\" /> </div>"; I tested and debugged all ways whether i am doing something wrong. Like this first i checked whether the path is wrong. This is path on the server. It's correct. I tested by echoing $html also it's showing perfectly path. When i clicked on that path image is displaying. But when i am trying to render it in pdf it's not displaying. Note: PDF is generating perfectly without image.

    Read the article

< Previous Page | 147 148 149 150 151 152 153 154 155 156 157 158  | Next Page >