Return-Path: DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 201E642268 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org D6CA742249 Content-Type: multipart/alternative; boundary="------------T777uxPf8r2GOpQhks1HF9k7" Message-ID: <6f83f586-b358-c2ba-4a81-e23b10f98e99@thax.hardliners.org> Date: Thu, 7 Dec 2023 21:17:49 +0100 MIME-Version: 1.0 Content-Language: en-US, de-DE References: From: Tobias Hoffmann In-Reply-To: Subject: Re: [Printing-architecture] PDFio: Replaced QPDF by PDFio in libcupsfilters as GSoC project? List-Id: Printing architecture under linux List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Michael Sweet , Till Kamppeter Cc: "printing-architecture@lists.linux-foundation.org" This is a multi-part message in MIME format. --------------T777uxPf8r2GOpQhks1HF9k7 Content-Type: text/plain; charset="utf-8"; format="flowed" Content-Transfer-Encoding: 8bit Hi, AFAIR the hard thing was exactly this: To transform(move, rotate) the annotations (just keeping them when no transformations are applied was never the problem), as required esp. for n-up. At the time, the "easiest" way – actually the only way I've seen it implemented in other open source projects – was to first convert the annotations into regular /Content commands (called "flatten" – implemented by Jay in QPDF) that are then simply subject to all the transformations applied there (which is not the case for /Annots, IIRC). AFAIK this also the only way to "clip" annotations to only be drawn inside a given area. But I would be delighted to see a different implementation. As a side note, when sufficiently complex transformations are required (e.g. n-up), the current qpdf based pdftopdf implementation converts pages to "Form XObjects", that could be draw just like Images onto new pages. But these XObjects cannot have Annotations themselves, only the Page where they would be drawn to has /Annots.   Tobias On 07/12/2023 18:38, Michael Sweet via Printing-architecture wrote: > Till, > >> On Dec 7, 2023, at 8:58 AM, Till Kamppeter >> wrote: >> >> Hi, >> >> Michael Sweet has closed the PDFio issue in which I ask for support >> of PDF forms and annotations, telling that inside PDFio nothing >> further needs to be done, that everything can be solved outside >> PDFio, by the calling application. >> >> As we want to get rid of C++ in libcupsfilters I plan to let it use >> PDFio where it is currently using QPDF. >> >> Mike, as you tell that PDFio is OK for handling PDF files with filled >> forms/annotations, I want to post a GSoC project idea to switch over >> libcupsfilters from using QPDF to PDFio. WDYT? Is this possible >> already? Or are there still any features missing in PDFio? > > It is entirely possible.  The ipptransform program (part of the > libcups project) shows how to do this, but it is really only necessary > if you are doing N-up or other combinations of multiple pages from the > input document.  If all you do is copy pages as-is then pdfioPageCopy > will handle copying all of the annotations referenced by the Annots > key in the page dictionary. > > (ipptransform needs to be updated to copy/merge the Annots values, and > I filed issue #71 in the libcups project to track that change...) > > ________________________ > Michael Sweet > > > _______________________________________________ > Printing-architecture mailing list > Printing-architecture@lists.linux-foundation.org > https://lists.linuxfoundation.org/mailman/listinfo/printing-architecture --------------T777uxPf8r2GOpQhks1HF9k7 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: 8bit
Hi,

AFAIR the hard thing was exactly this: To transform(move, rotate) the annotations (just keeping them when no transformations are applied was never the problem), as required esp. for n-up.

At the time, the "easiest" way – actually the only way I've seen it implemented in other open source projects – was to first convert the annotations into regular /Content commands (called "flatten" – implemented by Jay in QPDF) that are then simply subject to all the transformations applied there (which is not the case for /Annots, IIRC). AFAIK this also the only way to "clip" annotations to only be drawn inside a given area.

But I would be delighted to see a different implementation.

As a side note, when sufficiently complex transformations are required (e.g. n-up), the current qpdf based pdftopdf implementation converts pages to "Form XObjects", that could be draw just like Images onto new pages. But these XObjects cannot have Annotations themselves, only the Page where they would be drawn to has /Annots.

  Tobias


On 07/12/2023 18:38, Michael Sweet via Printing-architecture wrote:
Till,

On Dec 7, 2023, at 8:58 AM, Till Kamppeter <till.kamppeter@gmail.com> wrote:

Hi,

Michael Sweet has closed the PDFio issue in which I ask for support of PDF forms and annotations, telling that inside PDFio nothing further needs to be done, that everything can be solved outside PDFio, by the calling application.

As we want to get rid of C++ in libcupsfilters I plan to let it use PDFio where it is currently using QPDF.

Mike, as you tell that PDFio is OK for handling PDF files with filled forms/annotations, I want to post a GSoC project idea to switch over libcupsfilters from using QPDF to PDFio. WDYT? Is this possible already? Or are there still any features missing in PDFio?

It is entirely possible.  The ipptransform program (part of the libcups project) shows how to do this, but it is really only necessary if you are doing N-up or other combinations of multiple pages from the input document.  If all you do is copy pages as-is then pdfioPageCopy will handle copying all of the annotations referenced by the Annots key in the page dictionary.

(ipptransform needs to be updated to copy/merge the Annots values, and I filed issue #71 in the libcups project to track that change...)

________________________
Michael Sweet


_______________________________________________
Printing-architecture mailing list
Printing-architecture@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/printing-architecture


--------------T777uxPf8r2GOpQhks1HF9k7--