ConTeXt ignores crop in some pdf graphics
Hello! After updating ConTeXt I found out that it has suddenly started to ignore the crop in some of my pdf graphics. These graphics look ok (=cropped) in Acrobat and SumatraPDF, but when the graphic is placed, the cropbox (?) is ignored and there's all this blank space around the graphic, space that shouldn't be there. This is new behaviour, all of the graphics worked as expected in my previous ConTeXt (from September 2017). Minimal sample is attached to this email, hopefully it is small enough to make it to the mailing list. After a quick look it seems that all the problematic graphics are pdf output from CorelDraw, from different versions of that. Oddly the problem doesn't affect all cropped graphics that originate from CorelDraw, just some of them. There are even graphics that have been outputted from one and same file where one works and the other doesn't. If this only concerns files from Corel (and not those I cropped in Acrobat), I can fix it in Corel if necessary. However, it would be preferable if ConTeXt can be forced to take the cropping into account. I tried looking for a solution on the wiki, but it wasn't very helpful (or I don't know what I'm looking for). I thought adding something to \externalfigure might do the trick, but there doesn't seem to be a suitable key. Thanks, Mari
Hi Mari, I can confirm the same behaviour with graphics from other sources like Illustrator - seems like ConTeXt doesn't use the CropBox (visible size) any more, but the MediaBox (full sheet). Or maybe the TrimBox (cut size). It would make sense to have than configurable, but the change in behaviour is really inconvenient. Greetlings from one row in front of you ;) Hraban Am 03.09.2018 um 17:31 schrieb Mari Voipio:
Hello!
After updating ConTeXt I found out that it has suddenly started to ignore the crop in some of my pdf graphics. These graphics look ok (=cropped) in Acrobat and SumatraPDF, but when the graphic is placed, the cropbox (?) is ignored and there's all this blank space around the graphic, space that shouldn't be there. This is new behaviour, all of the graphics worked as expected in my previous ConTeXt (from September 2017). Minimal sample is attached to this email, hopefully it is small enough to make it to the mailing list.
After a quick look it seems that all the problematic graphics are pdf output from CorelDraw, from different versions of that. Oddly the problem doesn't affect all cropped graphics that originate from CorelDraw, just some of them. There are even graphics that have been outputted from one and same file where one works and the other doesn't.
If this only concerns files from Corel (and not those I cropped in Acrobat), I can fix it in Corel if necessary. However, it would be preferable if ConTeXt can be forced to take the cropping into account. I tried looking for a solution on the wiki, but it wasn't very helpful (or I don't know what I'm looking for). I thought adding something to \externalfigure might do the trick, but there doesn't seem to be a suitable key.
Thanks, Mari
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________
On 09/04/2018 09:00 AM, Henning Hraban Ramm wrote:
Hi Mari, I can confirm the same behaviour with graphics from other sources like Illustrator - seems like ConTeXt doesn't use the CropBox (visible size) any more, but the MediaBox (full sheet). Or maybe the TrimBox (cut size). It would make sense to have than configurable, but the change in behaviour is really inconvenient.
Hi Mari and Hraban, I have just discovered that \setupexternalfigure has a "size" option with values "none media crop trim art". They don’t seem to work, but I wonder whether this might be the configuration command that you are looking for (which might have a bug). Just in case it helps, Pablo -- http://www.ousia.tk
Am 04.09.2018 um 21:22 schrieb Pablo Rodriguez:
On 09/04/2018 09:00 AM, Henning Hraban Ramm wrote:
Hi Mari, I can confirm the same behaviour with graphics from other sources like Illustrator - seems like ConTeXt doesn't use the CropBox (visible size) any more, but the MediaBox (full sheet). Or maybe the TrimBox (cut size). It would make sense to have than configurable, but the change in behaviour is really inconvenient.
Hi Mari and Hraban,
I have just discovered that \setupexternalfigure has a "size" option with values "none media crop trim art".
They don’t seem to work, but I wonder whether this might be the configuration command that you are looking for (which might have a bug).
Hi Pablo, Hans investigated and could trace my problem to an Acrobat bug (or at least it doesn't adhere to the PDF specs): I had my logo exported from Illustrator and changed the boxes in Acrobat Pro 9, then saved. But if you don't "save as", Acrobat creates a XForm inside a page, but doesn't set the boxes correctly for the page (CropBox missing, Artbox was what I needed). While all(?) viewers work around this, ConTeXt's new PDF handler, the ppl library, adheres strictly to the PDF specs and falls back to MediaBox if CropBox is missing. I tried size=artbox and box=artbox, but size=art actually does what I need - thanks for the hint! Greetlings, Hraban
On 09/04/2018 10:40 PM, Henning Hraban Ramm wrote:
[...] Hans investigated and could trace my problem to an Acrobat bug (or at least it doesn't adhere to the PDF specs): I had my logo exported from Illustrator and changed the boxes in Acrobat Pro 9, then saved. But if you don't "save as", Acrobat creates a XForm inside a page, but doesn't set the boxes correctly for the page (CropBox missing, Artbox was what I needed).
Hi Hraban, the document sent by Mari (ex.pdf) contains the following information: 4 0 obj << /CropBox [ 265.961 392.102 329.315 445.535 ] /Parent 2 0 R /Contents 5 0 R /BleedBox [ 265.961 392.102 329.315 445.535 ] /MediaBox [ -9 -9 604.276 850.89 ] /TrimBox [ 265.961 392.102 329.315 445.535 ] /Resources << /ProcSet [ /PDF ] /ExtGState << /GS6 6 0 R >> >> /Type /Page >> endobj I would say, that in the following sample: \starttext \externalfigure[ex.pdf][size=crop] \stoptext the option "size" doesn’t seem to work. Or is the original ex.pdf document flawed? Pablo -- http://www.ousia.tk
On Wed, Sep 5, 2018 at 4:37 PM Pablo Rodriguez
On 09/04/2018 10:40 PM, Henning Hraban Ramm wrote:
[...] Hans investigated and could trace my problem to an Acrobat bug (or at least it doesn't adhere to the PDF specs): I had my logo exported from Illustrator and changed the boxes in Acrobat Pro 9, then saved. But if you don't "save as", Acrobat creates a XForm inside a page, but doesn't set the boxes correctly for the page (CropBox missing, Artbox was what I needed).
Hi Hraban,
the document sent by Mari (ex.pdf) contains the following information:
4 0 obj
<<
/CropBox [ 265.961 392.102 329.315 445.535 ]
/Parent 2 0 R
/Contents 5 0 R
/BleedBox [ 265.961 392.102 329.315 445.535 ]
/MediaBox [ -9 -9 604.276 850.89 ]
/TrimBox [ 265.961 392.102 329.315 445.535 ]
/Resources <<
/ProcSet [ /PDF ]
/ExtGState <<
/GS6 6 0 R
>>
>>
/Type /Page
>>
endobj
I would say, that in the following sample:
\starttext
\externalfigure[ex.pdf][size=crop]
\stoptext
the option "size" doesn’t seem to work.
Or is the original ex.pdf document flawed?
we are working to extend luatex to manage these situations. -- luigi
Hello Pablo,
thank you for digging up all of that. What I found out today is that
while a graphic outputted from an old Corel (output e.g. pdf 1.3) has
all that extra whitespace, a graphic outputted from my newish Corel
2017 (pdf 1.7) seems to have a working cropbox as does the old
graphic recropped with Acrobat as Hraban's Save As trick). I've
included an old graphic (fm.pdf), the same outputted today
(fm_corel_2017) and the old one after recropping it (I reset old
cropbox and cropped again) (fm_cropped), if somebody feels like
investigating further.
While the cropbox problem meant that I had to spend a few hours today
fixing problematic graphics in my big old file, the fact that output
from my current Corel works means that any future graphics will be
fine and I don't have to change my workflows. This reduces the problem
into the level of minor annoyance, assuming it can't be fixed.
Thank you everybody for your help,
Mari
On Wed, Sep 5, 2018 at 5:40 PM Pablo Rodriguez
On 09/04/2018 10:40 PM, Henning Hraban Ramm wrote:
[...] Hans investigated and could trace my problem to an Acrobat bug (or at least it doesn't adhere to the PDF specs): I had my logo exported from Illustrator and changed the boxes in Acrobat Pro 9, then saved. But if you don't "save as", Acrobat creates a XForm inside a page, but doesn't set the boxes correctly for the page (CropBox missing, Artbox was what I needed).
Hi Hraban,
the document sent by Mari (ex.pdf) contains the following information:
4 0 obj
<<
/CropBox [ 265.961 392.102 329.315 445.535 ]
/Parent 2 0 R
/Contents 5 0 R
/BleedBox [ 265.961 392.102 329.315 445.535 ]
/MediaBox [ -9 -9 604.276 850.89 ]
/TrimBox [ 265.961 392.102 329.315 445.535 ]
/Resources <<
/ProcSet [ /PDF ]
/ExtGState <<
/GS6 6 0 R
>>
>>
/Type /Page
>>
endobj
I would say, that in the following sample:
\starttext
\externalfigure[ex.pdf][size=crop]
\stoptext
the option "size" doesn’t seem to work.
Or is the original ex.pdf document flawed?
Pablo -- http://www.ousia.tk ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________
On 09/05/2018 07:56 PM, Mari Voipio wrote:
Hello Pablo,
thank you for digging up all of that. What I found out today is that while a graphic outputted from an old Corel (output e.g. pdf 1.3) has all that extra whitespace, a graphic outputted from my newish Corel 2017 (pdf 1.7) seems to have a working cropbox as does the old graphic recropped with Acrobat as Hraban's Save As trick). I've included an old graphic (fm.pdf), the same outputted today (fm_corel_2017) and the old one after recropping it (I reset old cropbox and cropped again) (fm_cropped), if somebody feels like investigating further.
Hello Mari, only a comment, Corel 2017 sets all boxes with the same values: /MediaBox [ -1 -1 48.9999 23.8555 ] /TrimBox [ -1 -1 48.9999 23.8555 ] /CropBox [ -1 -1 48.9999 23.8555 ] Also your "fm.pdf" works fine when the media box has the same values as the other boxes. Best wishes, Pablo -- http://www.ousia.tk
participants (4)
-
Henning Hraban Ramm
-
luigi scarso
-
Mari Voipio
-
Pablo Rodriguez