GSoC 2009 Improving PDF Export by thachtran

From Scribus Wiki
Revision as of 07:21, 30 March 2009 by Tran (talk | contribs) (New page: = Abstract = Over the course of developing Scribus, a lot of work has been done to make Scribus's outputs fit into a wide range of need from users. As PDF is the de facto standard for outp...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Abstract

Over the course of developing Scribus, a lot of work has been done to make Scribus's outputs fit into a wide range of need from users. As PDF is the de facto standard for outputting electronic documents, making Scribus's PDF outputs more robust and satisfiable, in term of users' need, is highly desirable. This project would aim to address a few important improvements which could be applied to Scribus's PDF exporting features. The main focus will be supporting PDF/X-1a, PDF/X-4 export and improving the embedding PDFs feature of Scribus. Depending on the actual progress of this project, it could extend to cover the implementation of embedding fonts' subsets when exporting PDFs .

Brief Background

PDF/X-1a and PDF/X-4 Export

About PDF/X

Scribus is currently be able to verify and produce PDF/X-3 documents. PDF/X-3 is one particular standard of PDF/X—a subset of PDF which concentrate on setting a standard (or rather an agreement) for exchanging documents between the creators and the printing vendors so that the creators can be assured (to some extend) about the fidelity of the final printed document. At the basic, PDF/X requires

  • all fonts have to be embedded
  • only printing content can be presented (prohibiting extra live content like security, forms, annotations, bookmarks, sound, video, etc)
  • printing conditions must be present (output intent)?

PDF/X-3

The PDF/X-3 is an ISO standard where it has the capability of attaching an ICC color profile to explicitly manage the color of the document as opposed to leave the color to be device-dependent. This will provide extra assurance for the users in term of the fidelity of the color of the end document. See [1] for more information on how Scribus supports this.

PDF/X-1a

This particular standard of PDF/X is a strict subset of PDF/X-3 where the main restriction is data has to be converted to CMYK before exchanging. This works best if the CMYK color profile to be converted into is clearly defined (this is usually the case in US). It is also worth noticing that a file is PDF/X-1a compliant is also PDF/X-3 compliant since the latter standard clearly support this idea. In Scribus, when exporting to PDF/X-3, by not selecting or embedding a color profile, CMYK is automatically selected as the color space so this is essentially exporting PDF/X-1a in a way.

PDF/X-4

This is on another hand, a superset of PDF/X-3 in which the main extension is allowing live transparency/layerings. The main reasons for the restriction of transparency in PDF/X-3 is because over the years, most of the printers is PostScript printers where their RIPs (Raster Image Processor) are working with PostScript's representations of the documents. Since PostScript was developed before the notion of transparency was introduced, it naturally cannot handle live transparency content (hence the restriction in PDF/X-3). Lately, as high-end printers can work directly on PDFs at RIP's level, they therefore can handle transparency and layering of the PDF. PDF/X-4 was consequently created in order to take advantage of this new technology.

PDF Embedding

At the moment, users can select PDF files to be added into the Scibus document's content (via "Insert Image Frame" and choosing the PDFs). By the time of exporting this content into PDF, users have the option of "truly" embedding these PDF contents into the output or just simply including these as raster images.

Unsurprisingly, choosing to embed these contents is more desirable since it would preserve the original content and therefore would give a better result when it comes to high-end printing. This is made possible by including the PDF contents as Form XObjects in the result PDF. One main focus of this project is trying to improve this feature.

Font Subsetting in PDF Export

As in the current version of Scribus, when exporting to PDF, users have the choice of embedding the fonts which have been used in the document into the output PDF. This is again, very desirable since it would preserve the document appearance better and in fact, PDF/X flavors of PDF requires all fonts to be embedded.

The way Scribus handles this at the moment is either embed the whole font file or make it into outlines—the used glyphs appear to be drawn manually (using path construction operators) in the Font's dictionary inside the document's Resources where the font is defined. A more common and natural way of doing this is to embed a subset of the font only where only used glyphs are included.

Project Goals

PDF/X-1a and PDF/X-4 Exporting

This part of the project will try to implement the features of exporting to PDF/X-1a and PDF/X-4. Upon completion, Scribus should be able to export documents which conform to these standards. This is also mean to extend the functionalities of the Preflight Verifier so that it will be able to verify documents against these standards.

As mentioned earlier, supporting PDF/X-1a would be quite straight forward since Scribus has fully supported PDF/X-3 already. From that, by restricting the output to only use CMYK for its color profile, this will then be a valid PDF/X-1a.

Supporting PDF/X-4 is a bit more involved, using PDF/X-3 rules as the basic one should open to allow live transparency/layering to be included as part of the document.

PDF Embedding

The PDF embedding feature of Scribus is basically working at the moment, however, the PDF contents are embedded more or less following an "as-is" fashion (the PDF content is included as a form XObject in which it will be painted exactly as if it was a stand-alone PDF).

The problem however arises as in case we need to explicitly manage the color profile of the final output (e.g. force all to be CMYK in case of PDF/X-1a), the colorspaces which are used in the embedded PDF contents need to be consistent with the whole document. At the moment, this is not the case in Scribus and therefore, this part of the project will try to solve that. This will involve converting from one colorspace to another and it is anticipated that the level of complexity would be high.

Font Subsetting in PDF Export

This idea will be severed as one possible extension of the project if time permits.

As discussed previously, this part of the project will aim to implement the font subsetting feature when exporting PDF, i.e. only embed a subset of the font containing the glyphs that are actually used in the document. This would improve the efficiency of the PDF output as it does not have to carry the whole font file.

Time Line

  • Now – May 23rd: Preliminary study: PDF, PDF/X, PoDoFo (PDF library which Scribus used), Scribus PDF Exporting source code, Qt.
  • May 23rd – June 15th: implementing the exporting to PDF/X-1a & PDF/X-4.
  • June 15th – July 15th: improving the PDF embedding feature.
  • July 15th – Aug. 03rd: if the PDF embedding feature is done, move on to implement the font subsetting feature; if not, carry on with the PDF embedding.
  • Aug. 03rd – Aug. 17th: finishing off the project, documentation and testing.

Participant Information

TBU