Forgot your password?
typodupeerror
Printer Software

PDF Writers? 94

Posted by Cliff
from the reports-are-a-PHBs-best-friend dept.
Saqib Ali asks: "I am looking for for some OpenSource PDF Writers/Creator. I found one, here. It can basically create PDFs out of common software Like OfficeSuite, Visio, Project or any other Windows Application that uses the Windows Printers. I know OpenOffice can also export to PDF. I am working on a project (fat client) where I need to dynamically create PDF reports from data stored in MySQL DB. I know I can use PHP to create PDFs, and also Apache's Cocoon (you can find an example document, here). Of course, I would like to investigate other OpenSource PDF writers as well. Do you know of any other PDF writers, that I can utilize or learn from by looking at the source-code?"
This discussion has been archived. No new comments can be posted.

PDF Writers?

Comments Filter:
  • You should try jpedal: http://sourceforge.net/projects/jpedal/

    Basically this is a open source library for reading and writing pdfs.
  • PDF Writer (Score:1, Funny)

    by Anonymous Coward
    Objective: To attain a position of PDF Writer with your company, which will enhance my personal and professional skills.

    Education: Springfield Heights Institute of Technology, major Technical Writing (specialization - PDF writing), AA in Desktop Publishing

    Work experience: PDF Writer, Smith & Wesson Law Offices (extensively wrote PDFs of legal brifs)

    PDF Writer, MS Word writer, I.Scruuyu Medical Insurance (extensively wrote and proofread medical documents)

    Additional skills: I like biking and modern mu
  • CUPS (Score:5, Informative)

    by benjamindees (441808) on Friday October 24, 2003 @08:47PM (#7305795) Homepage
    CUPS has an option for a virtual PDF printer in Linux, called CUPS-PDF [uni-wuerzburg.de].
    I think it's included in RedHat 9.
    • You can also setup a fake printer under samba. Send it postscript information, and it will write out to a ps file then use ps2pdf on it. Works great. Use any PS printer driver (color of course if you want color pdfs) and install it. When you print, it can output the resulting file into a share somewhere the user can access. Really creative scripting can get it to be either emailed to the user who printed it...
      • Nice solution but is it elegant? Is it efficient? I can tell you for experience that going through Postscript to get to PDF will sooner or later turn into a nightmare.

        It is truly time to kill postscript and standardize on PDF (good luck to Microsoft with their InfoPath).
        • Nice solution but is it elegant? Is it efficient? I can tell you for experience that going through Postscript to get to PDF will sooner or later turn into a nightmare.

          When? Why? It's worked great for me for a decade, including documents of substantial size and complexity.

          • See we develop large maintenance manuals and our current processes produces PS files the size of 10 gigs. We have to take those files and convert them into PDF files. Once they are converted to PDF files, we can't delete the PS until we have verified that the conversion precesses didn't introduce glitches (which it tends to sometimes).

            Plus PS files are much bigger than PDF files. If you ever encounter a PS file bigger than 2048MB you are in deep dodo. Can't produce PDF files from it without having to split
            • Plus PS files are much bigger than PDF files.

              Small ones are, but not necessarily large ones - depends on what you're doing.

              Sounds like the work you do is a lot of B&W where the bulk of data is text positioning.

              My experience comes from the glossy magazine world (managed transfer to all-digital production at a magazine on almost every newsstand in the USA). Worked with documents of similar size to yours, but fewer pages I'm sure. Most of the data was color images, which don't necessarily get much

      • For Unix/BSD lpd system, you can actually use
        ghostscript as printer filter (if=) in printcap(5),
        and use that printer to print from samba.
        No need to manually throw it to ps2pdf for that.
        I just can't find the posting now where I first
        read about it.
  • fpdf.org (Score:5, Informative)

    by Bonewalker (631203) on Friday October 24, 2003 @08:55PM (#7305837)
    I have found this site useful. The entire class is in one php file. Just move it to your web server, then use some of the tutorials to get the hang of creating pdf's on the fly.

    http://www.fpdf.org

    • wow! I'm gonna check that out. Also, to the original poster I thought I'd mention that PHP has built-in functions for creating PDFs out of raw elements (curves, text blocks, etc), if you're so inclined. Just check to make sure that your PHP administrator has installed the necessary libraries.
      • PHP has built-in functions for creating PDFs out of raw elements (curves, text blocks, etc)

        Keep in mind that PDFlib is non-free except for personal use.

    • i think this maybe exactly what i was looking for. Thanks for the URL.
      It supports links and page breaks. those were 2 of my major requirements.
    • I'd like to second that. I'm pulling data from Oracle and dynamically generating letters using FPDF, backing them up, and then sending them to a printer. FPDF gave me the pixel-level precision required to copy the customer's layout. It also handles graphics very well - I'm placing the client's logo on each page.
  • OpenOffice (Score:4, Informative)

    by Drakon (414580) * on Friday October 24, 2003 @08:56PM (#7305839) Journal
    Openoffice can not only write PDFs, it can also read data from a mySQL (or other ODBC/JDBC compliant) databases.
    I don't see any reason not to use it out of the box for such a purpose... or am I missing something?
    • hmm (i think) this would require installing OO on customers computers, which i have no control over :(
    • You're missing something. He said "fat client", not "obscenely bloated obese application shoehorned into a fat client".
    • OpenOffice.org doesn't keep the hyperlinks or other metadata in the final pdf. I use Acrobat at work for publishing company docs. Cross-linking is absolutely necessary to make the finished docs useable for end users. Are there any non-adobe OSS PDF writers that keep the meta-data too?
  • PDF Converters (Score:5, Informative)

    by RedPhoenix (124662) on Friday October 24, 2003 @08:56PM (#7305841)
    Some of these might be useful:

    Txt2pdf - http://www.sanface.com/txt2pdf.html
    html2pdf - http://www.geocities.com/SiliconValley/Lab/5247/
    HTMLDoc - http://www.easysw.com/htmldoc/pdf-o-matic.php
    Den ature - http://freshmeat.net/projects/denature/
    csv2pdf - http://freshmeat.net/projects/csv2pdf/
    ascii2pdf - http://freshmeat.net/projects/ascii2pdf/

    And a google directory reference: http://directory.google.com/Top/Computers/Software /Word_Processors/PDF/Converters/

    Good luck!

    Red.
    • Re:PDF Converters (Score:3, Informative)

      by saden1 (581102)
      Add iText [lowagie.com] to the mix. It is a Java library capable of doing almost anything. The only down side is it is slower than native C libraries out there. If speed is a real issue, you could compile your iText Java classes using GCJ and convert them into native code. I'm thinking doing so will seed up your application. I haven't tried converting it to native code, has anyone?
      • Beware gcj native code generation for exceptions. Be very very ware... it's about 100,000 times slower than java, for reasons that are totally beyond my comprehension. Milliseconds to handle a single thrown exception.
    • http://www.infres.enst.fr/~demaille/a2ps/ [infres.enst.fr]

      Richard Stallman please note: this is a genuinely GNU project, so I'm calling it "GNU a2ps" with pleasure and satisfaction, but the Linux I use is either "Mandrake Linux 9.2" after the distributors who do some much work to get it all packaged and integrated right, or "GNU/SGI/BSD/KDE/Apache/Sun/IBM/{blah,blah,cows come home}/OSF/Linux", or just plain "Linux".

    • I have been looking (for years) for a PDF generator that will handle complex tables, with requirements that include:
      - automatic column sizing (like HTML)
      - clean break between pages
      - repeated header and footer on each page

      None of the open source generators, none of the Commercial ones (including Adobe's expensive solution), and not even LaTeX with the longtable package will do this.

      I guess I'm going to have to try some postscript generators like OpenOffice. PDF generation is evidently still in its infancy.
  • XO? FO? (Score:2, Informative)

    by cookiepus (154655)
    This is going to be the vaguest useful answer given...

    Back in the day I needed to turn some XML files into HTML files by applying an XSL transformation. I also found out that the same process can be done for making PDF files using something called FO (or was it XO?) from the Apache people (not the Indians)

    I made XSL files with PDF-generating tags and then ran 'em through this Java library. Since out backend was made in Java anyway it was a perfect fit.

    It would be quite exciting if I was a geek and cared
  • ps2pdf (Score:4, Informative)

    by GiMP (10923) on Friday October 24, 2003 @09:16PM (#7305926)
    Practically every Unix applications output postscript when issued a print command. If the software doesn't allow you to print to file, then print to the command "cat > file.ps" to save to file.ps.

    Then, run:
    ps2pdf -r600 file.ps file.pdf

    You can change the 600 to whatever resolution you wish.

    If you're grabbing this from a database, you can simply output in text and use ascii2ps to create a pdf file.
    • one problem with this solution is that, I will lose the ability to have hyperlinks in the document. (i think). correct me if i m wrong.
      • You're correct, ps2pdf uses the Ghostscript engine, which does not yet support links (AFAIK).

        Actually, PostScript doesn't support links anyway, so you'll lose them as soon as you printed to PS.

      • You *may* be wrong. I've been able to run a toolchain of doxygen|latex|ps2pdf and end up with a hyperlinked pdf with a bookmared index. But I have no comprehension of how this works. I don't know why I didn't use pdflatex, but I very clearly remember this working.
      • BTW, PDFCreator is Ghostscript based.
  • by qeloi (313191)

    You didn't specify OS, though I reckon it's probably an open source one. However, I'll post this anyway, in case it can help anyone:

    Under Windows, you can add the driver for the "Apple Color LW 12/660 PS" printer, pointed at the FILE: port (i.e., it prints to a file). The resulting files are PostScript. You can then install GhostScript [wisc.edu] (either on its own or as part of Cygwin [cygwin.com]) and use the ps2pdf utility to convert it to PDF. It's not very featureful (e.g., it can't generate document indices or anything),

    • PDF995 [pdf995.com] is a (non-open-source, ad-supported) application that sits between your Windows printer driver and ps2pdf, and streamlines the process. I love it... it's made out of open-source parts, but it's not open-source itself though. sorry. ^_^

      Actually, PDF995 sounds a lot like PDFCreator; I'm gonna check PDFCreator out.

      I guess the problem with a solution like PDF995, ps2pdf, and PDFCreator is that they're not complete tools that would bridge your gap between SQL queries and finished PDF... probably the be

      • Will second this. We just deployed it out to over 5000 users for use as their primary PDF program. Works like a charm, and was much cheaper than Acrobat.

        Of course, doesn't allow for editing of the document, but all we needed was just a way for users to create PDFs.
      • The questioner asked to:

        [...]
        investigate other OpenSource PDF writers as well. Do you know of any other PDF writers, that I can utilize or learn from by looking at the source-code?"

        Your reply discussed "[...] a (non-open-source, ad-supported) application [...]". I don't understand how this answers the question asked.

        • Whoops. didn't see the part where the questioner asked about being able to see the source code. I guess I just wanted to mention PDF995 to the world-at-large... actually, I knew that my answer wasn't gonna answer the guy's question... that's why I said "sorry" to him in my post.

          Mod me OT if you like, but I was aware I was slightly OT in the first place.

  • They have a great website that creates dynamically generated pdfs at http://papercdcase.com/ [papercdcase.com] I bet if you donate some cash they might hook you up with some source code.
  • MZ


    This program reqires Microsoft Windows.


    PE
  • I don't know of too many PDF creators for Win32 besides Adobe Acrobat. I work with text-based documents a lot and wonder if there's something cheaper (and hopefully open-source!) that can do the following...

    - New/recent updates (no programs with limited support)
    - Integrated fonts (fonts that stay with the PDF)
    - Graphics compression
    - Great quality output (line art stays where it should, etc)
    - Easy-to-use UI (no command-line-only stuff)
    - Reasonable cost (less than $69/user preferrably)

    Anyone know of anythin
    • Searching Google for "PDF printer" yields a few promising results. One is Expert PDF 2 [visagesoft.com]. The standard edition appears to include the integrated-font and graphic-compression features you want. I've never heard of it before.

      On Windows 2000, I use RedMon [wisc.edu] in conjunction with Ghostscript [wisc.edu]. RedMon is a generic port redirector, but it includes instructions on piping Postscript output from any Windows program into Ghostscript, which can export PDFs.

      I don't know what RedMon's support system is like, but on the other

      • I use redmon + ghostscript under XP. It's a workable solution but far from perfect. When redmon pops up a save dialog for the pdf it is always below the application from which you print. Sometimes it does not appear at all. If this happens it means you have to reboot (or at least log out) to be able to print your document to it (or anything else). Probably there's a better solution but this is the easiest way to solve the problem. If it works you get a nice pdf but without features such as a table of conten
    • Take a look at CutePDF [acrosoftware.com] - they stuffed GhostScript into a Windows print driver. It's worked well with the things I've thrown at it. It's also free and GPL.
      • Hmm, let's try a Word doc in both CutePDF and PDFCreator (the two best free apps, and both based in GhostScript, bar none - I expect the only differences to be in UI, seeing as they ARE both GS based):

        CutePDF Install Process: Fail VERY quickly (can't get through WZSE (Error 0 running SETUP.EXE)
        Hand unzipped (nobody would think of this) into C:\cuteprintertemp.
        Installer crashed my print spooler.

        PDFCreator Install Process: I think it worked right, but I forget...

        CutePDF: Ease of use (according to help file
    • http://sourceforge.net/projects/pdfcreator/

      Open source, windows pdf writer driver. Just select print, PDFCreator, save.
  • One of the probs with PDFLib is that you may not be able to get it installed as a PHP library where you're hosting. Thankfully a number of PHP code versions exist.

    One I hear good things about is the R&OS pdf class [ros.co.nz].

    Another I found was an HTML to PDF convertor from here [rustyparts.com].

    I've not used either of those so YMMV.

    Some of the PHP code sites have a few [phpclasses.org] as well.
  • XML - FO - PDF (Score:3, Interesting)

    by Mulligan (29951) on Friday October 24, 2003 @09:39PM (#7306005)

    My current favorite for PDF generation is to build an XML [w3.org] document programatically. This document has no layout information, so I use Saxon [sourceforge.net] and an XSLT [w3.org] stylesheet to translate it to XSL Formatting Objects [w3.org]. From there, I use FOP [apache.org] to translate to PDF.

    The best part is that the XML document contains the content, while the XSLT stylesheet describes how to make a document out of it. If I need a screen version all I have to do is write another stylesheet to translate to HTML.

    • Yea I am using FO to generate PDF on my Cocoon server ( http://www.xml-dev.com [xml-dev.com] ) right now. It worx out pretty nicely. :)
    • Re:XML - FO - PDF (Score:3, Insightful)

      by pi_rules (123171) *
      I second the parent's suggestion. Been there, done that, and it rocked, even when FOP was at the 0.17 release. It worked pretty darned well, and you just had to make another XSLT sheet to turn the document into HTML.

      Yes, it's a big task and not the "quick and dirty" method but it works really well and gives you exactly the results that you want if you want to put the time into it. The XML+XSLTT -> processor model is definately the way to for things that you expect to last a while into the future.
    • It looks like a nice solution in theory. Byt XML-FO is a whole language by itself and add to this the complexity of the XSLT language, and you are looking at two new XML linguo to learn just to generate PDF... ugh !
  • It really depends on what your looking to do for what I would recommend. I definately don't think you'll be quickly hacking together some solution by looking at others source code. The actual pdf spec is over 500 pages. There are several COM components that will let you draw to a pdf canvas but for anything useful thats pretty basic. In the python world there is the wonderful reportlab. Its built ontop of another library (can't remember what right now) and is very full featured. One project I was on h
  • It's built into the OS/X printing subsystem.
  • by jefu (53450)
    The apache fop [apache.org] is an XMLFO to pdf converter. Quite nice actually.

    There's also a TeX to PDF converter called pdftex [tug.org].

    And, of course, pdf is really just a wrapper around Postscript so its pretty easy to convert Postscript to PDF.

  • Using Mozilla you can print a page to a postscript file and then use the command line program ps2pdf to convert it to a pdf. It isn't exactly a generic PDF library like was asked for, but it is pretty kewl. It works great for creating a quick mirror of a page including images.
  • ps2pdf is a little shell script which calls ghostscript to convert postscript to pdf. You can also set up an lpd server to use ghostscript as a print filter. I wrote a simple little CGI script to make the generated PDFs available via apache so users didn't need access to the box - they just print to the PDF spool and then download their pdf from the web page. Jobs are deleted after 3 days via cron. 'Course I set all this up before CUPS was available... there's probably an easier way to do this with CUPS-PDF
  • iText [lowagie.com] is an open-source Java PDF library that works pretty well and is fairly simple to use.

    Also, JFreeReport [jfree.org] is an open-source Java reporting library that makes it easy to generate reports in various formats - PDF, HTML, CSV, Excel, plain text.
  • by Webmonger (24302)
    PDFLib lite [pdflib.com]
    This is the open-source version. It requires you to use and OSI-approved license on your app. PHP uses a version of PDFLib. We use the commercial version of PDFlib to produce reports like this sample report [panoramicfeedback.com].

    Panda [stillhq.com]
    Panda is GPLed. I haven't tried it.

    These libraries should give you total control over your output. I'm not sure if you want that degree of power, considering you have to do a lot of work yourself. Note also the total lack of support for importing vector images in both (this is
  • Laytex is the best thing to make pdfs. we use this at my university for creating pdf's that have large amounts of special characters and odd formatting. Im not too sure where to get it, but i do know its cross platform compatable and really sw33t in a *nix enviroment.

    good luck mano
  • I have adapted a PDF library (cPDF) into a pure-Ruby solution. It is still in alpha stage (I have a lot more work I want to do on it), but it will improve (I'm working on another project briefly).

    -austin
  • Your outputting some kind of report that needs exact formating right?
    Generate a template in your WYSIWYG editor of choice, export to PDF. And then edit the PDF with a text editor and insert @@@VAR_1@@@ type srtings as approiate. Then use something as simple as sed to replace them all.

    Hmm.. Maby not, looking at a few pdfs taht I happen to have lying around the important part is encoded somehow.. Fuckers. Ok, do the same, generating a template as PS, do the subsutition on the template PS and then ps2pdf....

  • by Karora (214807) on Friday October 24, 2003 @10:55PM (#7306359) Homepage


    In PHP I use pdf-php [sourceforge.net], which is simple and straightforward. I've used this to produce invoices for a non-profit that I voluntarily did a membership system for in PHP.

    If I want to mailmerge a document I would just use OpenOffice 1.1 - it does both parts perfectly well.

    There are heaps of "printer driver" approaches as well, and of course there is Ghostscript, which has been doing this for many years.

  • If it's capable of printing, you should have a Print to PDF option. Use it. This is plainly an easy RTFM, why is this on Ask Slashdot?
  • At work we use Ghostscript and "Redirection Port Monitor" to print PDFs on Windows desktops. It's all free, but I don't know that it's all open source.
  • If you have access to a machine running OS X, open the document you want to convert to PDF, click "print", then tab to "output options" and "save as pdf".

    Voila, the cheapest way to save to PDF, because its free!
  • TeX! (Score:2, Troll)

    by larry bagina (561269)
    if you want pdfs that don't look like goatse's [goatse.cx] asshole after being ham-slammed, the only choice is (La)TeX. There are 3 options:
    1. use PDFLaTeX, which produces PDF files rather than DVI files.
    2. use (La)TeX to produce DVI files, convert to postscript (dvips), then convert to pdf
    3. use (La)Tex to produce DVI files, then use dvipdfm to convert to PDF.

    dvipdfm is well documented and FREE, so you should be able to see how to create a PDF file. Of course, the PDF file format is also well documented by Adobe. That

  • I personally have had very good luck with ReportLab [reportlab.org]. If you would like to use Python, look no further.

  • Print to a file using a PostScript printer driver and convert the resulting PostScript file into PDF with GhostScript.
  • You can use just about anything.
    Now.. most programs that allow you to print, can also print to a file,
    and you get a postscript file. As part of ghostscript, there is the
    ps2pdf tool. So, e.g. making a pdf of say.. www.slashdot.org is a nobrainer.

    Other "creators" include OpenOffice.org 1.1 and later.
    LyX
    And you can ofcourse write Docbook documents, or TeX documents and
    easily transform them to pdf.
  • One thing I haven't heard mentioned is creating ps files and then converting them to pdf.

    AFAIK, ps is widely supported under linux. ps2pdf comes with the ghostscript package.
  • On windows, there is a very excellent add supported/cheap converter called PDF995 [pdf995.com]. You can get rid of the adds for $10 per person (less in volume). They also have an app called PDFEdit995 which allows you to do lots of modifications and offers lots of utilites, and Signature995 which allows for encryption and digital signatures. I have found the quaility to be better than GhostScript.
  • There's a good Perl package PDF::API2, you can scan the source at:

    http://search.cpan.org/~areibens/PDF-API2-0.3r77/M ANIFEST [cpan.org]

    It's pretty readable and the basic text output and font metrics all work. It's very easy to produce output with from Perl, so you can very rapidly prototype your reports and see what the resulting PDF contains.

    You can also tweak it a bit and disable the PDF stream compression feature so you can really see what'ts going on.

    There are several parts of the package that aren't co

  • It may not be what you're looking for because it's an API more than a PDF-writing application, but Reportlab [sourceforge.net] is a great high-level pdf-writing API for python. It's quite easy to write scripts to query DBs and generate good reports. It's also great for charting/graphics. It includes great documentation and lots of example code.

    Plus, being open source, it's easy to read the code.

  • The format is not that bad, and Adobe has a document describing it in detail. It only took me a week or so to learn how to generate my own, and I was a much worse programmer then...
  • Open Source DTP application Scribus [planetmirror.com] includes an excellent PDF engine, which conforms with ISO standard PDF/X-3 and is capable of producing high-quality, press-ready PDF files.

    Tinker around the source and you should be able to extract necessary pieces from there.
  • The display system underlying Mac OS X (Jaguar, Panther, etc.) is founded on PDF, so it can create a PDF of anything natively. No added tools, just print and specify PDF.
  • If you are a fairly adept programmer, I would recommend ReportLab.

    Seriously, if you don't know Python, this is definitely a reason to learn. I've written dozens of tiny systems that pull data from PostgreSQL (MySQL is just as easy) to create special reports for clients. I've also done two fairly large and flexible formats.

    The nicest thing about ReportLab is that it gives you primitives like tables, paragraphs, pages, and the like rather than just a drawing library. You also get various chart primitives
  • I'm sure someone has already mentioned this but pdfbox is a great api. I've used this java package in one my projects already.

    http://pdfbox.org/

  • On Windows you could also try the following (haven't seen it mentioned here before) : http://sourceforge.net/projects/pdfcreator/ (Open Source, GPL)
  • Windows users can setup an Apple Color Postscript printer selecting 'File:' on the port selection screen.

    Print any document using the new printer. Chage the file extension to 'ps' from 'prn' then use Ghostscript and GSView to view and convert the ps file to pdf.

Never try to teach a pig to sing. It wastes your time and annoys the pig. -- Lazarus Long, "Time Enough for Love"

Working...