Re: PDFKit on 10.12

2016-10-05 Thread Kyle Sluder
On Wed, Oct 5, 2016, at 04:08 AM, Jonathan Mitchell wrote:
> 
> > On 5 Oct 2016, at 07:52, Antonio Nunes  wrote:
> > 
> > On 04 Oct 2016, at 14:26, Jonathan Mitchell  wrote:
> >> 
> >> PDFKit seems a bit disturbed on Sierra.
> >> The 10.12 beta 3 seems to improve things but there are still some 
> >> rendering stutters etc.
> > 
> > 1. Why are you referring to a beta, when 10.12 has been out for weeks now?
> 
> Oops. that should have been 10.12.1 Beta (16B2338c)..
> 
> > Whatever is going on with PDFKit, it’s not good.
> 
> 
> I agree with that.
> 
> PDFKit is long in the tooth and the documentation is a bit patchy.
> However there is no way I can just write it off.
> 
> My solution involves assembling multipage PDFs from templates that
> incorporate a static base PDF over which I write text derived from my
> object model.
> The composed PDF is then viewed, printed or exported.
> On 10.9 to 10.11 peace reigns.
> 
> The 10.12 issues are rather unpredictable.
> Some documents render fine others don’t.
> Obviously this makes tracking down the source of the issues tough.
> It also makes it difficult to come up with meaningfully directed bug
> reports to send back in to bugreporter.apple.com.
> 
> It would be helpful if someone from the PDFKit development team would
> chip in with insight into how the kit has changed in 10.12.
> 
> If not I might need to go down the route of a TSI.

The first thing DTS will ask you is, “what are your bug numbers?” So
work on filing those first. A minimally-useful bug report is better than
no bug report at all.

--Kyle Sluder

> 
> Jonathan

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: PDFKit on 10.12

2016-10-05 Thread Jonathan Mitchell

> On 5 Oct 2016, at 07:52, Antonio Nunes  wrote:
> 
> On 04 Oct 2016, at 14:26, Jonathan Mitchell  wrote:
>> 
>> PDFKit seems a bit disturbed on Sierra.
>> The 10.12 beta 3 seems to improve things but there are still some rendering 
>> stutters etc.
> 
> 1. Why are you referring to a beta, when 10.12 has been out for weeks now?

Oops. that should have been 10.12.1 Beta (16B2338c)..

> Whatever is going on with PDFKit, it’s not good.


I agree with that.

PDFKit is long in the tooth and the documentation is a bit patchy.
However there is no way I can just write it off.

My solution involves assembling multipage PDFs from templates that incorporate 
a static base PDF over which I write text derived from my object model.
The composed PDF is then viewed, printed or exported.
On 10.9 to 10.11 peace reigns.

The 10.12 issues are rather unpredictable.
Some documents render fine others don’t.
Obviously this makes tracking down the source of the issues tough.
It also makes it difficult to come up with meaningfully directed bug reports to 
send back in to bugreporter.apple.com.

It would be helpful if someone from the PDFKit development team would chip in 
with insight into how the kit has changed in 10.12.

If not I might need to go down the route of a TSI.

Jonathan


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: PDFKit on 10.12

2016-10-04 Thread Antonio Nunes
On 04 Oct 2016, at 14:26, Jonathan Mitchell  wrote:
> 
> PDFKit seems a bit disturbed on Sierra.
> The 10.12 beta 3 seems to improve things but there are still some rendering 
> stutters etc.

1. Why are you referring to a beta, when 10.12 has been out for weeks now?

> Has PDFKit been reworked - there doesn’t seem to be any mention of it in the 
> release notes?
> If so it might be a question of waiting for the internal gremlins to be 
> hunted down rather than me wasting too much time on this.

Whatever is going on with PDFKit, it’s not good. At least, it wasn’t for 10.11 
and 10.12. PDFKit developed some serious flaws in 10.11, and despite my bug 
reporting these issues did not get fixed. It’s even so bad that in a 10.12 beta 
I reported how one of those bugs was affecting the Preview app, and in the next 
beta issue was fixed in Preview, but not in PDFKit. Which leads me to believe 
that Preview may no longer be using PDFKit, or at least not its public API in 
places. And no acknowledgement from Apple whatsoever about any of the PDFKit 
related bug reports. The issues concerning rendering in PDFKit since 10.11 
cripple such a significant part of my software’s functionality, without the 
possibility of a workaround, that I had to decide to EOL my software, now that 
it is clear that they won’t be fixed in 10.12.

At the moment I cannot recommend the use of PDFKit for third party developers.

-António
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

PDFKit on 10.12

2016-10-04 Thread Jonathan Mitchell
PDFKit seems a bit disturbed on Sierra.
The 10.12 beta 3 seems to improve things but there are still some rendering 
stutters etc.

Has PDFKit been reworked - there doesn’t seem to be any mention of it in the 
release notes?
If so it might be a question of waiting for the internal gremlins to be hunted 
down rather than me wasting too much time on this.

Before 10.12 PDFPage -(void)drawWithBox:(PDFDisplayBox)box was called.

In 10.12 PDFPage -(void)drawWithBox:(PDFDisplayBox)box 
toContext:(CGContextRef)context was defined.

However, on 10.12.0 when printing NSPrintThumbnailView calls 
drawWithBox:(PDFDisplayBox)box inContext:(CGContextRef)context not toContext:.
My only solution here has been to override the private  PDFPage 
-(void)drawWithBox:(PDFDisplayBox)box inContext:(CGContextRef)context

In addition screen rendering seems to be suffering.
Rendering now has to target the CGContextRef given in PDFPage 
drawWithBox:toContext:

I render additional text onto the PDF using NSLayoutManager using a flipped 
NSGraphicsContext.

Pre 10.12 this worked fine. Now it is flakey - often I just get a PDFPage rect 
filled with red (printing seems okay).
Perhaps I am not handling the context correctly.

It would seem that the actual generation is now called on a background thread 
and that [NSGraphicsContext currentContext] can be nil.
I try to deal with this but all is still not quite what it was.

- (void)drawWithBox:(PDFDisplayBox)box inContext:(CGContextRef)context
{
[super drawWithBox:box inContext:context];
   
  BOOL hasInitialNSGraphicsContext = NO;

if ([NSGraphicsContext currentContext]) {
[NSGraphicsContext saveGraphicsState];
hasInitialNSGraphicsContext = YES;
}
else {
CGContextSaveGState(context);
}

// life is much easier if we use a flipped co-ordinate system.
// NSLayoutManager expects a flipped NSGraphicsContext to be present.
NSGraphicsContext *flippedGC = [NSGraphicsContext 
graphicsContextWithGraphicsPort:context flipped:YES];
[NSGraphicsContext setCurrentContext:flippedGC];

// define the flip transform
NSAffineTransform* xform = [NSAffineTransform transform];
[xform translateXBy:0.0 yBy:self.mediaBoxRect.size.height];
[xform scaleXBy:1.0 yBy:-1.0];
[xform concat];

// draw all map items
… do my drawing here

if (hasInitialNSGraphicsContext) {
[NSGraphicsContext restoreGraphicsState];
}
else {
CGContextRestoreGState(context);
}

}

Jonathan
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com