Thomas Freitag | 1 Feb 18:32
Picon

pdfseparate PDF/X conform

Hi!

I was surprised that some guys are really using my small tools 
pdfseparate and pdfunite. So here a small patch which is hopefully also 
useful for them:

patch for psdseparate:
Produce  PDF/X conform pdf pages if the originally PDF was PDF/X conform.

Cheers,
Thomas

diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc
index 1c85385..08c7145 100644
--- a/poppler/PDFDoc.cc
+++ b/poppler/PDFDoc.cc
@@ -603,22 +603,38 @@ int PDFDoc::savePageAs(GooString *name, int pageNo)
   }
   outStr = new FileOutStream(f,0);

-  yRef = new XRef();
+  yRef = new XRef(getXRef()->getTrailerDict());
   countRef = new XRef();
   yRef->add(0, 65535, 0, gFalse);
   writeHeader(outStr, getPDFMajorVersion(), getPDFMinorVersion());

-  // get and mark optional content groups
-  OCGs *ocgs = getCatalog()->getOptContentConfig();
(Continue reading)

Ralph Gootee | 1 Feb 18:58

Re: pdfseparate PDF/X conform

Thanks Thomas!

We do a lot of PDF splitting, and there's almost nothing that supports it as well as pdfseparate. pdftk and
pypdf both fail on many common PDF types we encounter, and are slower to boot.

Cheers,
Ralph

-- 
Ralph Gootee
415.347.6201
(founder of loupe.io, a blueprint reader for the iPad)

On Wednesday, February 1, 2012 at 9:32 AM, Thomas Freitag wrote:

> Hi!
> 
> I was surprised that some guys are really using my small tools 
> pdfseparate and pdfunite. So here a small patch which is hopefully also 
> useful for them:
> 
> patch for psdseparate:
> Produce PDF/X conform pdf pages if the originally PDF was PDF/X conform.
> 
> Cheers,
> Thomas
> 
> _______________________________________________
> poppler mailing list
> poppler <at> lists.freedesktop.org (mailto:poppler <at> lists.freedesktop.org)
(Continue reading)

Albert Astals Cid | 1 Feb 19:19
Picon
Favicon
Gravatar

Re: pdfseparate PDF/X conform

El Dimecres, 1 de febrer de 2012, a les 18:32:45, Thomas Freitag va escriure:
> Hi!
> 
> I was surprised that some guys are really using my small tools
> pdfseparate and pdfunite. So here a small patch which is hopefully also
> useful for them:
> 
> patch for psdseparate:
> Produce  PDF/X conform pdf pages if the originally PDF was PDF/X conform.

I've commited it to trunk for 0.20 release, i have to confess i have not tried 
to understand/regtest it.

Albert

> 
> Cheers,
> Thomas
Albert Astals Cid | 1 Feb 19:19

poppler/PDFDoc.cc poppler/XRef.cc poppler/XRef.h

 poppler/PDFDoc.cc |   63 +++++++++++++++++++++++++++++++++---------------------
 poppler/XRef.cc   |    9 ++++++-
 poppler/XRef.h    |    5 +++-
 3 files changed, 51 insertions(+), 26 deletions(-)

New commits:
commit 0089357de8ea96f3e394ea9cb37e8182ccf15ae2
Author: Thomas Freitag <Thomas.Freitag <at> kabelmail.de>
Date:   Wed Feb 1 19:17:38 2012 +0100

    pdfseparate: Produce PDF/X conformant pdf pages if the original PDF was PDF/X conformant.

diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc
index 1c85385..0932d84 100644
--- a/poppler/PDFDoc.cc
+++ b/poppler/PDFDoc.cc
@@ -603,22 +603,38 @@ int PDFDoc::savePageAs(GooString *name, int pageNo)
   }
   outStr = new FileOutStream(f,0);

-  yRef = new XRef();
+  yRef = new XRef(getXRef()->getTrailerDict());
   countRef = new XRef();
   yRef->add(0, 65535, 0, gFalse);
   writeHeader(outStr, getPDFMajorVersion(), getPDFMinorVersion());

