in reply to Generating multi page PDF with bitmap images, vector graphics and text.

PDF? Unless you're producing a paper for submission to a site that requires PDFs, this would be better done as separate HTML pages.

But given the PDF requirement, you need to be aware of the issue that arises when each page is constructed from hundreds of components that get encapsulated within the PDF. You can end up with a PDF containing millions of entities which tends to slow the rendering to a crawl.

If you must use PDF you may find the resulting file handles better in readers if small images and vector graphics are combined into larger images, reducing the number of items to be rendered.

It's not a good idea to let the requirement for multi-page PDF support eliminate otherwise good methods, since you can produce the multi-page document by combining single pages as the final processing step.

  • Comment on Re: Generating multi page PDF with bitmap images, vector graphics and text.

Replies are listed 'Best First'.
Re^2: Generating multi page PDF with bitmap images, vector graphics and text.
by chrestomanci (Priest) on Nov 22, 2010 at 11:22 UTC

    Thanks for your warning about generating a PDF with millions of elements, I did not know about that issue. For my problem, I will have around 160_000 elements in the total document, so not a million, but a fairly substantial number, which could probably be reduced by merging some images that are meant to appear adjacent to each other into a single image.

    There is not an absolute requirement for PDF, the requirement is to be able to print the final document onto paper, with precise control over the placement of elements. The document will be printed double sided, and elements on opposite sides of the sheet need to line up to within a millimetre or so. I know that PDF will meet that requirement, but I don't know of any other format that will. Is there a multi page extension to SVG?

      chrestomanci:

      If you want to keep the PDF small, you may want to scale and/or render all images into a common format at the size you want in the final document. Otherwise, some PDF tools may just put in the full-size graphic and scale it down internally. (That's fine, too, if you want them to be able to pull out the full-size graphic from the PDF file. But if you're captioning the graphics with an URL to give them access to them, then you probably don't want to distribute all of them in your PDF, too.)

      ...roboticus

      ...the requirement is to be able to print the final document onto paper, with precise control over the placement of elements. The document will be printed double sided, and elements on opposite sides of the sheet need to line up to within a millimetre or so. I know that PDF will meet that requirement, but I don't know of any other format that will

      Yes, that strict print requirement precludes using HTML.

      You looked into Cairo and SVG as intermediate formats but not any of the venerable print document formats? I guess it's an indication of how much the web has eclipsed print that its document formats are being lost to obscurity:

      FormatModules
      PostScriptCPAN (287 found)
      TeXCPAN (156 found)
      ODF (Open Document Format)CPAN (28 found)
      DVI (Device independent)CPAN (14 found)

      PostScript and TeX go way back, while ODF is new.