-  // get and mark optional content groups
-  OCGs *ocgs = getCatalog()->getOptContentConfig();
-  if (ocgs != NULL) {
-    Object catDict, optContentProps;
(Continue reading)

Leonard Rosenthol | 1 Feb 19:24
Picon
Favicon

Re: pdfseparate PDF/X conform

Be aware this patch is incomplete!  It won't work for most PDF/X files -
for any flavor of PDF/X (remembering, that there are 8 of them!).

Leonard

On 2/1/12 6:32 PM, "Thomas Freitag" <Thomas.Freitag <at> kabelmail.de> wrote:

>Hi!
>
>I was surprised that some guys are really using my small tools
>pdfseparate and pdfunite. So here a small patch which is hopefully also
>useful for them:
>
>patch for psdseparate:
>Produce  PDF/X conform pdf pages if the originally PDF was PDF/X conform.
>
>Cheers,
>Thomas
>
Albert Astals Cid | 1 Feb 22:55

Branch 'xpdf303merge' - poppler/Annot.cc poppler/ArthurOutputDev.cc poppler/CairoFontEngine.cc poppler/CharCodeToUnicode.h poppler/CMap.cc poppler/CMap.h poppler/FontInfo.cc poppler/Gfx.cc poppler/GfxFont.cc poppler/GfxFont.h poppler/GfxState.cc poppler/GfxState.h poppler/GlobalParams.cc poppler/GlobalParams.h poppler/GlobalParamsWin.cc poppler/PreScanOutputDev.cc poppler/PSOutputDev.cc poppler/PSOutputDev.h poppler/SplashOutputDev.cc poppler/XRef.cc

 poppler/Annot.cc            |    6 
 poppler/ArthurOutputDev.cc  |   47 --
 poppler/CMap.cc             |  153 ++++++++
 poppler/CMap.h              |   16 
 poppler/CairoFontEngine.cc  |   43 --
 poppler/CharCodeToUnicode.h |    1 
 poppler/FontInfo.cc         |    8 
 poppler/Gfx.cc              |  363 +++++++++++--------
 poppler/GfxFont.cc          |  831 +++++++++++++++++++++++++++++---------------
 poppler/GfxFont.h           |   34 -
 poppler/GfxState.cc         |   81 ++--
 poppler/GfxState.h          |    2 
 poppler/GlobalParams.cc     |  738 ++++++++++++++++++++++-----------------
 poppler/GlobalParams.h      |  112 ++---
 poppler/GlobalParamsWin.cc  |  180 +++++++--
 poppler/PSOutputDev.cc      |  591 +++++++++++++++----------------
 poppler/PSOutputDev.h       |   12 
 poppler/PreScanOutputDev.cc |   10 
 poppler/SplashOutputDev.cc  |   59 +--
 poppler/XRef.cc             |   16 
 20 files changed, 2008 insertions(+), 1295 deletions(-)

New commits:
commit 4fcd42cfa4424992cd4b36af38bc6230ce0706c9
Author: Albert Astals Cid <aacid <at> kde.org>
Date:   Wed Feb 1 22:53:03 2012 +0100

    [xpdf303] More merges from Thomas (with minor fixes from me)
    
    Basically fonts related and some other small stuff
(Continue reading)

Leonard Rosenthol | 2 Feb 07:39
Picon
Favicon

Re: pdfseparate PDF/X conform

Offhand:

- You copy the Info dict, but not XMP
- You copy TrimBox, but not BleedBox.
- You took OUT the OCG copier, which means X-4 and X-5 aren't supported

As I said, there are 8 different flavors of PDF/X.  Are you only testing
this with X-1a:1999?   What about all the others??

Leonard

On 2/1/12 9:25 PM, "Anita Brüssow   (Kabel)" <Anita.Bruessow <at> kabelmail.de>
wrote:

>Can You also give a hint instead of just say it will not work? Acrobat
>checking the result tells that everything is okay.
>
>Thomas
>
>--------------------------------------------------
>From: "Leonard Rosenthol" <lrosenth <at> adobe.com>
>Sent: Wednesday, February 01, 2012 7:24 PM
>To: "Thomas Freitag" <Thomas.Freitag <at> kabelmail.de>;
><poppler <at> lists.freedesktop.org>
>Subject: Re: [poppler] pdfseparate PDF/X conform
>
>> Be aware this patch is incomplete!  It won't work for most PDF/X files -
>> for any flavor of PDF/X (remembering, that there are 8 of them!).
>>
>> Leonard
(Continue reading)

Thomas Freitag | 2 Feb 09:34
Picon

Re: pdfseparate PDF/X conform

Hi Leonard!

Thanks for the hints!

Am 02.02.2012 07:39, schrieb Leonard Rosenthol:
> Offhand:
>
> - You copy the Info dict, but not XMP
That's not true: XMP is part of the catalog dict, and that's now 
completely copied!
> - You copy TrimBox, but not BleedBox.
Okay, I saw that in the documentation, but because Acrobat hadn't 
claimed that when checking compatibiliy I didn't care.
> - You took OUT the OCG copier, which means X-4 and X-5 aren't supported
Same as the first point: instead of copying ONLY the optional content, I 
copy now the COMPLETE catalog dict  (and referenced objects, with 
changes to the pages of course!)
>
> As I said, there are 8 different flavors of PDF/X.  Are you only testing
> this with X-1a:1999?   What about all the others??
I tested up to PDF/X-3:2003

Thomas
>
> Leonard
>
>
> On 2/1/12 9:25 PM, "Anita Brüssow   (Kabel)"<Anita.Bruessow <at> kabelmail..de>
> wrote:
>
(Continue reading)

Thomas Freitag | 2 Feb 15:30
Picon

Re: pdfseparate PDF/X conform

Am 01.02.2012 19:19, schrieb Albert Astals Cid:
> El Dimecres, 1 de febrer de 2012, a les 18:32:45, Thomas Freitag va escriure:
>> Hi!
>>
>> I was surprised that some guys are really using my small tools
>> pdfseparate and pdfunite. So here a small patch which is hopefully also
>> useful for them:
>>
>> patch for psdseparate:
>> Produce  PDF/X conform pdf pages if the originally PDF was PDF/X conform.
> I've commited it to trunk for 0.20 release, i have to confess i have not tried
> to understand/regtest it.
You see me really contrite: Because of the discussion with Leonard I 
suddenly encountered that I forgot to merge an important change: Using 
markPageObjects now also with the catalog dict we need of course to 
remove the dict entries from catalog which refers to other pages as the 
one which should be separated. I forgot to merge this to my new git 
copy, therefore it wasn't part of the patch. But unfortunately without 
it a lot of PDF can no more be handled with pdfseparate, and a lot of 
PDF objects will be kept in the resulting file even if no more referenced.
'Cause You already committed my patch, here just the part which was 
missing.

Sorry for the inconvenience,
Thomas
>
> Albert
>
>> Cheers,
>> Thomas
(Continue reading)

Leonard Rosenthol | 2 Feb 23:05
Picon
Favicon

Re: pdfseparate PDF/X conform

Copying the entire Catalog is NOT a good idea - there could be a variety of things in there that wouldn't copy
well (or would bloat the final document for no good reason).  The best example would be copying the
structure tree of a document during a split, where not all final pages are there...

The PDF/X standards say that you need EITHER a Bleed OR Trim - so you have to handle both possible cases.

Leonard

-----Original Message-----
From: Thomas Freitag [mailto:Thomas.Freitag <at> kabelmail.de] 
Sent: Thursday, February 02, 2012 3:34 AM
To: Leonard Rosenthol
Cc: poppler <at> lists.freedesktop.org
Subject: Re: [poppler] pdfseparate PDF/X conform

Hi Leonard!

Thanks for the hints!

Am 02.02.2012 07:39, schrieb Leonard Rosenthol:
> Offhand:
>
> - You copy the Info dict, but not XMP
That's not true: XMP is part of the catalog dict, and that's now completely copied!
> - You copy TrimBox, but not BleedBox.
Okay, I saw that in the documentation, but because Acrobat hadn't claimed that when checking compatibiliy
I didn't care.
> - You took OUT the OCG copier, which means X-4 and X-5 aren't 
> supported
Same as the first point: instead of copying ONLY the optional content, I copy now the COMPLETE catalog dict 
(Continue reading)


Gmane